Working. Buttons almost work.
Change-Id: I03bc85a00de0a00504f5a0683e3c7736a286af75
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