Changes requested for 6/22
* Reverted tab name nage back to original 3
* Changed heading in table to Select All
* Adjusted timeout period down to 500ms
* Lots of code formatting cleanup (Automated) (mostly whitespace)
* Moved catalog-dev back to catalog and removed gulp/build scripts. No
longer needed, firefox no longer has issues with scripts.
* Moved config back into the folder to reduce cluter now that there aren't
two versions of the release
* Removed unneeded .gitignores
Change-Id: I943d7796ca6317b4e890b666adea12707b1a8775
diff --git a/client/.gitignore b/client/.gitignore
deleted file mode 100644
index 46d349a..0000000
--- a/client/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-node_modules
-catalog
-
diff --git a/client/autogen.sh b/client/autogen.sh
deleted file mode 100755
index 94690a3..0000000
--- a/client/autogen.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-if [ ! hash git 2>/dev/null ]; then
- echo "git is required for this repo to function properly! Please install it.";
- exit 1;
-fi
-
-git submodule init ndn-js && git submodule update
-cd ndn-js && ./waf configure && ./waf && cd ..
-
-if [ ! hash npm 2>/dev/null ]; then
- echo "npm is required to build the production site. Only the dev site will be available.";
-
-else
-
- if [ ! hash gulp 2>/dev/null ]; then
- npm install -g gulp
- npm install
- fi
-
- npm upgrade
-
- gulp
-
-fi
-
diff --git a/client/catalog-dev/.gitignore b/client/catalog-dev/.gitignore
deleted file mode 100644
index d344ba6..0000000
--- a/client/catalog-dev/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-config.json
diff --git a/client/catalog-dev/config-example.json b/client/catalog/config-example.json
similarity index 100%
rename from client/catalog-dev/config-example.json
rename to client/catalog/config-example.json
diff --git a/client/config.json b/client/catalog/config.json
similarity index 100%
rename from client/config.json
rename to client/catalog/config.json
diff --git a/client/catalog-dev/css/cubeLoader.css b/client/catalog/css/cubeLoader.css
similarity index 100%
rename from client/catalog-dev/css/cubeLoader.css
rename to client/catalog/css/cubeLoader.css
diff --git a/client/catalog-dev/css/style.css b/client/catalog/css/style.css
similarity index 93%
rename from client/catalog-dev/css/style.css
rename to client/catalog/css/style.css
index f66938b..0146b6e 100644
--- a/client/catalog-dev/css/style.css
+++ b/client/catalog/css/style.css
@@ -153,22 +153,21 @@
display: block;
}
-.treeExplorer .treeExplorerExpander::before {
- font-family: "Glyphicons Halflings";
- content: "+";
+.treeExplorer .treeExplorerExpander:before {
+ content: "[+]";
color: gray;
}
-.treeExplorer .open > .nodeContent > .treeExplorerExpander::before {
- content: "\2212";
+.treeExplorer .open > .nodeContent > .treeExplorerExpander:before {
+ content: "[-]";
}
.treeExplorer .file > .nodeContent > .treeExplorerExpander {
cursor: default;
}
-.treeExplorer .file > .nodeContent > .treeExplorerExpander::before {
- content: "\e022"
+.treeExplorer .file > .nodeContent > .treeExplorerExpander:before {
+ content: "[=]"
}
#popup {
diff --git a/client/catalog-dev/css/theme.min.css b/client/catalog/css/theme.min.css
similarity index 100%
rename from client/catalog-dev/css/theme.min.css
rename to client/catalog/css/theme.min.css
diff --git a/client/catalog-dev/index.html b/client/catalog/index.html
similarity index 93%
rename from client/catalog-dev/index.html
rename to client/catalog/index.html
index 085ba75..78c0e73 100644
--- a/client/catalog-dev/index.html
+++ b/client/catalog/index.html
@@ -5,21 +5,19 @@
<title>NDN Query and Retrieval Tool</title>
<script>
-
(function(i, s, o, g, r, a, m) {
- i['GoogleAnalyticsObject'] = r;
- i[r] = i[r] || function() {
- (i[r].q = i[r].q || []).push(arguments)
- }
- ,
- i[r].l = 1 * new Date();
- a = s.createElement(o),
- m = s.getElementsByTagName(o)[0];
- a.async = 1;
- a.src = g;
- m.parentNode.insertBefore(a, m)
+ i['GoogleAnalyticsObject'] = r;
+ i[r] = i[r] || function() {
+ (i[r].q = i[r].q || []).push(arguments)
+ }
+ ,
+ i[r].l = 1 * new Date();
+ a = s.createElement(o),
+ m = s.getElementsByTagName(o)[0];
+ a.async = 1;
+ a.src = g;
+ m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
-
ga('create', 'UA-64984905-1', 'auto');
ga('send', 'pageview');
</script>
@@ -104,8 +102,9 @@
<a class="navbar-brand" data-toggle="tab" href="#filterSearch" id="brand-title">NDN Query and Retrieval Tool</a>
</div>
<ul class="navbar-nav nav">
- <li class="active" id="search-tab"><a data-toggle="tab" href="#filterSearch">Search</a></li>
- <li id="explore-tab"><a data-toggle="tab" href="#explore">Explore</a></li>
+ <li class="active" id="search-tab"><a data-toggle="tab" href="#filterSearch">Filter Search</a></li>
+ <li id="path-search-tab"><a data-toggle="tab" href="#path-search">Path Search</a></li>
+ <li id="tree-search-tab"><a data-toggle="tab" href="#tree-search">Tree Search</a></li>
</ul>
</div>
</header>
@@ -138,7 +137,7 @@
</div>
</div>
- <div class="tab-pane fade" id="explore">
+ <div class="tab-pane fade" id="path-search">
<div class="panel panel-info" id="pathSearch">
<div class="panel-heading">Path Search</div>
<div class="panel-body">
@@ -154,7 +153,10 @@
</form>
</div>
</div>
- <div class="panel panel-info" id="treeSearchPane">
+ </div>
+
+ <div class="tab-pane fade" id="tree-search">
+ <div class="panel panel-info" id="treeSearchPane">
<div class="panel-heading">Tree Search</div>
<div class="panel-body" id="treeSearch">
<div></div>
@@ -275,7 +277,7 @@
</div>
</form>
<div>
- <div class="list-group" id="direct-download-list"></div>
+ <div class="list-group" id="direct-download-list"></div>
</div>
</div>
</div>
diff --git a/client/catalog-dev/js/autocomplete.js b/client/catalog/js/autocomplete.js
similarity index 100%
rename from client/catalog-dev/js/autocomplete.js
rename to client/catalog/js/autocomplete.js
diff --git a/client/catalog-dev/js/catalog.js b/client/catalog/js/catalog.js
similarity index 92%
rename from client/catalog-dev/js/catalog.js
rename to client/catalog/js/catalog.js
index c3c49cf..880ea4e 100644
--- a/client/catalog-dev/js/catalog.js
+++ b/client/catalog/js/catalog.js
@@ -3,9 +3,9 @@
"use strict";
var config;
var conversions;
- Promise.all([
- new Promise(function(resolve, reject) {
- $.ajax('../config.json').done(function(data) {
+
+ Promise.all([new Promise(function(resolve, reject) {
+ $.ajax('config.json').done(function(data) {
config = data;
resolve();
}).fail(function() {
@@ -13,8 +13,7 @@
ga('send', 'event', 'error', 'config');
reject();
});
- }),
- new Promise(function(resolve, reject) {
+ }), new Promise(function(resolve, reject) {
var timeout = setTimeout(function() {
console.error("Document never loaded? Something bad has happened!");
reject();
@@ -23,28 +22,24 @@
clearTimeout(timeout);
resolve();
});
- }),
- new Promise(function(resolve, reject) {
+ }), new Promise(function(resolve, reject) {
$.getJSON('../conversions.json').done(function(data) {
conversions = data;
resolve();
- }).fail(function(){
+ }).fail(function() {
console.error("Failed to get conversions.");
ga('send', 'event', 'error', 'config');
//reject(); We will continue anyways. We don't need this functionality.
conversions = {};
resolve();
});
- })
- ]).then(function() {
-
+ })]).then(function() {
var getParameterByName = function(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var results = regex.exec(location.search);
- return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
-
//Overwrite config if present. Any failure will just cause this to be skipped.
try {
var configParam = JSON.parse(getParameterByName('config'));
@@ -52,19 +47,16 @@
} catch (e) {
console.warn("Failure in config overwrite, skipping.", e);
}
-
- new Atmos(config, conversions);
+ new Atmos(config,conversions);
}, function() {
console.error("Failed to initialize!");
ga('send', 'event', 'error', 'init');
});
-})();
+})();
var Atmos = (function() {
"use strict";
-
var closeButton = '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
-
var guid = function() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@@ -74,7 +66,6 @@
});
return uuid;
}
-
/**
* Atmos
* @version 2.0
@@ -86,7 +77,6 @@
* @param {Object} config - Object of configuration options for a Face.
*/
var Atmos = function(config, conversions) {
-
//Internal variables.
this.results = [];
this.resultCount = Infinity;
@@ -101,7 +91,6 @@
this.catalog = config['global']['catalogPrefix'];
this.catalogPrefix = new Name(this.catalog);
-
this.face = new Face(config['global']['faceConfig']);
//Easy access dom variables
@@ -116,12 +105,10 @@
this.requestForm = $('#requestForm');
var scope = this;
-
$('.requestSelectedButton').click(function() {
ga('send', 'event', 'button', 'click', 'request');
scope.request(scope.resultTable.find('.resultSelector:checked:not([disabled])').parent().parent());
});
-
this.filterSetup();
//Init autocomplete
@@ -167,12 +154,14 @@
scope.getResults(scope.page + 1);
}
});
+
this.resultMenu.find('.previous').click(function() {
ga('send', 'event', 'button', 'click', 'previous');
if (!$(this).hasClass('disabled')) {
scope.getResults(scope.page - 1);
}
});
+
this.resultMenu.find('.clearResults').click(function() {
ga('send', 'event', 'button', 'click', 'resultClear');
scope.clearResults();
@@ -183,19 +172,15 @@
//Change the number of results per page handler
var rpps = $('.resultsPerPageSelector').click(function() {
-
var t = $(this);
-
if (t.hasClass('active')) {
return;
}
-
rpps.find('.active').removeClass('active');
t.addClass('active');
scope.resultsPerPage = Number(t.text());
scope.getResults(0);
//Force return to page 1;
-
});
//Init tree search
@@ -205,14 +190,12 @@
scope.autoComplete(path, function(data) {
var list = data.next;
var last = (data.lastComponent === true);
-
if (last) {
console.log("Redirecting last element request to a search.");
scope.clearResults();
scope.query(scope.catalog, {
'??': path
- },
- function(interest, data) {
+ }, function(interest, data) {
console.log("Search response", interest, data);
scope.name = interest.getName();
scope.getResults(0);
@@ -223,7 +206,6 @@
return;
//Don't call the callback
}
-
console.log("Autocomplete response", list);
callback(list.map(function(element) {
return (path == "/" ? "/" : "") + element + "/";
@@ -233,34 +215,24 @@
$('#treeSearch').on('click', '.treeSearch', function() {
var t = $(this);
-
scope.clearResults();
-
var path = t.parent().parent().attr('id');
-
console.log("Tree search:", path);
-
scope.query(scope.catalog, {
'??': path
- },
- function(interest, data) {
+ }, function(interest, data) {
//Success
console.log("Tree search response", interest, data);
-
scope.name = interest.getName();
-
scope.getResults(0);
- },
- function(interest) {
+ }, function(interest) {
//Failure
console.warn("Request failed! Timeout", interest);
scope.createAlert("Request timed out.\"" + interest.getName().toUri() + "\" See console for details.");
});
-
});
this.setupRequestForm();
-
this.resultTable.popover({
selector: ".metaDataLink",
content: function() {
@@ -287,14 +259,13 @@
});
//Allow the title to change the tab
- $('#brand-title').click(function(){
+ $('#brand-title').click(function() {
//Correct active class on tabs.
- $('#explore-tab').removeClass('active');
+ $('#path-search-tab').removeClass('active');
+ $('#tree-search-tab').removeClass('active');
$('#search-tab').addClass('active');
});
-
}
-
Atmos.prototype.clearResults = function() {
this.results = [];
//Drop any old results.
@@ -306,66 +277,42 @@
Atmos.prototype.pathSearch = function() {
var value = this.searchInput.val();
-
this.clearResults();
-
var scope = this;
-
this.query(this.catalog, {
"??": value
- },
- function(interest, data) {
+ }, function(interest, data) {
console.log("Query response:", interest, data);
-
scope.name = interest.getName();
-
scope.getResults(0);
-
- },
- function(interest) {
+ }, function(interest) {
console.warn("Request failed! Timeout", interest);
scope.createAlert("Request timed out. \"" + interest.getName().toUri() + "\" See console for details.");
});
-
}
Atmos.prototype.search = function() {
-
var filters = this.getFilters();
-
console.log("Search started!", this.searchInput.val(), filters);
-
console.log("Initiating query");
-
this.clearResults();
-
var scope = this;
-
- this.query(this.catalog, filters,
- function(interest, data) {
+ this.query(this.catalog, filters, function(interest, data) {
//Response function
console.log("Query Response:", interest, data);
-
scope.name = interest.getName();
-
scope.getResults(0);
-
}, function(interest) {
//Timeout function
console.warn("Request failed after 3 attempts!", interest);
scope.createAlert("Request failed after 3 attempts. \"" + interest.getName().toUri() + "\" See console for details.");
});
-
}
Atmos.prototype.autoComplete = function(field, callback) {
-
var scope = this;
-
var result = {};
-
const getAll = function(interest, data) {
-
if (data.getContent().length !== 0) {
var resp = JSON.parse(data.getContent().toString().replace(/[\n\0]/g, ""));
if (result.next) {
@@ -376,11 +323,11 @@
} else {
callback(result);
}
-
var name = data.getName();
var segment = name.components[name.getComponentCount() - 1];
- if (segment.toSegment() !== data.getMetaInfo().getFinalBlockId().toSegment()){
- name = name.getPrefix(-1); //Remove segment
+ if (segment.toSegment() !== data.getMetaInfo().getFinalBlockId().toSegment()) {
+ name = name.getPrefix(-1);
+ //Remove segment
name.appendSegment(segment.toSegment() + 1);
scope.expressInterest(name, getAll, function() {
console.warn("Autocomplete timed out, results may be incomplete.");
@@ -390,28 +337,20 @@
} else {
callback(result);
}
-
}
-
this.query(this.catalog, {
"?": field
}, getAll);
-
}
Atmos.prototype.showResults = function(resultIndex) {
-
var results = this.results.slice(this.resultsPerPage * resultIndex, this.resultsPerPage * (resultIndex + 1));
-
- var resultDOM = $(
- results.reduce(function(prev, current) {
+ var resultDOM = $(results.reduce(function(prev, current) {
prev.push('<tr><td><input class="resultSelector" type="checkbox"></td><td class="popover-container"><a href="#" class="metaDataLink">');
prev.push(current);
prev.push('</a></td></tr>');
return prev;
- }, ['<tr><th><input id="resultSelectAll" type="checkbox" title="Select All"> Select</th><th>Name</th></tr>']).join('')
- );
-
+ }, ['<tr><th><input id="resultSelectAll" type="checkbox"> Select All</th><th>Name</th></tr>']).join(''));
resultDOM.find('#resultSelectAll').click(function() {
if ($(this).is(':checked')) {
resultDOM.find('.resultSelector:not([disabled])').prop('checked', true);
@@ -419,31 +358,26 @@
resultDOM.find('.resultSelector:not([disabled])').prop('checked', false);
}
});
-
this.resultTable.hide().empty().append(resultDOM).slideDown('slow');
-
this.resultMenu.find('.pageNumber').text(resultIndex + 1);
this.resultMenu.find('.pageLength').text(this.resultsPerPage * resultIndex + results.length);
-
if (this.resultsPerPage * (resultIndex + 1) >= this.resultCount) {
this.resultMenu.find('.next').addClass('disabled');
} else if (resultIndex === 0) {
this.resultMenu.find('.next').removeClass('disabled');
}
-
if (resultIndex === 0) {
this.resultMenu.find('.previous').addClass('disabled');
} else if (resultIndex === 1) {
this.resultMenu.find('.previous').removeClass('disabled');
}
-
$.scrollTo("#results", 500, {
interrupt: true
});
-
}
Atmos.prototype.getResults = function(index) {
+
var scope = this;
if ($('#results').hasClass('hidden')) {
@@ -463,17 +397,14 @@
}
var interestName = new Name(scope.name);
-
// Interest name should be /<catalog-prefix>/query/<query-param>/<version>/<#seq>
if (scope.name.size() === (scope.catalogPrefix.size() + 3)) {
interestName = interestName.appendSegment(scope.retrievedSegments++);
//console.log("Requesting data index: (", scope.retrievedSegments - 1, ") at ", interestName.toUri());
}
- this.expressInterest(interestName,
- function(interest, data) {
+ this.expressInterest(interestName, function(interest, data) {
//Response
-
if (data.getContent().length === 0) {
scope.resultMenu.find('.totalResults').text(0);
scope.resultMenu.find('.pageNumber').text(0);
@@ -495,45 +426,29 @@
}
scope.results = scope.results.concat(content.results);
-
scope.resultCount = content.resultCount;
-
scope.resultMenu.find('.totalResults').text(scope.resultCount);
-
scope.page = index;
-
// reset scope.name
scope.name = new Name(data.getName().getPrefix(scope.catalogPrefix.size() + 3));
-
scope.getResults(index);
//Keep calling this until we have enough data.
-
- }, function() {}//Ignore failure
- );
+ }, function() {});//Ignore failure
}
-
Atmos.prototype.query = function(prefix, parameters, callback, timeout) {
-
var queryPrefix = new Name(prefix);
queryPrefix.append("query");
-
var jsonString = JSON.stringify(parameters);
queryPrefix.append(jsonString);
-
this.expressInterest(queryPrefix, callback, timeout);
-
}
-
Atmos.prototype.expressInterest = function(name, success, failure) {
-
var interest = new Interest(name);
- interest.setInterestLifetimeMilliseconds(1500);
+ interest.setInterestLifetimeMilliseconds(500);
interest.setMustBeFresh(true);
-
const face = this.face;
-
async.retry(4, function(done) {
face.expressInterest(interest, function(interest, data) {
done();
@@ -547,7 +462,6 @@
failure(interest);
}
});
-
}
/**
@@ -572,12 +486,10 @@
* @param {string} type - Override the alert type.
*/
Atmos.prototype.createAlert = function(message, type) {
-
var alert = $('<div class="alert"><div>');
alert.addClass(type ? type : 'alert-info');
alert.text(message);
alert.append(closeButton);
-
this.alerts.append(alert);
}
@@ -588,22 +500,19 @@
* @param subsetFileName {String} If present then do a subsetting request instead.
*/
Atmos.prototype.request = function() {
-
//Pseudo globals.
var keyChain;
var certificateName;
var keyAdded = false;
-
return function(elements, subsetFilename) {
var names = [];
+
$(elements).find('.metaDataLink').each(function() {
var name = $(this).text();
names.push(name);
});
-
var subset = false;
-
if (!subsetFilename) {
$('#subsetting').hide();
} else {
@@ -617,8 +526,9 @@
//a single host with a small set of names. It is to demo the functionality but
//could use improvement. (Multiple servers, non static list, etc)
var directDls = $('#directDownloadList').empty();
- names.forEach(function(name){
- if (scope.conversions[name]){ //If the name exists in the conversions.
+ names.forEach(function(name) {
+ if (scope.conversions[name]) {
+ //If the name exists in the conversions.
var ele = $('<a href="http://atmos-mwsc.ucar.edu/ucar/' + conversions[name] + '" class="list-group-item>' + name + '</a>');
directDls.append(ele);
}
@@ -627,9 +537,7 @@
this.requestForm.on('submit', function(e) {
//This will be registered for the next submit from the form.
e.preventDefault();
-
$('#request .alert').remove();
-
var variables = [];
if (subset) {
$('#subsetVariables .row').each(function() {
@@ -655,12 +563,11 @@
}
$('#request').modal('hide');
- //Initial params are ok. We can close the form.
+ //Initial params are ok. We can close the form.
scope.cleanRequestForm();
- $(this).off(e);
- //Don't fire this again, the request must be regenerated
+ $(this).off(e); //Don't fire this again, the request must be regenerated
//Key setup
if (!keyAdded) {
@@ -669,39 +576,26 @@
console.error("Missing/invalid key! This must be configured in the config on the server.", scope.config.demoKey);
return;
}
-
//FIXME base64 may or may not exist in other browsers. Need a new polyfill.
var pub = new Buffer(base64.toByteArray(scope.config.retrieval.demoKey.pub));
//MUST be a Buffer (Buffer != Uint8Array)
var priv = new Buffer(base64.toByteArray(scope.config.retrieval.demoKey.priv));
-
var identityStorage = new MemoryIdentityStorage();
var privateKeyStorage = new MemoryPrivateKeyStorage();
- keyChain = new KeyChain(new IdentityManager(identityStorage,privateKeyStorage),
- new SelfVerifyPolicyManager(identityStorage));
-
+ keyChain = new KeyChain(new IdentityManager(identityStorage,privateKeyStorage),new SelfVerifyPolicyManager(identityStorage));
var keyName = new Name("/retrieve/DSK-123");
- certificateName = keyName.getSubName(0, keyName.size() - 1)
- .append("KEY").append(keyName.get(-1))
- .append("ID-CERT").append("0");
-
+ certificateName = keyName.getSubName(0, keyName.size() - 1).append("KEY").append(keyName.get(-1)).append("ID-CERT").append("0");
identityStorage.addKey(keyName, KeyType.RSA, new Blob(pub,false));
privateKeyStorage.setKeyPairForKeyName(keyName, KeyType.RSA, pub, priv);
-
scope.face.setCommandSigningInfo(keyChain, certificateName);
-
keyAdded = true;
-
}
//Retrieval
var retrievePrefix = new Name("/catalog/ui/" + guid());
-
- scope.face.registerPrefix(retrievePrefix,
- function(prefix, interest, face, interestFilterId, filter) {
+ scope.face.registerPrefix(retrievePrefix, function(prefix, interest, face, interestFilterId, filter) {
//On Interest
//This function will exist until the page exits but will likely only be used once.
-
var data = new Data(interest.getName());
var content;
if (subset) {
@@ -712,8 +606,10 @@
} else {
content = JSON.stringify(names);
}
+
//Blob breaks the data! Don't use it
data.setContent(content);
+
//TODO Packetize this.
keyChain.sign(data, certificateName);
@@ -725,7 +621,6 @@
console.error("Failed to respond to", interest.getName().toUri(), data);
scope.createAlert("Data retrieval failed.");
}
-
}, function(prefix) {
//On fail
scope.createAlert("Failed to register the retrieval URI! See console for details.", "alert-danger");
@@ -734,30 +629,21 @@
//On success
var name = new Name(dest.text());
name.append(prefix);
-
- scope.expressInterest(name,
- function(interest, data) {
+ scope.expressInterest(name, function(interest, data) {
//Success
console.log("Request for", name.toUri(), "succeeded.", interest, data);
- },
- function() {
+ }, function() {
console.warn("Failed to request from retrieve agent.");
- }
- );
- }
- );
-
+ });
+ });
});
$('#request').modal();
//This forces the form to be the only option.
-
}
-
}();
Atmos.prototype.filterSetup = function() {
//Filter setup
-
var prefix = new Name(this.catalog).append("filters-initialization");
var scope = this;
@@ -766,19 +652,19 @@
//Success
var raw = JSON.parse(data.replace(/[\n\0]/g, ''));
//Remove null byte and parse
-
console.log("Filter categories:", raw);
$.each(raw, function(index, object) {
//Unpack list of objects
+
$.each(object, function(category, searchOptions) {
//Unpack category from object (We don't know what it is called)
//Create the category
var e = $('<li><a href="#">' + category.replace(/_/g, " ") + '</a><ul class="subnav nav nav-pills nav-stacked"></ul></li>');
-
var sub = e.find('ul.subnav');
$.each(searchOptions, function(index, name) {
//Create the filter list inside the category
+
var item = $('<li><a href="#">' + name + '</a></li>');
sub.append(item);
item.click(function() {
@@ -792,19 +678,15 @@
item.addClass('active');
var filter = $('<span class="label label-default"></span>');
filter.text(category + ':' + name);
-
scope.filters.append(filter);
-
filter.click(function() {
//Click on a filter
filter.remove();
item.removeClass('active');
});
}
-
});
});
-
//Toggle the menus. (Only respond when the immediate tab is clicked.)
e.find('> a').click(function() {
scope.categories.find('.subnav').slideUp();
@@ -817,19 +699,15 @@
//Make it visible and look at it.
}
});
-
scope.categories.append(e);
-
});
});
-
}, function(interest) {
//Timeout
scope.createAlert("Failed to initialize the filters!", "alert-danger");
console.error("Failed to initialize filters!", interest);
ga('send', 'event', 'error', 'filters');
});
-
}
/**
@@ -842,41 +720,30 @@
* @param stop {boolean} stop if no finalBlock.
*/
Atmos.prototype.getAll = function(prefix, callback, failure, stop) {
-
var scope = this;
var d = [];
-
var name = new Name(prefix);
var segment = 0;
-
var request = function() {
-
var n2 = new Name(name);
n2.appendSegment(segment);
-
- scope.expressInterest(n2, handleData, function(err, interest){failure(interest)});
+ scope.expressInterest(n2, handleData, function(err, interest) {
+ failure(interest)
+ });
//Forward to handleData and ignore error
}
-
var handleData = function(interest, data) {
-
d.push(data.getContent().toString());
-
var hasFinalBlock = data.getMetaInfo().getFinalBlockId().value.length === 0;
var finalBlockStop = hasFinalBlock && stop;
-
- if (finalBlockStop ||
- (!hasFinalBlock && interest.getName().get(-1).toSegment() == data.getMetaInfo().getFinalBlockId().toSegment())) {
+ if (finalBlockStop || (!hasFinalBlock && interest.getName().get(-1).toSegment() == data.getMetaInfo().getFinalBlockId().toSegment())) {
callback(d.join(""));
} else {
segment++;
request();
}
-
}
-
request();
-
}
Atmos.prototype.cleanRequestForm = function() {
@@ -889,32 +756,26 @@
}
Atmos.prototype.setupRequestForm = function() {
-
var scope = this;
-
this.requestForm.find('#requestCancel').click(function() {
$('#request').unbind('submit')//Removes all event handlers.
.modal('hide');
//Hides the form.
scope.cleanRequestForm();
});
-
var dests = $(this.config['retrieval']['destinations'].reduce(function(prev, current) {
prev.push('<li><a href="#">');
prev.push(current);
prev.push("</a></li>");
return prev;
}, []).join(""));
-
- this.requestForm.find('#requestDest').append(dests)
- .on('click', 'a', function(e) {
+ this.requestForm.find('#requestDest').append(dests).on('click', 'a', function(e) {
$('#requestDest .active').removeClass('active');
var t = $(this);
t.parent().addClass('active');
$('#requestDropText').text(t.text());
$('#requestDest').prev().removeClass('btn-default').addClass('btn-success');
});
-
var addVariable = function(selector) {
var ele = $(selector).clone().attr('id', '');
ele.find('.close').click(function() {
@@ -922,7 +783,6 @@
});
$('#subsetVariables').append(ele);
}
-
$('#subsetAddVariableBtn').click(function() {
addVariable('#customTemplate');
});
@@ -932,29 +792,21 @@
$('#subsetAddLocVariable').click(function() {
addVariable('#locationTemplate');
});
-
}
Atmos.prototype.getMetaData = (function() {
-
var cache = {};
-
return function(element) {
var name = $(element).text();
-
ga('send', 'event', 'request', 'metaData');
-
var subsetButton = '<button class="btn btn-default subsetButton" type="button">Subset</button>';
-
if (cache[name]) {
return [subsetButton, '<pre class="metaData">', cache[name], '</pre>'].join('');
}
-
var prefix = new Name(name).append("metadata");
var id = guid();
//We need an id because the return MUST be a string.
var ret = '<div id="' + id + '"><span class="fa fa-spinner fa-spin"></span></div>';
-
this.getAll(prefix, function(data) {
var el = $('<pre class="metaData"></pre>');
el.text(data);
@@ -967,9 +819,7 @@
$('#' + id).text("The metadata is unavailable for this name.");
console.log("Data is unavailable for " + name);
});
-
return ret;
-
}
})();
diff --git a/client/catalog-dev/js/treeExplorer.js b/client/catalog/js/treeExplorer.js
similarity index 100%
rename from client/catalog-dev/js/treeExplorer.js
rename to client/catalog/js/treeExplorer.js
diff --git a/client/catalog-dev/variables.less b/client/catalog/variables.less
similarity index 100%
rename from client/catalog-dev/variables.less
rename to client/catalog/variables.less
diff --git a/client/gulpfile.js b/client/gulpfile.js
deleted file mode 100644
index 585a791..0000000
--- a/client/gulpfile.js
+++ /dev/null
@@ -1,69 +0,0 @@
-//Includes
-var gulp = require('gulp');
-var minifyHTML = require('gulp-minify-html');
-var minifyCSS = require('gulp-minify-css');
-var sourcemaps = require('gulp-sourcemaps');
-var closure = require('gulp-closure-compiler-service');
-var clean = require('gulp-clean');
-
-//Globs
-var cssGlob = ['./catalog-dev/css/style.css', './catalog-dev/css/cubeLoader.css'];
-var jsGlob = './catalog-dev/js/*.js';
-var htmlGlob = './catalog-dev/index.html';
-
-gulp.task('minify-html', function() {
-
- return gulp.src(htmlGlob)
- .pipe(minifyHTML())
- .pipe(gulp.dest('./catalog/'));
-
-});
-
-gulp.task('minify-js', function() {
-
- return gulp.src(jsGlob, {base: 'catalog-dev'})
- .pipe(sourcemaps.init())
- .pipe(closure())
- .pipe(sourcemaps.write({sourceRoot: '/catalog-dev', includeContent: false}))
- .pipe(gulp.dest('./catalog'));
-
-});
-
-gulp.task('minify-css', function() {
-
- return gulp.src(cssGlob, {base: 'catalog-dev'})
- .pipe(sourcemaps.init())
- .pipe(minifyCSS())
- .pipe(sourcemaps.write({sourceRoot: '/catalog-dev', includeContent: false}))
- .pipe(gulp.dest('./catalog'));
-
-});
-
-gulp.task('copy', function() {
-
- gulp.src('./catalog-dev/config.json')
- .pipe(gulp.dest('./catalog'));
-
- gulp.src('./catalog-dev/css/*.min.css')
- .pipe(gulp.dest('./catalog/css'));
-
-});
-
-gulp.task('clean', function(){
-
- return gulp.src('./catalog', {read: false})
- .pipe(clean());
-
-});
-
-gulp.task('watch', ['default'], function(){
-
- gulp.watch(cssGlob, ['minify-css']);
- gulp.watch(jsGlob, ['minify-js']);
- gulp.watch(htmlGlob, ['minify-html']);
- gulp.watch(['./catalog-dev/config.json', './catalog-dev/css/*.min.css'], ['copy']);
-
-});
-
-gulp.task('default', ['minify-html', 'minify-css', 'minify-js', 'copy']);
-
diff --git a/client/package.json b/client/package.json
deleted file mode 100644
index dd76077..0000000
--- a/client/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "ndn-atmos",
- "description": "A frontend for the ndn-atmos project",
- "version": "2.1.0",
- "license": "MIT",
- "author": {
- "name": "Tyler Scott",
- "email": "tyduptyler13@gmail.com",
- "url": "myuplay.com"
- },
- "contributors": [],
- "scripts": {
- "build": "gulp",
- "host": "http-server -c-1 -p 5555 -a ::1; x-www-browser http://localhost:5555/catalog"
- },
- "devDependencies": {
- "gulp": "^3.9.0",
- "gulp-clean": "^0.3.1",
- "gulp-closure-compiler-service": "^0.5.0",
- "gulp-minify-css": "^1.2.1",
- "gulp-minify-html": "^1.0.4",
- "gulp-sourcemaps": "^1.5.2",
- "http-server": "^0.8.0"
- }
-}