Working. Buttons almost work.
Change-Id: I03bc85a00de0a00504f5a0683e3c7736a286af75
diff --git a/client/ndn-js b/client/ndn-js
new file mode 160000
index 0000000..a54c9eb
--- /dev/null
+++ b/client/ndn-js
@@ -0,0 +1 @@
+Subproject commit a54c9eb542cc3596656910c25daab52b5a12e9dd
diff --git a/client/query/ndn-js b/client/query/ndn-js
deleted file mode 160000
index 03d3f74..0000000
--- a/client/query/ndn-js
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 03d3f743a741d8808b5c60fad89ad5f3bb21cb57
diff --git a/client/query/query.html b/client/query/query.html
index de4da56..3af6fc3 100644
--- a/client/query/query.html
+++ b/client/query/query.html
@@ -12,7 +12,7 @@
<!-- Scripts -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
-<script src="ndn-js/build/ndn-js.js"></script>
+<script src="../ndn-js/build/ndn.min.js"></script>
<script src="query.js"></script>
</head>
diff --git a/client/query/query.js b/client/query/query.js
index 6412d18..852371f 100644
--- a/client/query/query.js
+++ b/client/query/query.js
@@ -1,13 +1,13 @@
-// {@ @todo: this need to be configured before the document load
+//{@ @todo: this need to be configured before the document load
var catalog = "/catalog/myUniqueName";
-var face = new FaceInstance({
- host: "localhost",
+var face = new Face({
+ host: "atmos-csu.research-lan.colostate.edu",
port: 9696
});
// @}
-var searchMenuOptions = {};
+var searchMenuOptions = {}
var results = [];
var resultCount = 0;
var page = 1;
@@ -19,7 +19,7 @@
var searchMenu = $("#side-menu");
var currentPage = $(".page");
var resultTable = $(".resultTable");
- var data = $.getJSON("search_catagories.json", function (data) { //url, success
+ var data = $.getJSON("search_catagories.json").done(function (data) {
$.each(data, function (pageSection, contents) {
if (pageSection == "SearchCatagories") {
$.each(contents, function (search, searchOptions) {
@@ -60,15 +60,15 @@
function query(prefix, parameters, callback, pipeline) {
results = [];
dropdown = [];
-
var resultTable = $(".resultTable");
resultTable.empty();
- resultTable.append('<tr><td>Results</td></tr>');
+ resultTable.append('<tr><th>Results</th></tr>');
var queryPrefix = new Name(prefix);
- queryPrefix.add("query");
+ queryPrefix.append("query");
- queryPrefix.add(JSON.stringify(parameters));
+ var jsonString = JSON.stringify(parameters);
+ queryPrefix.append(jsonString);
state = {
prefix: new Name(prefix),
@@ -122,12 +122,11 @@
function onQueryResultsData(interest, data) {
var name = data.getName();
delete state["outstanding"][interest.getName().toUri()];
-
- if (!name.get(-1).equals(new Name.Component("END"))) {
+ if (!name.get(-1).equals(data.getMetaInfo().getFinalBlockId())) {
expressNextInterest();
- } else {
- alert("found final block");
- }
+ } //else {
+ //alert("found final block");
+ //}
state["userOnData"](data);
}
@@ -179,11 +178,11 @@
function populateResults(startIndex) {
var resultTable = $(".resultTable");
resultTable.empty();
- resultTable.append('<tr><td>Results</td></tr>');
+ resultTable.append('<tr><th colspan="2">Results</th></tr>');
for (var i = startIndex; i < startIndex + 20 && i < results.length; ++i) {
- resultTable.append('<tr><td>' + results[i] + '</td></tr>');
+ resultTable.append('<tr><td>' + results[i] + '</td><td><button class="interest-button">Express Interest</button></td></tr>');
}
if (results.length <= 20) {
@@ -207,7 +206,7 @@
|| (i <= page && i + 5 >= page) // in our current page range
|| (i >= page && i - 5 <= page)) { // in our current page range
if (i != page) {
- currentPage.append(' <a href="#" onclick="getPage(' + i + ');">' + i + '</a>');
+ currentPage.append(' <a href="#" onclick="getPage(' + i + ');">' + i + '</a>')
if (i == 1 && page > i + 5) {
currentPage.append(' ... ');
}
@@ -218,7 +217,7 @@
if (i == page + 6) {
currentPage.append(' ... ');
- currentPage.append(' <a href="#" onclick="getPage(this.id);" id=">">></a>');
+ currentPage.append(' <a href="#" onclick="getPage(this.id);" id=">">></a>')
i = totalPages - 1;
}
}
@@ -240,7 +239,7 @@
if (search === str) {
searchMenu.find("#" + search).append('<ul id="options_' + search + '" class="sub-menu">');
for (var i = 0; i < fields.length; ++i) {
- searchMenu.find("#options_" + search).append('<li id="' + fields[i] + '"onclick="submitCatalogSearch(this.id)"><a href="#">' + fields[i] + '</a></li>');
+ searchMenu.find("#options_" + search).append('<li id="' + fields[i] + '" onclick="submitCatalogSearch(this.id)"><a href="#">' + fields[i] + '</a></li>');
}
searchMenu.append('</ul>');
} else {
@@ -389,4 +388,4 @@
populateCurrentSelections();
return false;
-}
+}
\ No newline at end of file
diff --git a/client/query/query2.css b/client/query/query2.css
index 3818f8b..23dbe1d 100644
--- a/client/query/query2.css
+++ b/client/query/query2.css
@@ -13,3 +13,7 @@
max-height: 100%;
overflow: auto;
}
+
+.resultTable tr:nth-child(even) {
+ background-color: lightgray;
+}