Cleaned up the web directory.
Change-Id: I19f0b14a7f0ffcd17a2f1450c3b317208f458db3
diff --git a/client/catalog/style.css b/client/catalog/css/style.css
similarity index 97%
rename from client/catalog/style.css
rename to client/catalog/css/style.css
index aa2d1b6..c2d243b 100644
--- a/client/catalog/style.css
+++ b/client/catalog/css/style.css
@@ -2,6 +2,7 @@
width: 100%;
height: 100%;
margin: 0;
+ min-width: 650px;
}
.sidebar {
@@ -89,7 +90,7 @@
}
#search {
- width: 500px;
+ min-width: 500px;
}
.autoComplete {
diff --git a/client/catalog/theme.min.css b/client/catalog/css/theme.min.css
similarity index 100%
rename from client/catalog/theme.min.css
rename to client/catalog/css/theme.min.css
diff --git a/client/catalog/index.html b/client/catalog/index.html
index 2f3b8c9..be5e884 100644
--- a/client/catalog/index.html
+++ b/client/catalog/index.html
@@ -16,15 +16,16 @@
</script>
<!-- Styles -->
-<link rel="stylesheet" href="theme.min.css">
-<link rel="stylesheet" href="style.css">
+<link rel="stylesheet" href="css/theme.min.css">
+<!--<link rel="stylesheet" href="css/checkbox.css">-->
+<link rel="stylesheet" href="css/style.css">
<!-- Scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="../ndn-js/build/ndn.min.js"></script>
-<script src="autocomplete.js"></script>
-<script src="catalog.js"></script>
+<script src="js/autocomplete.js"></script>
+<script src="js/catalog.js"></script>
</head>
diff --git a/client/catalog/autocomplete.js b/client/catalog/js/autocomplete.js
similarity index 100%
rename from client/catalog/autocomplete.js
rename to client/catalog/js/autocomplete.js
diff --git a/client/catalog/catalog.js b/client/catalog/js/catalog.js
similarity index 89%
rename from client/catalog/catalog.js
rename to client/catalog/js/catalog.js
index 691f8ed..d5234f3 100644
--- a/client/catalog/catalog.js
+++ b/client/catalog/js/catalog.js
@@ -1,13 +1,34 @@
-var catalog = "/catalog/myUniqueName";
-var config = {
- host: "atmos-csu.research-lan.colostate.edu",
- port: 9696
-};
-
-//Run when the document loads.
-$(function () {
- new Atmos(catalog, config);
-});
+//Run when the document loads AND we have the config loaded.
+(function(){
+ var catalog = null;
+ var config = null;
+ Promise.all([
+ new Promise(function(resolve, reject){
+ $.ajax('config.json').done(function(data){
+ catalog = data.catalogPrefix;
+ config = data.faceConfig;
+ resolve();
+ }).fail(function(){
+ console.error("Failed to get config.");
+ reject()
+ });
+ }),
+ new Promise(function(resolve, reject){
+ var timeout = setTimeout(function(){
+ console.error("Document never loaded? Something bad has happened!");
+ reject();
+ }, 10000);
+ $(function () {
+ clearTimeout(timeout);
+ resolve();
+ });
+ })
+ ]).then(function(){
+ new Atmos(catalog, config);
+ }, function(){
+ console.error("Failed to initialize!");
+ })
+})();
var Atmos = (function(){
"use strict";
@@ -34,6 +55,7 @@
this.catalog = catalog;
this.face = new Face(config);
+
this.categories = $('#side-menu');
this.resultTable = $('#resultTable');
this.filters = $('#filters');
@@ -58,7 +80,7 @@
button.text("Requested!")
.removeClass('btn-primary')
- .addClass('btn-default')
+ .addClass('btn-success')
.addClass('disabled')
.prop('disabled', true);
});
@@ -217,8 +239,12 @@
Atmos.prototype.showResults = function(resultIndex) {
- var results = $('<tr><td>' + this.results[resultIndex].join('</td><td><button class="interest-button btn btn-primary btn-sm">Retrieve</button></td></tr><tr><td>') +
- '</td><td><button class="interest-button btn btn-primary btn-sm">Retrieve</button></td></tr>'); //Fastest way to generate the table.
+ var results = $(this.results[resultIndex].reduce(function(prev, current){
+ prev.push('<tr><td><input type="checkbox"></td><td>');
+ prev.push(current);
+ prev.push('</td><td><button class="interest-button btn btn-primary btn-sm">Retrieve</button></td></tr>');
+ return prev;
+ }, []).join(''));
this.resultTable.empty().append(results);