Skip to content
Permalink
Browse files

add forgotten .js

  • Loading branch information...
smurp committed Jun 3, 2019
1 parent bca3646 commit 3dfe84ff6c178006a5223b4eac855b3b2c4e6e06
Showing with 57 additions and 29 deletions.
  1. +57 −29 lib/huviz.js
@@ -2834,6 +2834,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
preJQElem = qryJQElem.find('pre');
preElem = preJQElem[0];
preJQElem.text(qry);
queriesJQElem.scrollTop(10000);
queryManager = new QueryManager(qry);
return Object.assign(queryManager, {
qryJQElem: qryJQElem,
@@ -9539,15 +9540,15 @@ OnceRunner.prototype.makeWrapper = function(callback) {
'Accept': 'application/sparql-results+json'
};
}
$.ajax({
queryManager.xhr = $.ajax({
timeout: timeout,
method: ajax_settings.method,
url: ajax_settings.url,
headers: ajax_settings.headers,
success: (function(_this) {
return function(data, textStatus, jqXHR) {
var e;
queryManager.anim.cancel();
queryManager.cancelAnimation();
if (success_handler != null) {
try {
return success_handler(data, textStatus, jqXHR, queryManager);
@@ -9562,16 +9563,16 @@ OnceRunner.prototype.makeWrapper = function(callback) {
error: (function(_this) {
return function(jqxhr, textStatus, errorThrown) {
var msg;
queryManager.anim.cancel();
queryManager.cancelAnimation();
queryManager.setErrorColor();
if (!errorThrown) {
errorThrown = "Cross-Origin error";
}
msg = errorThrown + " while fetching " + url;
$('#' + _this.get_data_ontology_display_id()).remove();
queryManager.displayError(msg);
if (_this.error_callback != null) {
return error_callback();
if (error_callback != null) {
return error_callback(jqxhr, textStatus, errorThrown);
}
};
})(this)
@@ -9586,13 +9587,19 @@ OnceRunner.prototype.makeWrapper = function(callback) {
};

Huviz.prototype.sparql_graph_query_and_show = function(url, id, callback) {
var args, graphSelector, make_error_callback, make_success_handler, qry, spinner;
var args, graphSelector, handle_graphsNotFound, make_error_callback, make_success_handler, qry, spinner;
qry = "# sparql_graph_query_and_show()\nSELECT ?g\nWHERE {\n GRAPH ?g { }\n}";
spinner = $("#sparqlGraphSpinner-" + id);
spinner.css('display', 'block');
graphSelector = "#sparqlGraphOptions-" + id;
$(graphSelector).parent().css('display', 'none');
this.sparqlQryInput_hide();
handle_graphsNotFound = (function(_this) {
return function() {
$(graphSelector).parent().css('display', 'none');
return _this.reset_endpoint_form(true);
};
})(this);
make_success_handler = (function(_this) {
return function() {
return function(data, textStatus, jqXHR, queryManager) {
@@ -9607,8 +9614,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
queryManager.setResultCount(results.length);
graphsNotFound = jQuery.isEmptyObject(results[0]);
if (graphsNotFound) {
$(graphSelector).parent().css('display', 'none');
_this.reset_endpoint_form(true);
handle_graphsNotFound();
return;
}
graph_options = "<option id='" + (_this.unique_id()) + "' value='" + url + "'> All Graphs </option>";
@@ -9624,18 +9630,19 @@ OnceRunner.prototype.makeWrapper = function(callback) {
})(this);
make_error_callback = (function(_this) {
return function() {
return function() {
return function(jqXHR, textStatus, errorThrown) {
$(graphSelector).parent().css('display', 'none');
spinner.css('visibility', 'hidden');
return _this.reset_dataset_ontology_loader();
handle_graphsNotFound();
return _this.reset_endpoint_form(true);
};
};
})(this);
args = {
success_handler: make_success_handler(),
error_callback: make_error_callback()
};
return this.run_managed_query_ajax(qry, url, args);
return this.sparql_graph_query_and_show_queryManager = this.run_managed_query_ajax(qry, url, args);
};

Huviz.prototype.sparqlQryInput_hide = function() {
@@ -9874,7 +9881,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
return;
} else if (e.data.method_name !== 'accept_results') {
error = new Error("expecting either data.method = 'log_query' or 'accept_results'");
queryManager.anim.cancel();
queryManager.cancelAnimation();
queryManager.displayError(error);
throw error;
}
@@ -9887,7 +9894,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
local_node_added++;
}
queryManager.setResultCount(local_node_added);
queryManager.anim.cancel();
queryManager.cancelAnimation();
if (local_node_added) {
queryManager.setSuccessColor();
} else {
@@ -11049,14 +11056,14 @@ OnceRunner.prototype.makeWrapper = function(callback) {
};

Huviz.prototype.hilight_dialog = function(dialog_elem) {
var dialog_id, parent;
var dialog_id;
if (typeof dialog_elem === 'string') {
throw new Error('hilight_dialog() expects an Elem, not ' + dialog_elem);
} else {
dialog_id = dialog_elem.getAttribute('id');
}
parent = $("#" + dialog_id).parent().attr('id');
return $("#" + parent).append($("#" + dialog_id).effect('shake'));
$(dialog_elem).parent().append(dialog_elem);
$(dialog_elem).effect('shake');
};

Huviz.prototype.print_edge = function(edge) {
@@ -11977,7 +11984,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
position: {
collision: "flip"
},
source: this.populate_graphs_selector
source: this.search_sparql_by_label
});
};

@@ -11989,7 +11996,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {

Huviz.prototype.animate_endpoint_label_search = function(overMsec, fc, bc) {
var elem;
this.endpoint_labels_JQElem.siblings('i').css('visibility', 'visible');
this.start_graphs_selector_spinner();
if (overMsec == null) {
overMsec = this.get_sparql_timeout_msec();
}
@@ -12014,7 +12021,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {

Huviz.prototype.kill_endpoint_label_search_anim = function() {
this.endpoint_label_search_anim.cancel();
this.endpoint_labels_JQElem.siblings('i').css('visibility', 'hidden');
this.stop_graphs_selector_spinner();
};

Huviz.prototype.animate_sparql_query = function(elem, overMsec, fillColor, bgColor) {
@@ -12078,17 +12085,38 @@ OnceRunner.prototype.makeWrapper = function(callback) {
return 1000 * (this.sparql_timeout || 5);
};

Huviz.prototype.populate_graphs_selector = function(request, response) {
var args, fromGraph, make_error_callback, make_success_handler, qry, spinner, url;
this.animate_endpoint_label_search();
Huviz.prototype.start_graphs_selector_spinner = function() {
var spinner;
spinner = this.endpoint_labels_JQElem.siblings('i');
spinner.css('visibility', 'visible');
};

Huviz.prototype.stop_graphs_selector_spinner = function() {
var spinner;
spinner = this.endpoint_labels_JQElem.siblings('i');
spinner.css('visibility', 'hidden');
};

Huviz.prototype.euthanize_search_sparql_by_label = function() {
if (this.search_sparql_by_label_queryManager != null) {
this.kill_endpoint_label_search_anim();
this.search_sparql_by_label_queryManager.kill();
return true;
}
return false;
};

Huviz.prototype.search_sparql_by_label = function(request, response) {
var args, fromGraph, make_error_callback, make_success_handler, qry, url;
this.euthanize_search_sparql_by_label();
this.animate_endpoint_label_search();
this.start_graphs_selector_spinner();
url = this.endpoint_loader.value;
fromGraph = '';
if (this.endpoint_loader.endpoint_graph) {
fromGraph = " FROM <" + this.endpoint_loader.endpoint_graph + "> ";
}
qry = "# populate_graphs_selector()\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT * " + fromGraph + "\nWHERE {\n ?sub rdfs:label|foaf:name ?obj .\n filter regex(?obj,\"^" + request.term + "\", \"i\")\n}\nLIMIT 20";
qry = "# search_sparql_by_label()\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT DISTINCT * " + fromGraph + "\nWHERE {\n ?sub rdfs:label|foaf:name ?obj .\n FILTER (STRSTARTS(LCASE(?obj), \"" + (request.term.toLowerCase()) + "\"))\n}\nLIMIT 20";
make_success_handler = (function(_this) {
return function() {
return function(data, textStatus, jqXHR, queryManager) {
@@ -12116,7 +12144,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
} else {
_this.endpoint_label_search_none();
}
spinner.css('visibility', 'hidden');
_this.stop_graphs_selector_spinner();
for (_i = 0, _len = results.length; _i < _len; _i++) {
label = results[_i];
this_result = {
@@ -12141,7 +12169,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
msg = "<code>" + errorThrown + "</code> with\n<pre>" + jqxhr.responseText + "</pre>\n<a href=\"" + url + "\">" + url + "</a>";
_this.hide_state_msg();
$('#' + _this.get_data_ontology_display_id()).remove();
_this.endpoint_labels_JQElem.siblings('i').css('visibility', 'hidden');
_this.stop_graphs_selector_spinner();
return _this.blurt(msg, 'error');
};
};
@@ -12150,7 +12178,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
success_handler: make_success_handler(),
error_callback: make_error_callback()
};
return this.run_managed_query_ajax(qry, url, args);
return this.search_sparql_by_label_queryManager = this.run_managed_query_ajax(qry, url, args);
};

Huviz.prototype.init_editc_or_not = function() {
@@ -12572,7 +12600,7 @@ OnceRunner.prototype.makeWrapper = function(callback) {
this.fullscreen = __bind(this.fullscreen, this);
this.close_blurt_box = __bind(this.close_blurt_box, this);
this.blurt = __bind(this.blurt, this);
this.populate_graphs_selector = __bind(this.populate_graphs_selector, this);
this.search_sparql_by_label = __bind(this.search_sparql_by_label, this);
this.animate_endpoint_label_search = __bind(this.animate_endpoint_label_search, this);
this.animate_endpoint_label_typing = __bind(this.animate_endpoint_label_typing, this);
this.build_sparql_form = __bind(this.build_sparql_form, this);
@@ -13574,9 +13602,9 @@ OnceRunner.prototype.makeWrapper = function(callback) {
title: "Number of seconds to run SPARQL queries before giving up."
},
input: {
value: 10,
value: 40,
min: 1,
max: 30,
max: 60,
step: 1,
type: "range"
}

0 comments on commit 3dfe84f

Please sign in to comment.
You can’t perform that action at this time.