|
From: <tob...@us...> - 2014-05-03 21:35:46
|
Revision: 8174
http://sourceforge.net/p/bigdata/code/8174
Author: tobycraig
Date: 2014-05-03 21:35:44 +0000 (Sat, 03 May 2014)
Log Message:
-----------
Improved error reporting on bad query
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-03 19:20:22 UTC (rev 8173)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-03 21:35:44 UTC (rev 8174)
@@ -715,8 +715,8 @@
function queryResultsError(jqXHR, textStatus, errorThrown) {
$('#query-response, #query-export-container').show();
- $('#query-response').text('Error! ' + textStatus + ' ' + jqXHR.statusText);
- highlightError(jqXHR.statusText, 'query');
+ $('#query-response').text('Error! ' + textStatus + ' ' + jqXHR.responseText);
+ highlightError(jqXHR.responseText, 'query');
}
function highlightError(description, pane) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-05-05 17:00:14
|
Revision: 8199
http://sourceforge.net/p/bigdata/code/8199
Author: tobycraig
Date: 2014-05-05 17:00:10 +0000 (Mon, 05 May 2014)
Log Message:
-----------
#906 - Fixed namespace shortcut buttons for namespaces that don't end with #
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-05 16:24:41 UTC (rev 8198)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-05 17:00:10 UTC (rev 8199)
@@ -206,7 +206,10 @@
$('.namespace-shortcuts').html('<ul>');
for(var ns in NAMESPACE_SHORTCUTS) {
- $('.namespace-shortcuts ul').append('<li data-ns="prefix ' + ns + ': <' + NAMESPACE_SHORTCUTS[ns] + '>">' + ns.toUpperCase() + '</li>');
+ // cannot use data-ns attribute on li, as jQuery mangles namespaces that don't end with #, adding </li> to them
+ var li = $('<li>' + ns.toUpperCase() + '</li>');
+ li.data('ns', 'prefix ' + ns + ': <' + NAMESPACE_SHORTCUTS[ns] + '>');
+ li.appendTo('.namespace-shortcuts ul');
}
$('.namespace-shortcuts li').click(function() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-05-05 17:17:13
|
Revision: 8200
http://sourceforge.net/p/bigdata/code/8200
Author: tobycraig
Date: 2014-05-05 17:17:10 +0000 (Mon, 05 May 2014)
Log Message:
-----------
#891 - Added GAS namespace to shortcuts
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-05 17:00:10 UTC (rev 8199)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-05 17:17:10 UTC (rev 8200)
@@ -198,6 +198,7 @@
'owl': 'http://www.w3.org/2002/07/owl#',
'bd': 'http://www.bigdata.com/rdf#',
'bds': 'http://www.bigdata.com/rdf/search#',
+ 'gas': 'http://www.bigdata.com/rdf/gas#',
'foaf': 'http://xmlns.com/foaf/0.1/',
'hint': 'http://www.bigdata.com/queryHints#',
'dc': 'http://purl.org/dc/elements/1.1/',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-05-06 18:56:09
|
Revision: 8209
http://sourceforge.net/p/bigdata/code/8209
Author: tobycraig
Date: 2014-05-06 18:56:06 +0000 (Tue, 06 May 2014)
Log Message:
-----------
Improved detection of inserted content in update panel
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-06 17:57:47 UTC (rev 8208)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-06 18:56:06 UTC (rev 8209)
@@ -310,7 +310,7 @@
// when file:// is present, Windows paths must use / and may include a :
// http[s]:// is mandatory for HTTP paths
var unix = /^(file:\/\/)?((\/[^\/]+)+)$/;
- var windows = /^((file:\/\/)([A-Za-z]:?([\/][^\/\\]+)+))|([A-Za-z]:([\\\/][^\\\/]+)+)$/;
+ var windows = /^(((file:\/\/)([A-Za-z]:?([\/][^\/\\]+)+))|([A-Za-z]:([\\\/][^\\\/]+)+))$/;
var http = /^https?:\/((\/[^\/]+)+)$/;
if(unix.test(text.trim()) || windows.test(text.trim()) || http.test(text.trim())) {
return 'path';
@@ -374,7 +374,7 @@
'trix': 'application/trix',
'turtle': 'application/x-turtle'};
-var sparql_update_commands = ['INSERT', 'DELETE'];
+var sparql_update_commands = ['INSERT', 'DELETE', 'LOAD', 'CLEAR'];
$('#update-file').change(handleFile);
$('#update-box').on('dragover', handleDragOver)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-05-12 11:25:18
|
Revision: 8282
http://sourceforge.net/p/bigdata/code/8282
Author: tobycraig
Date: 2014-05-12 11:25:13 +0000 (Mon, 12 May 2014)
Log Message:
-----------
Fixed ctrl-return for CodeMirror form submission and ctrl-right looping round from last tab
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-12 03:58:10 UTC (rev 8281)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-12 11:25:13 UTC (rev 8282)
@@ -56,11 +56,19 @@
}
}
+function moveTabLeft() {
+ moveTab(false);
+}
+
+function moveTabRight() {
+ moveTab(true);
+}
+
function moveTab(next) {
// get current position
var current = $('#tab-selector .active');
if(next) {
- if(current.next().length) {
+ if(current.next('a').length) {
current.next().click();
} else {
$('#tab-selector a:first').click();
@@ -75,8 +83,8 @@
}
// these should be , and . but Hotkeys views those keypresses as these characters
-$('html, textarea, select').bind('keydown', 'ctrl+¼', function() { moveTab(false); });
-$('html, textarea, select').bind('keydown', 'ctrl+¾', function() { moveTab(true); });
+$('html, textarea, select').bind('keydown', 'ctrl+¼', moveTabLeft);
+$('html, textarea, select').bind('keydown', 'ctrl+¾', moveTabRight);
/* Namespaces */
@@ -407,20 +415,23 @@
$('#update-box').on('dragover', handleDragOver)
.on('drop', handleFile)
.on('paste', handlePaste)
- .on('input propertychange', function() { $('#update-errors').hide(); })
- .bind('keydown', 'ctrl+return', submitUpdate);
+ .on('input propertychange', function() { $('#update-errors').hide(); });
$('#clear-file').click(clearFile);
$('#update-update').click(submitUpdate);
-UPDATE_EDITOR = CodeMirror.fromTextArea($('#update-box')[0], {lineNumbers: true, mode: 'sparql'});
+UPDATE_EDITOR = CodeMirror.fromTextArea($('#update-box')[0], {lineNumbers: true, mode: 'sparql',
+ extraKeys: {'Ctrl-Enter': submitUpdate, 'Ctrl-,': moveTabLeft, 'Ctrl-.': moveTabRight}
+});
function submitUpdate(e) {
// Updates are submitted as a regular form for SPARQL updates in monitor mode, and via AJAX for non-monitor SPARQL, RDF & file path updates.
// When submitted as a regular form, the output is sent to an iframe. This is to allow monitor mode to work.
// jQuery only gives us data when the request is complete, so we wouldn't see monitor results as they come in.
- e.preventDefault();
+ try {
+ e.preventDefault();
+ } catch(e) {}
$('#update-response').show();
@@ -512,8 +523,7 @@
/* Query */
-$('#query-box').bind('keydown', 'ctrl+return', function(e) { e.preventDefault(); $('#query-form').submit(); })
- .on('input propertychange', function() { $('#query-errors').hide(); });
+$('#query-box').on('input propertychange', function() { $('#query-errors').hide(); });
$('#query-form').submit(submitQuery);
$('#query-explain').change(function() {
@@ -528,17 +538,21 @@
}
});
-QUERY_EDITOR = CodeMirror.fromTextArea($('#query-box')[0], {lineNumbers: true, mode: 'sparql'});
+QUERY_EDITOR = CodeMirror.fromTextArea($('#query-box')[0], {lineNumbers: true, mode: 'sparql',
+ extraKeys: {'Ctrl-Enter': submitQuery, 'Ctrl-,': moveTabLeft, 'Ctrl-.': moveTabRight}
+});
function submitQuery(e) {
- e.preventDefault();
+ try {
+ e.preventDefault();
+ } catch(e) {}
// transfer CodeMirror content to textarea
QUERY_EDITOR.save();
var settings = {
type: 'POST',
- data: $(this).serialize(),
+ data: $('#query-form').serialize(),
headers: { 'Accept': 'application/sparql-results+json, application/rdf+xml' },
success: showQueryResults,
error: queryResultsError
@@ -553,7 +567,7 @@
if($('#query-explain').is(':checked')) {
settings = {
type: 'POST',
- data: $(this).serialize() + '&explain=' + ($('#query-details').is(':checked') ? 'details' : 'true'),
+ data: $('#query-form').serialize() + '&explain=' + ($('#query-details').is(':checked') ? 'details' : 'true'),
dataType: 'html',
success: showQueryExplanation,
error: queryResultsError
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-05-15 18:03:02
|
Revision: 8338
http://sourceforge.net/p/bigdata/code/8338
Author: tobycraig
Date: 2014-05-15 18:02:59 +0000 (Thu, 15 May 2014)
Log Message:
-----------
Fixed bug with status panel links not working properly
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-15 15:26:56 UTC (rev 8337)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-05-15 18:02:59 UTC (rev 8338)
@@ -1151,8 +1151,8 @@
function getStatusNumbers(data) {
$('#status-text').html(data);
- $('#status-text a').eq(1).click(function(e) { e.preventDefault(); showQueries(false); return false; });
- $('#status-text a').eq(2).click(function(e) { e.preventDefault(); showQueries(true); return false; });
+ $('#status-text a[href*="status"]').eq(0).click(function(e) { e.preventDefault(); showQueries(false); return false; });
+ $('#status-text a[href*="status"]').eq(1).click(function(e) { e.preventDefault(); showQueries(true); return false; });
}
$('#show-queries').click(function(e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-06-16 16:55:02
|
Revision: 8488
http://sourceforge.net/p/bigdata/code/8488
Author: tobycraig
Date: 2014-06-16 16:54:52 +0000 (Mon, 16 Jun 2014)
Log Message:
-----------
Changed wording on update panel
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-16 16:25:19 UTC (rev 8487)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-16 16:54:52 UTC (rev 8488)
@@ -568,7 +568,7 @@
break;
}
- $('#update-response pre').show().html('Data loading...');
+ $('#update-response pre').show().html('Running update...');
$.ajax(url, settings);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-06-16 21:02:16
|
Revision: 8489
http://sourceforge.net/p/bigdata/code/8489
Author: tobycraig
Date: 2014-06-16 21:02:08 +0000 (Mon, 16 Jun 2014)
Log Message:
-----------
Fixed monitor update in Firefox
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-16 16:54:52 UTC (rev 8488)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-16 21:02:08 UTC (rev 8489)
@@ -533,14 +533,16 @@
// see if monitor mode is on
if($('#update-monitor').is(':checked')) {
// create form and submit it, sending output to the iframe
- var form = $('<form method="POST" target="update-response-container">')
+ var form = $('<form id="update-monitor-form" method="POST" target="update-response-container">')
.attr('action', url)
.append($('<input name="update">').val(settings.data))
.append('<input name="monitor" value="true">');
if($('#update-analytic').is(':checked')) {
form.append('<input name="analytic" value="true">')
}
+ form.appendTo($('body'));
form.submit();
+ $('#update-monitor-form').remove();
$('#update-response iframe, #update-clear-container').show();
$('#update-response pre').hide();
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-06-17 18:51:34
|
Revision: 8497
http://sourceforge.net/p/bigdata/code/8497
Author: tobycraig
Date: 2014-06-17 18:51:24 +0000 (Tue, 17 Jun 2014)
Log Message:
-----------
Fixed typo
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-17 14:35:35 UTC (rev 8496)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-17 18:51:24 UTC (rev 8497)
@@ -285,7 +285,7 @@
'skos': 'http://www.w3.org/2004/02/skos/core#',
'xsd': 'http://www.w3.org/2001/XMLSchema#'
},
- 'Dublic Core': {
+ 'Dublin Core': {
'dc': 'http://purl.org/dc/elements/1.1/',
'dcterm': 'http://purl.org/dc/terms/',
'void': 'http://rdfs.org/ns/void#'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-06-17 19:08:23
|
Revision: 8499
http://sourceforge.net/p/bigdata/code/8499
Author: tobycraig
Date: 2014-06-17 19:08:09 +0000 (Tue, 17 Jun 2014)
Log Message:
-----------
Fixed initial LBS state
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-17 19:02:35 UTC (rev 8498)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-06-17 19:08:09 UTC (rev 8499)
@@ -21,15 +21,19 @@
// debug to access closure variables
$('html, textarea, select').bind('keydown', 'ctrl+d', function() { debugger; });
-function useLBS() {
- if(this.checked) {
+function useLBS(state) {
+ // allows passing in of boolean, or firing on event
+ if(typeof(state) != 'boolean') {
+ state = this.checked;
+ }
+ if(state) {
RW_URL_PREFIX = '/bigdata/LBS/leader/';
RO_URL_PREFIX = '/bigdata/LBS/read/';
} else {
RW_URL_PREFIX = '/bigdata/';
RO_URL_PREFIX = '/bigdata/';
}
- $('.use-lbs').prop('checked', this.checked);
+ $('.use-lbs').prop('checked', state);
}
useLBS(true);
$('.use-lbs').change(useLBS);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-11 23:54:26
|
Revision: 8537
http://sourceforge.net/p/bigdata/code/8537
Author: tobycraig
Date: 2014-07-11 23:54:19 +0000 (Fri, 11 Jul 2014)
Log Message:
-----------
Fixed mime type typo
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-11 23:29:20 UTC (rev 8536)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-11 23:54:19 UTC (rev 8537)
@@ -779,7 +779,7 @@
var export_extensions = {
"application/rdf+xml": ['RDF/XML', 'rdf', true],
- "application/x-turtle": ['N-Triples', 'nt', true],
+ "application/n-triples": ['N-Triples', 'nt', true],
"application/x-turtle": ['Turtle', 'ttl', true],
"text/rdf+n3": ['N3', 'n3', true],
"application/trix": ['TriX', 'trix', true],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-12 01:12:49
|
Revision: 8538
http://sourceforge.net/p/bigdata/code/8538
Author: tobycraig
Date: 2014-07-12 01:12:41 +0000 (Sat, 12 Jul 2014)
Log Message:
-----------
Fixed queries/details links on status tab
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-11 23:54:19 UTC (rev 8537)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-12 01:12:41 UTC (rev 8538)
@@ -1346,8 +1346,8 @@
function getStatusNumbers(data) {
$('#status-text').html(data);
- $('#status-text a').eq(1).click(function(e) { e.preventDefault(); showQueries(false); return false; });
- $('#status-text a').eq(2).click(function(e) { e.preventDefault(); showQueries(true); return false; });
+ $('#status-text a').eq(-2).click(function(e) { e.preventDefault(); showQueries(false); return false; });
+ $('#status-text a').eq(-1).click(function(e) { e.preventDefault(); showQueries(true); return false; });
}
$('#show-queries').click(function(e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-12 01:23:46
|
Revision: 8539
http://sourceforge.net/p/bigdata/code/8539
Author: tobycraig
Date: 2014-07-12 01:23:36 +0000 (Sat, 12 Jul 2014)
Log Message:
-----------
#843 - Fixed links on performance tab
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-12 01:12:41 UTC (rev 8538)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-12 01:23:36 UTC (rev 8539)
@@ -1485,11 +1485,20 @@
/* Performance */
-$('#tab-selector a[data-target=performance]').click(function(e) {
- $.get(RO_URL_PREFIX + 'counters', function(data) {
+$('#tab-selector a[data-target=performance]').click(loadPerformance);
+
+function loadPerformance(path) {
+ if(typeof(path) == 'undefined') {
+ path = '';
+ }
+ $.get(RO_URL_PREFIX + 'counters?' + path, function(data) {
$('#performance-tab .box').html(data);
+ $('#performance-tab .box a').click(function(e) {
+ e.preventDefault();
+ loadPerformance(this.href.split('?')[1]);
+ });
});
-});
+}
/* Utility functions */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-14 22:21:47
|
Revision: 8548
http://sourceforge.net/p/bigdata/code/8548
Author: tobycraig
Date: 2014-07-14 22:21:43 +0000 (Mon, 14 Jul 2014)
Log Message:
-----------
Fixed status tab links
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-14 20:22:02 UTC (rev 8547)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-14 22:21:43 UTC (rev 8548)
@@ -1367,8 +1367,8 @@
function getStatusNumbers(data) {
$('#status-text').html(data);
- $('#status-text a').eq(-2).click(function(e) { e.preventDefault(); showQueries(false); return false; });
- $('#status-text a').eq(-1).click(function(e) { e.preventDefault(); showQueries(true); return false; });
+ $('p:contains(Show queries, query details)').find('a').eq(0).click(function(e) { e.preventDefault(); showQueries(false); });
+ $('p:contains(Show queries, query details)').find('a').eq(1).click(function(e) { e.preventDefault(); showQueries(true); });
}
$('#show-queries').click(function(e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-16 21:56:47
|
Revision: 8562
http://sourceforge.net/p/bigdata/code/8562
Author: tobycraig
Date: 2014-07-16 21:56:39 +0000 (Wed, 16 Jul 2014)
Log Message:
-----------
Added label for namespace shortcuts
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-16 21:41:09 UTC (rev 8561)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-16 21:56:39 UTC (rev 8562)
@@ -373,7 +373,7 @@
}
};
-$('.namespace-shortcuts').html('');
+$('.namespace-shortcuts').html('Namespace shortcuts: ');
for(var category in NAMESPACE_SHORTCUTS) {
var select = $('<select><option>' + category + '</option></select>').appendTo($('.namespace-shortcuts'));
for(var ns in NAMESPACE_SHORTCUTS[category]) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-17 17:09:39
|
Revision: 8569
http://sourceforge.net/p/bigdata/code/8569
Author: tobycraig
Date: 2014-07-17 17:09:31 +0000 (Thu, 17 Jul 2014)
Log Message:
-----------
Improved explore tab to treat URIs without <> as namespaced only if they match one of the defined namespaces, allowing user to enter non-namespaced URIs without <>
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-17 15:46:25 UTC (rev 8568)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-17 17:09:31 UTC (rev 8569)
@@ -1171,8 +1171,15 @@
e.preventDefault();
var uri = $(this).find('input[type="text"]').val().trim();
if(uri) {
- // add < > if they're not present and this is not a namespaced URI
- if(uri[0] != '<' && uri.match(/^\w+:\//)) {
+ // add < > if they're not present and this is not a URI with a recognised namespace
+ var namespaces = [];
+ for(var cat in NAMESPACE_SHORTCUTS) {
+ for(var namespace in NAMESPACE_SHORTCUTS[cat]) {
+ namespaces.push(namespace);
+ }
+ }
+ var namespaced = '^(' + namespaces.join('|') + '):';
+ if(uri[0] != '<' && !uri.match(namespaced)) {
uri = '<' + uri;
if(uri.slice(-1) != '>') {
uri += '>';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-17 22:45:03
|
Revision: 8573
http://sourceforge.net/p/bigdata/code/8573
Author: tobycraig
Date: 2014-07-17 22:45:00 +0000 (Thu, 17 Jul 2014)
Log Message:
-----------
Fixed query history not recognising previously executed queries
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-17 20:58:48 UTC (rev 8572)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-17 22:45:00 UTC (rev 8573)
@@ -749,7 +749,7 @@
// see if this query is already in the history
$('#query-history tbody tr').each(function(i, row) {
- if($(row).find('.query')[0].innerText == query && $(row).find('.query-namespace').text() == NAMESPACE) {
+ if($(row).find('.query')[0].innerText == query) {
// clear the old results and set the time to now
$(row).find('.query-time').text(new Date().toISOString());
$(row).find('.query-results').text('...');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-21 23:58:40
|
Revision: 8582
http://sourceforge.net/p/bigdata/code/8582
Author: tobycraig
Date: 2014-07-21 23:58:38 +0000 (Mon, 21 Jul 2014)
Log Message:
-----------
Reorganised and tidied up JS
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-19 14:34:10 UTC (rev 8581)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-21 23:58:38 UTC (rev 8582)
@@ -1,9 +1,67 @@
$(function() {
-// global variables
-var RW_URL_PREFIX, RO_URL_PREFIX, DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY, NAMESPACE_SHORTCUTS, FILE_CONTENTS, QUERY_RESULTS;
-var CODEMIRROR_DEFAULTS, EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {};
-var PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE;
+/* Global variables */
+
+// LBS/non-LBS URL prefixes
+var RW_URL_PREFIX, RO_URL_PREFIX
+
+// query/update editors
+var EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {};
+var CODEMIRROR_DEFAULTS = {};
+CodeMirror.defaults = {
+ lineNumbers: true,
+ mode: 'sparql',
+ extraKeys: {'Ctrl-,': moveTabLeft, 'Ctrl-.': moveTabRight}
+};
+// key is value of RDF type selector, value is name of CodeMirror mode
+var RDF_MODES = {
+ 'n-triples': 'ntriples',
+ 'rdf/xml': 'xml',
+ 'json': 'json',
+ 'turtle': 'turtle'
+};
+var FILE_CONTENTS;
+// file/update editor type handling
+// .xml is used for both RDF and TriX, assume it's RDF
+// We could check the parent element to see which it is
+var RDF_TYPES = {
+ 'nq': 'n-quads',
+ 'nt': 'n-triples',
+ 'n3': 'n3',
+ 'rdf': 'rdf/xml',
+ 'rdfs': 'rdf/xml',
+ 'owl': 'rdf/xml',
+ 'xml': 'rdf/xml',
+ 'json': 'json',
+ 'trig': 'trig',
+ 'trix': 'trix',
+ //'xml': 'trix',
+ 'ttl': 'turtle'
+};
+var RDF_CONTENT_TYPES = {
+ 'n-quads': 'text/x-nquads',
+ 'n-triples': 'text/plain',
+ 'n3': 'text/rdf+n3',
+ 'rdf/xml': 'application/rdf+xml',
+ 'json': 'application/sparql-results+json',
+ 'trig': 'application/x-trig',
+ 'trix': 'application/trix',
+ 'turtle': 'application/x-turtle'
+};
+var SPARQL_UPDATE_COMMANDS = [
+ 'INSERT',
+ 'DELETE',
+ 'LOAD',
+ 'CLEAR'
+];
+
+// pagination
+var QUERY_RESULTS, PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE;
+
+// namespaces
+var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY;
+
+// namespace creation
var NAMESPACE_PARAMS = {
'name': 'com.bigdata.rdf.sail.namespace',
'index': 'com.bigdata.rdf.store.AbstractTripleStore.textIndex',
@@ -13,15 +71,51 @@
'axioms': 'com.bigdata.rdf.store.AbstractTripleStore.axiomsClass'
};
-CODEMIRROR_DEFAULTS = {
- lineNumbers: true,
- mode: 'sparql',
- extraKeys: {'Ctrl-,': moveTabLeft, 'Ctrl-.': moveTabRight}
+var NAMESPACE_SHORTCUTS = {
+ 'Bigdata': {
+ 'bd': 'http://www.bigdata.com/rdf#',
+ 'bds': 'http://www.bigdata.com/rdf/search#',
+ 'gas': 'http://www.bigdata.com/rdf/gas#',
+ 'hint': 'http://www.bigdata.com/queryHints#'
+ },
+ 'W3C': {
+ 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
+ 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',
+ 'owl': 'http://www.w3.org/2002/07/owl#',
+ 'skos': 'http://www.w3.org/2004/02/skos/core#',
+ 'xsd': 'http://www.w3.org/2001/XMLSchema#'
+ },
+ 'Dublin Core': {
+ 'dc': 'http://purl.org/dc/elements/1.1/',
+ 'dcterm': 'http://purl.org/dc/terms/',
+ 'void': 'http://rdfs.org/ns/void#'
+ },
+ 'Social/Other': {
+ 'foaf': 'http://xmlns.com/foaf/0.1/',
+ 'schema': 'http://schema.org/',
+ 'sioc': 'http://rdfs.org/sioc/ns#'
+ }
};
-// debug to access closure variables
-$('html, textarea, select').bind('keydown', 'ctrl+d', function() { debugger; });
+// data export
+var EXPORT_EXTENSIONS = {
+ "application/rdf+xml": ['RDF/XML', 'rdf', true],
+ "application/n-triples": ['N-Triples', 'nt', true],
+ "application/x-turtle": ['Turtle', 'ttl', true],
+ "text/rdf+n3": ['N3', 'n3', true],
+ "application/trix": ['TriX', 'trix', true],
+ "application/x-trig": ['TRIG', 'trig', true],
+ "text/x-nquads": ['NQUADS', 'nq', true],
+ "text/csv": ['CSV', 'csv', false, exportCSV],
+ "application/sparql-results+json": ['JSON', 'json', false, exportJSON],
+ // "text/tab-separated-values": ['TSV', 'tsv', false, exportTSV],
+ "application/sparql-results+xml": ['XML', 'xml', false, exportXML]
+};
+
+
+/* Load balancing */
+
function useLBS(state) {
// allows passing in of boolean, or firing on event
if(typeof(state) != 'boolean') {
@@ -36,9 +130,8 @@
}
$('.use-lbs').prop('checked', state);
}
-useLBS(true);
-$('.use-lbs').change(useLBS);
+
/* Modal functions */
function showModal(id) {
@@ -46,14 +139,15 @@
$('body').addClass('modal-open');
}
-$('.modal-cancel').click(function() {
+function closeModal() {
$('body').removeClass('modal-open');
$(this).parents('.modal').hide();
-});
+}
+
/* Search */
-$('#search-form').submit(function(e) {
+function submitSearch(e) {
e.preventDefault();
var term = $(this).find('input').val();
if(!term) {
@@ -64,13 +158,14 @@
$('#query-errors').hide();
$('#query-form').submit();
showTab('query');
-});
+}
+
/* Tab selection */
-$('#tab-selector a').click(function(e) {
+function clickTab(e) {
showTab($(this).data('target'));
-});
+}
function showTab(tab, nohash) {
$('.tab').hide();
@@ -111,9 +206,6 @@
}
}
-// these should be , and . but Hotkeys views those keypresses as these characters
-$('html, textarea, select').bind('keydown', 'ctrl+¼', moveTabLeft);
-$('html, textarea, select').bind('keydown', 'ctrl+¾', moveTabRight);
/* Namespaces */
@@ -270,14 +362,14 @@
return errors.length == 0;
}
-$('#new-namespace-mode').change(function() {
+function changeNamespaceMode() {
var quads = this.value == 'quads';
$('#new-namespace-inference').prop('disabled', quads);
$('#inference-quads-incompatible').toggle(quads);
if(quads) {
$('#new-namespace-inference').prop('checked', false);
}
-});
+}
function createNamespace(e) {
e.preventDefault();
@@ -327,7 +419,6 @@
};
$.ajax(RW_URL_PREFIX + 'namespace', settings);
}
-$('#namespace-create').submit(createNamespace);
function getDefaultNamespace() {
$.get(RO_URL_PREFIX + 'namespace?describe-each-named-graph=false&describe-default-namespace=true', function(data) {
@@ -339,60 +430,34 @@
});
}
-getDefaultNamespace();
-
/* Namespace shortcuts */
-NAMESPACE_SHORTCUTS = {
- 'Bigdata': {
- 'bd': 'http://www.bigdata.com/rdf#',
- 'bds': 'http://www.bigdata.com/rdf/search#',
- 'gas': 'http://www.bigdata.com/rdf/gas#',
- 'hint': 'http://www.bigdata.com/queryHints#'
- },
- 'W3C': {
- 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
- 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',
- 'owl': 'http://www.w3.org/2002/07/owl#',
- 'skos': 'http://www.w3.org/2004/02/skos/core#',
- 'xsd': 'http://www.w3.org/2001/XMLSchema#'
- },
- 'Dublin Core': {
- 'dc': 'http://purl.org/dc/elements/1.1/',
- 'dcterm': 'http://purl.org/dc/terms/',
- 'void': 'http://rdfs.org/ns/void#'
- },
- 'Social/Other': {
- 'foaf': 'http://xmlns.com/foaf/0.1/',
- 'schema': 'http://schema.org/',
- 'sioc': 'http://rdfs.org/sioc/ns#'
+function createNamespaceShortcuts() {
+ $('.namespace-shortcuts').html('Namespace shortcuts: ');
+ for(var category in NAMESPACE_SHORTCUTS) {
+ var select = $('<select><option>' + category + '</option></select>').appendTo($('.namespace-shortcuts'));
+ for(var ns in NAMESPACE_SHORTCUTS[category]) {
+ select.append('<option value="' + NAMESPACE_SHORTCUTS[category][ns] + '">' + ns + '</option>');
+ }
}
-};
-$('.namespace-shortcuts').html('Namespace shortcuts: ');
-for(var category in NAMESPACE_SHORTCUTS) {
- var select = $('<select><option>' + category + '</option></select>').appendTo($('.namespace-shortcuts'));
- for(var ns in NAMESPACE_SHORTCUTS[category]) {
- select.append('<option value="' + NAMESPACE_SHORTCUTS[category][ns] + '">' + ns + '</option>');
- }
-}
+ $('.namespace-shortcuts select').change(function() {
+ var uri = this.value;
+ var tab = $(this).parents('.tab').attr('id').split('-')[0];
+ var current = EDITORS[tab].getValue();
-$('.namespace-shortcuts select').change(function() {
- var uri = this.value;
- var tab = $(this).parents('.tab').attr('id').split('-')[0];
- var current = EDITORS[tab].getValue();
+ if(current.indexOf(uri) == -1) {
+ var ns = $(this).find(':selected').text();
+ EDITORS[tab].setValue('prefix ' + ns + ': <' + uri + '>\n' + current);
+ }
- if(current.indexOf(uri) == -1) {
- var ns = $(this).find(':selected').text();
- EDITORS[tab].setValue('prefix ' + ns + ': <' + uri + '>\n' + current);
- }
+ // reselect group label
+ this.selectedIndex = 0;
+ });
+}
- // reselect group label
- this.selectedIndex = 0;
-});
-
/* Update */
function handleDragOver(cm, e) {
@@ -466,9 +531,9 @@
if(extension == 'rq') {
// SPARQL
setType('sparql');
- } else if(extension in rdf_types) {
+ } else if(extension in RDF_TYPES) {
// RDF
- setType('rdf', rdf_types[extension]);
+ setType('rdf', RDF_TYPES[extension]);
} else {
// extension is no help, see if we can find some SPARQL commands
setType(identify(content));
@@ -491,8 +556,8 @@
}
text = text.toUpperCase();
- for(var i=0; i<sparql_update_commands.length; i++) {
- if(text.indexOf(sparql_update_commands[i]) != -1) {
+ for(var i=0; i<SPARQL_UPDATE_COMMANDS.length; i++) {
+ if(text.indexOf(SPARQL_UPDATE_COMMANDS[i]) != -1) {
return 'sparql';
}
}
@@ -516,9 +581,6 @@
setUpdateSettings(type);
}
-$('#update-type').change(function() { setUpdateSettings(this.value); });
-$('#rdf-type').change(function() { setUpdateMode('rdf'); });
-
function setUpdateSettings(type) {
$('#rdf-type, label[for="rdf-type"]').attr('disabled', type != 'rdf');
$('#update-tab .advanced-features input').attr('disabled', type != 'sparql');
@@ -531,63 +593,27 @@
mode = 'sparql';
} else if(type == 'rdf') {
type = $('#rdf-type').val();
- if(type in rdf_modes) {
- mode = rdf_modes[type];
+ if(type in RDF_MODES) {
+ mode = RDF_MODES[type];
}
}
EDITORS.update.setOption('mode', mode);
}
-// .xml is used for both RDF and TriX, assume it's RDF
-// We could check the parent element to see which it is
-var rdf_types = {'nq': 'n-quads',
- 'nt': 'n-triples',
- 'n3': 'n3',
- 'rdf': 'rdf/xml',
- 'rdfs': 'rdf/xml',
- 'owl': 'rdf/xml',
- 'xml': 'rdf/xml',
- 'json': 'json',
- 'trig': 'trig',
- 'trix': 'trix',
- //'xml': 'trix',
- 'ttl': 'turtle'};
-
-var rdf_content_types = {'n-quads': 'text/x-nquads',
- 'n-triples': 'text/plain',
- 'n3': 'text/rdf+n3',
- 'rdf/xml': 'application/rdf+xml',
- 'json': 'application/sparql-results+json',
- 'trig': 'application/x-trig',
- 'trix': 'application/trix',
- 'turtle': 'application/x-turtle'};
+function createUpdateEditor() {
+ EDITORS.update = CodeMirror.fromTextArea($('#update-box')[0], CODEMIRROR_DEFAULTS);
+ EDITORS.update.on('change', function() {
+ if(ERROR_LINE_MARKERS.update) {
+ ERROR_LINE_MARKERS.update.clear();
+ ERROR_CHARACTER_MARKERS.update.clear();
+ }
+ });
+ EDITORS.update.on('dragover', handleDragOver);
+ EDITORS.update.on('drop', handleDrop);
+ EDITORS.update.on('paste', handlePaste);
+ EDITORS.update.addKeyMap({'Ctrl-Enter': submitUpdate});
+}
-// key is value of RDF type selector, value is name of CodeMirror mode
-var rdf_modes = {'n-triples': 'ntriples', 'rdf/xml': 'xml', 'json': 'json', 'turtle': 'turtle'};
-
-var sparql_update_commands = ['INSERT', 'DELETE', 'LOAD', 'CLEAR'];
-
-$('#update-file').change(handleFileInput);
-// $('#update-box').on('dragover', handleDragOver)
-// .on('drop', handleFile)
-// .on('paste', handlePaste)
-// .on('input propertychange', function() { $('#update-errors').hide(); });
-$('#clear-file').click(clearFile);
-
-$('#update-update').click(submitUpdate);
-
-EDITORS.update = CodeMirror.fromTextArea($('#update-box')[0], CODEMIRROR_DEFAULTS);
-EDITORS.update.on('change', function() {
- if(ERROR_LINE_MARKERS.update) {
- ERROR_LINE_MARKERS.update.clear();
- ERROR_CHARACTER_MARKERS.update.clear();
- }
-});
-EDITORS.update.on('dragover', handleDragOver);
-EDITORS.update.on('drop', handleDrop);
-EDITORS.update.on('paste', handlePaste);
-EDITORS.update.addKeyMap({'Ctrl-Enter': submitUpdate});
-
function submitUpdate(e) {
// Updates are submitted as a regular form for SPARQL updates in monitor mode, and via AJAX for non-monitor SPARQL, RDF & file path updates.
// When submitted as a regular form, the output is sent to an iframe. This is to allow monitor mode to work.
@@ -639,7 +665,7 @@
alert('Please select an RDF content type.');
return;
}
- settings.contentType = rdf_content_types[type];
+ settings.contentType = RDF_CONTENT_TYPES[type];
break;
case 'path':
// if no scheme is specified, assume a local path
@@ -655,16 +681,17 @@
$.ajax(url, settings);
}
-$('#update-clear').click(function() {
+function clearUpdateOutput() {
$('#update-response, #update-clear-container').hide();
$('#update-response pre').text('');
$('#update-response iframe').attr('src', 'about:blank');
-});
+}
-$('.advanced-features-toggle').click(function() {
+// also for query panel
+function toggleAdvancedFeatures(e) {
+ e.preventDefault();
$(this).next('.advanced-features').toggle();
- return false;
-});
+}
function updateResponseHTML(data) {
$('#update-response, #update-clear-container').show();
@@ -690,33 +717,31 @@
/* Query */
-$('#query-box').on('input propertychange', function() { $('#query-errors').hide(); });
-$('#query-form').submit(submitQuery);
-
-$('#query-explain').change(function() {
+// details needs explain, so turn details off if explain is unchecked,
+// and turn explain on if details is checked
+function handleExplain() {
if(!this.checked) {
$('#query-details').prop('checked', false);
}
-});
+}
-$('#query-details').change(function() {
+function handleDetails() {
if(this.checked) {
$('#query-explain').prop('checked', true);
}
-});
+}
-EDITORS.query = CodeMirror.fromTextArea($('#query-box')[0], CODEMIRROR_DEFAULTS);
-EDITORS.query.on('change', function() {
- if(ERROR_LINE_MARKERS.query) {
- ERROR_LINE_MARKERS.query.clear();
- ERROR_CHARACTER_MARKERS.query.clear();
- }
-});
-EDITORS.query.addKeyMap({'Ctrl-Enter': submitQuery});
+function createQueryEditor() {
+ EDITORS.query = CodeMirror.fromTextArea($('#query-box')[0], CODEMIRROR_DEFAULTS);
+ EDITORS.query.on('change', function() {
+ if(ERROR_LINE_MARKERS.query) {
+ ERROR_LINE_MARKERS.query.clear();
+ ERROR_CHARACTER_MARKERS.query.clear();
+ }
+ });
+ EDITORS.query.addKeyMap({'Ctrl-Enter': submitQuery});
+}
-$('#query-history').on('click', '.query a', loadHistory);
-$('#query-history').on('click', '.query-delete a', deleteHistoryRow)
-
function loadHistory(e) {
e.preventDefault();
EDITORS.query.setValue(this.innerText);
@@ -805,49 +830,39 @@
}
}
-$('#query-response-clear').click(function() {
+function clearQueryResponse() {
$('#query-response, #query-explanation').empty('');
$('#query-response, #query-pagination, #query-explanation, #query-export-container').hide();
-});
+}
-$('#query-export').click(function() { updateExportFileExtension(); showModal('query-export-modal'); });
+function showQueryExportModal() {
+ updateExportFileExtension();
+ showModal('query-export-modal');
+}
-var export_extensions = {
- "application/rdf+xml": ['RDF/XML', 'rdf', true],
- "application/n-triples": ['N-Triples', 'nt', true],
- "application/x-turtle": ['Turtle', 'ttl', true],
- "text/rdf+n3": ['N3', 'n3', true],
- "application/trix": ['TriX', 'trix', true],
- "application/x-trig": ['TRIG', 'trig', true],
- "text/x-nquads": ['NQUADS', 'nq', true],
+function createExportOptions() {
+ for(var contentType in EXPORT_EXTENSIONS) {
+ var optgroup = EXPORT_EXTENSIONS[contentType][2] ? '#rdf-formats' : '#non-rdf-formats';
+ $(optgroup).append('<option value="' + contentType + '">' + EXPORT_EXTENSIONS[contentType][0] + '</option>');
+ }
- "text/csv": ['CSV', 'csv', false, exportCSV],
- "application/sparql-results+json": ['JSON', 'json', false, exportJSON],
- // "text/tab-separated-values": ['TSV', 'tsv', false, exportTSV],
- "application/sparql-results+xml": ['XML', 'xml', false, exportXML]
-};
+ $('#export-format option:first').prop('selected', true);
-for(var contentType in export_extensions) {
- var optgroup = export_extensions[contentType][2] ? '#rdf-formats' : '#non-rdf-formats';
- $(optgroup).append('<option value="' + contentType + '">' + export_extensions[contentType][0] + '</option>');
+ $('#export-format').change(updateExportFileExtension);
}
-$('#export-format option:first').prop('selected', true);
-
-$('#export-format').change(updateExportFileExtension);
-
function updateExportFileExtension() {
- $('#export-filename-extension').html(export_extensions[$('#export-format').val()][1]);
+ $('#export-filename-extension').html(EXPORT_EXTENSIONS[$('#export-format').val()][1]);
}
-$('#query-download').click(function() {
+function queryExport() {
var dataType = $('#export-format').val();
var filename = $('#export-filename').val();
if(filename == '') {
filename = 'export';
}
- filename += '.' + export_extensions[dataType][1];
- if(export_extensions[dataType][2]) {
+ filename += '.' + EXPORT_EXTENSIONS[dataType][1];
+ if(EXPORT_EXTENSIONS[dataType][2]) {
// RDF
var settings = {
type: 'POST',
@@ -860,10 +875,10 @@
$.ajax(RO_URL_PREFIX + 'sparql?workbench&convert', settings);
} else {
// not RDF
- export_extensions[dataType][3](filename);
+ EXPORT_EXTENSIONS[dataType][3](filename);
}
$(this).siblings('.modal-cancel').click();
-});
+}
function downloadRDFError(jqXHR, textStatus, errorThrown) {
alert(jqXHR.statusText);
@@ -935,7 +950,7 @@
$('#download-link').remove();
}
-function updateresultCountAndExecutionTime(count) {
+function updateResultCountAndExecutionTime(count) {
$('#query-history tbody tr:first td.query-results').text(count);
var ms = Date.now() - Date.parse($('#query-history tbody tr:first td.query-time').html());
@@ -987,7 +1002,7 @@
table.append(tr);
}
}
- updateresultCountAndExecutionTime(rows.length);
+ updateResultCountAndExecutionTime(rows.length);
} else {
// JSON
// save data for export and pagination
@@ -996,7 +1011,7 @@
if(typeof(data.boolean) != 'undefined') {
// ASK query
table.append('<tr><td>' + data.boolean + '</td></tr>').addClass('boolean');
- updateresultCountAndExecutionTime('' + data.boolean);
+ updateResultCountAndExecutionTime('' + data.boolean);
return;
}
@@ -1038,7 +1053,7 @@
table.append(thead);
$('#total-results').html(data.results.bindings.length);
- updateresultCountAndExecutionTime(data.results.bindings.length);
+ updateResultCountAndExecutionTime(data.results.bindings.length);
setNumberOfPages();
showPage(1);
@@ -1070,8 +1085,9 @@
}
}
-/* Pagination */
+/* Query result pagination */
+
function setNumberOfPages() {
TOTAL_PAGES = Math.ceil(QUERY_RESULTS.results.bindings.length / PAGE_SIZE);
$('#result-pages').html(TOTAL_PAGES);
@@ -1093,10 +1109,7 @@
showPage(1);
}
-$('#results-per-page').change(function() { setPageSize(this.value); });
-$('#previous-page').click(function() { showPage(CURRENT_PAGE - 1); });
-$('#next-page').click(function() { showPage(CURRENT_PAGE + 1); });
-$('#current-page').keyup(function(e) {
+function handlePageSelector(e) {
if(e.which == 13) {
var n = parseInt(this.value, 10);
if(typeof n != 'number' || n % 1 != 0 || n < 1 || n > TOTAL_PAGES) {
@@ -1105,7 +1118,7 @@
showPage(n);
}
}
-});
+}
function showPage(n) {
if(typeof n != 'number' || n % 1 != 0 || n < 1 || n > TOTAL_PAGES) {
@@ -1162,9 +1175,10 @@
$('#current-page').val(n);
}
+
/* Explore */
-$('#explore-form').submit(function(e) {
+function exploreSubmit(e) {
e.preventDefault();
var uri = $(this).find('input[type="text"]').val().trim();
if(uri) {
@@ -1186,7 +1200,6 @@
loadURI(uri);
// if this is a SID, make the components clickable
- // var re = /<< *(<[^<>]*>) *(<[^<>]*>) *(<[^<>]*>) *>>/;
var re = /<< *([^ ]+) +([^ ]+) +([^ ]+) *>>/;
var match = uri.match(re);
if(match) {
@@ -1201,7 +1214,7 @@
$('#explore-header').html($('<h1>').text(uri));
}
}
-});
+}
function buildExploreHash(uri) {
return '#explore:' + NAMESPACE + ':' + uri;
@@ -1367,10 +1380,6 @@
return hash.match(re);
}
-// handle history buttons and initial display of first tab
-window.addEventListener("popstate", handlePopState);
-$(handlePopState);
-
function handlePopState() {
var hash = parseHash(this.location.hash);
if(!hash) {
@@ -1390,10 +1399,9 @@
$('#explore-results, #explore-header').show();
}
+
/* Status */
-$('#tab-selector a[data-target=status]').click(getStatus);
-
function getStatus(e) {
if(e) {
e.preventDefault();
@@ -1412,16 +1420,6 @@
$('p:contains(Show queries, query details)').find('a').eq(1).click(function(e) { e.preventDefault(); showQueries(true); });
}
-$('#show-queries').click(function(e) {
- e.preventDefault();
- showQueries(false);
-});
-
-$('#show-query-details').click(function(e) {
- e.preventDefault();
- showQueries(true);
-});
-
function showQueries(details) {
var url = RO_URL_PREFIX + 'status?showQueries';
if(details) {
@@ -1500,10 +1498,9 @@
});
}
+
/* Health */
-$('#tab-selector a[data-target=health], #health-refresh').click(getHealth);
-
function getHealth(e) {
e.preventDefault();
$.get('/status?health', function(data) {
@@ -1552,12 +1549,10 @@
}
});
}
-showHealthTab();
+
/* Performance */
-$('#tab-selector a[data-target=performance]').click(loadPerformance);
-
function loadPerformance(path) {
if(typeof(path) == 'undefined') {
path = '';
@@ -1588,6 +1583,7 @@
return '<' + uri + '>';
}
+// currently unused
function unabbreviate(uri) {
if(uri.charAt(0) == '<') {
// not abbreviated
@@ -1598,6 +1594,7 @@
return '<' + uri.replace(namespace, NAMESPACE_SHORTCUTS[namespace]) + '>';
}
+// currently unused
function parseSID(sid) {
// var re = /<< <([^<>]*)> <([^<>]*)> <([^<>]*)> >>/;
var re = /<< *([^ ]+) +([^ ]+) +([^ ]+) *>>/;
@@ -1609,4 +1606,83 @@
return $('<div/>').text(text).html();
}
+
+/* Startup functions */
+
+function setupHandlers() {
+ // debug to access closure variables
+ $('html, textarea, select').bind('keydown', 'ctrl+d', function() { debugger; });
+
+ $('.use-lbs').change(useLBS);
+
+ $('.modal-cancel').click(closeModal);
+
+ $('#search-form').submit(submitSearch);
+
+ $('#tab-selector a').click(clickTab);
+ // these should be , and . but Hotkeys views those keypresses as these characters
+ $('html, textarea, select').bind('keydown', 'ctrl+¼', moveTabLeft);
+ $('html, textarea, select').bind('keydown', 'ctrl+¾', moveTabRight);
+ $('#tab-selector a[data-target=status]').click(getStatus);
+ $('#tab-selector a[data-target=health], #health-refresh').click(getHealth);
+ $('#tab-selector a[data-target=performance]').click(loadPerformance);
+
+ $('#new-namespace-mode').change(changeNamespaceMode);
+ $('#namespace-create').submit(createNamespace);
+
+ $('#update-type').change(function() { setUpdateSettings(this.value); });
+ $('#rdf-type').change(function() { setUpdateMode('rdf'); });
+ $('#update-file').change(handleFileInput);
+ // $('#update-box').on('dragover', handleDragOver)
+ // .on('drop', handleFile)
+ // .on('paste', handlePaste)
+ // .on('input propertychange', function() { $('#update-errors').hide(); });
+ $('#clear-file').click(clearFile);
+ $('#update-update').click(submitUpdate);
+ $('#update-clear').click(clearUpdateOutput);
+
+ $('.advanced-features-toggle').click(toggleAdvancedFeatures);
+
+ $('#query-box').on('input propertychange', function() { $('#query-errors').hide(); });
+ $('#query-form').submit(submitQuery);
+ $('#query-explain').change(handleExplain);
+ $('#query-details').change(handleDetails);
+ $('#query-history').on('click', '.query a', loadHistory);
+ $('#query-history').on('click', '.query-delete a', deleteHistoryRow)
+ $('#query-response-clear').click(clearQueryResponse);
+ $('#query-export').click(showQueryExportModal);
+ $('#query-download').click(queryExport);
+
+ $('#results-per-page').change(function() { setPageSize(this.value); });
+ $('#previous-page').click(function() { showPage(CURRENT_PAGE - 1); });
+ $('#next-page').click(function() { showPage(CURRENT_PAGE + 1); });
+ $('#current-page').keyup(handlePageSelector);
+
+ $('#explore-form').submit(exploreSubmit);
+
+ // handle browser history buttons and initial display of first tab
+ window.addEventListener("popstate", handlePopState);
+ $(handlePopState);
+}
+
+function startup() {
+ setupHandlers();
+
+ useLBS(true);
+
+ showHealthTab();
+
+ getDefaultNamespace();
+
+ createNamespaceShortcuts();
+
+ createUpdateEditor();
+
+ createQueryEditor();
+
+ createExportOptions();
+}
+
+startup();
+
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-22 00:02:42
|
Revision: 8583
http://sourceforge.net/p/bigdata/code/8583
Author: tobycraig
Date: 2014-07-22 00:02:38 +0000 (Tue, 22 Jul 2014)
Log Message:
-----------
Fixed tab selector shortcuts issue with health tab in standalone mode
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-21 23:58:38 UTC (rev 8582)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 00:02:38 UTC (rev 8583)
@@ -1546,6 +1546,8 @@
$.get('/status?health', function(data) {
if(data.deployment == 'HA') {
$('#tab-selector a[data-target=health]').show();
+ } else {
+ $('#tab-selector a[data-target=health]').remove();
}
});
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-22 00:33:22
|
Revision: 8584
http://sourceforge.net/p/bigdata/code/8584
Author: tobycraig
Date: 2014-07-22 00:33:17 +0000 (Tue, 22 Jul 2014)
Log Message:
-----------
Fixed issue with placeholder text for query/update textboxes
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 00:02:38 UTC (rev 8583)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 00:33:17 UTC (rev 8584)
@@ -7,8 +7,7 @@
// query/update editors
var EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {};
-var CODEMIRROR_DEFAULTS = {};
-CodeMirror.defaults = {
+var CODEMIRROR_DEFAULTS = {
lineNumbers: true,
mode: 'sparql',
extraKeys: {'Ctrl-,': moveTabLeft, 'Ctrl-.': moveTabRight}
@@ -601,7 +600,7 @@
}
function createUpdateEditor() {
- EDITORS.update = CodeMirror.fromTextArea($('#update-box')[0], CODEMIRROR_DEFAULTS);
+ EDITORS.update = CodeMirror.fromTextArea($('#update-box')[0], copyObject(CODEMIRROR_DEFAULTS));
EDITORS.update.on('change', function() {
if(ERROR_LINE_MARKERS.update) {
ERROR_LINE_MARKERS.update.clear();
@@ -732,7 +731,7 @@
}
function createQueryEditor() {
- EDITORS.query = CodeMirror.fromTextArea($('#query-box')[0], CODEMIRROR_DEFAULTS);
+ EDITORS.query = CodeMirror.fromTextArea($('#query-box')[0], copyObject(CODEMIRROR_DEFAULTS));
EDITORS.query.on('change', function() {
if(ERROR_LINE_MARKERS.query) {
ERROR_LINE_MARKERS.query.clear();
@@ -1608,7 +1607,19 @@
return $('<div/>').text(text).html();
}
+function copyObject(src) {
+ // this returns a new object with the same keys & values as the input one.
+ // It is used to get around CodeMirror updating the default config object
+ // passed to it with the values used, which are then applied to later uses
+ // of the default config object.
+ dest = {};
+ for(var key in src) {
+ dest[key] = src[key];
+ }
+ return dest;
+}
+
/* Startup functions */
function setupHandlers() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-22 23:03:19
|
Revision: 8587
http://sourceforge.net/p/bigdata/code/8587
Author: tobycraig
Date: 2014-07-22 23:03:15 +0000 (Tue, 22 Jul 2014)
Log Message:
-----------
Workbench now remembers last used namespace between sessions
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 18:16:22 UTC (rev 8586)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 23:03:15 UTC (rev 8587)
@@ -58,7 +58,7 @@
var QUERY_RESULTS, PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE;
// namespaces
-var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY;
+var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY = false, DEFAULT_NAMESPACE_READY = false;
// namespace creation
var NAMESPACE_PARAMS = {
@@ -253,19 +253,32 @@
});
}
+// waits for namespaces to be loaded, then tries to use the supplied namespace
function selectNamespace(name) {
- // for programmatically selecting a namespace with just its name
if(!NAMESPACES_READY) {
setTimeout(function() { selectNamespace(name); }, 10);
} else {
- $('#namespaces-list tr[data-name=' + name + '] a.use-namespace').click();
+ useNamespace(name);
}
}
+// waits for default namespace to be loaded, then uses it
+function selectDefaultNamespace() {
+ if(!DEFAULT_NAMESPACE_READY) {
+ setTimeout(function() { selectDefaultNamespace(); }, 10);
+ } else {
+ selectNamespace(DEFAULT_NAMESPACE);
+ }
+}
+
function useNamespace(name) {
+ if(!namespaceExists(name)) {
+ return;
+ }
$('#current-namespace').html(name);
NAMESPACE = name;
getNamespaces();
+ localStorage['lastNamespace'] = name;
}
function deleteNamespace(namespace) {
@@ -342,13 +355,17 @@
});
}
+function namespaceExists(name) {
+ return $('#namespaces-list tr[data-name=' + name + ']').length != 0;
+}
+
function validateNamespaceOptions() {
var errors = [];
var name = $('#new-namespace-name').val().trim();
if(!name) {
errors.push('Enter a name');
}
- if($('#namespaces-list tr[data-name=' + name + ']').length != 0) {
+ if(namespaceExists(name)) {
errors.push('Name already in use');
}
if($('#new-namespace-mode').val() == 'quads' && $('#new-namespace-inference').is(':checked')) {
@@ -424,8 +441,7 @@
// Chrome does not work with rdf\:Description, so look for Description too
var defaultDataset = $(data).find('rdf\\:Description, Description');
DEFAULT_NAMESPACE = defaultDataset.find('title')[0].textContent;
- var url = defaultDataset.find('sparqlEndpoint')[0].attributes['rdf:resource'].textContent;
- useNamespace(DEFAULT_NAMESPACE);
+ DEFAULT_NAMESPACE_READY = true;
});
}
@@ -1646,6 +1662,18 @@
}
+/* Local storage functions */
+
+function loadLastNamespace() {
+ if(localStorage['lastNamespace']) {
+ selectNamespace(localStorage['lastNamespace']);
+ } else {
+ // no previously selected namespace, or it doesn't exist - use the default
+ selectDefaultNamespace();
+ }
+}
+
+
/* Startup functions */
function setupHandlers() {
@@ -1713,6 +1741,8 @@
showHealthTab();
+ getNamespaces();
+
getDefaultNamespace();
createNamespaceShortcuts();
@@ -1722,6 +1752,8 @@
createQueryEditor();
createExportOptions();
+
+ loadLastNamespace();
}
startup();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-23 23:10:31
|
Revision: 8589
http://sourceforge.net/p/bigdata/code/8589
Author: tobycraig
Date: 2014-07-23 23:10:27 +0000 (Wed, 23 Jul 2014)
Log Message:
-----------
Made namespace/default namespace loading occur synchronously at startup, so there's no need to check later if it's complete
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-23 16:08:47 UTC (rev 8588)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-23 23:10:27 UTC (rev 8589)
@@ -58,7 +58,7 @@
var QUERY_RESULTS, PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE;
// namespaces
-var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY = false, DEFAULT_NAMESPACE_READY = false;
+var DEFAULT_NAMESPACE, NAMESPACE;
// namespace creation
var NAMESPACE_PARAMS = {
@@ -116,7 +116,7 @@
/* Load balancing */
function useLBS(state) {
- // allows passing in of boolean, or firing on event
+ // allows passing in of boolean, or firing on checkbox change
if(typeof(state) != 'boolean') {
state = this.checked;
}
@@ -208,69 +208,56 @@
/* Namespaces */
-function getNamespaces() {
- $.get(RO_URL_PREFIX + 'namespace?describe-each-named-graph=false', function(data) {
- $('#namespaces-list').empty();
- var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
- var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description')
- for(var i=0; i<namespaces.length; i++) {
- var title = namespaces[i].getElementsByTagName('title')[0].textContent;
- var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title;
- var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource');
- var use;
- if(title == NAMESPACE) {
- use = 'In use';
- } else {
- use = '<a href="#" class="use-namespace">Use</a>';
+function getNamespaces(synchronous) {
+ // synchronous mode is for startup only, and is false by default
+ var settings = {
+ async: !synchronous,
+ url: RO_URL_PREFIX + 'namespace?describe-each-named-graph=false',
+ success: function(data) {
+ $('#namespaces-list').empty();
+ var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
+ var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description')
+ for(var i=0; i<namespaces.length; i++) {
+ var title = namespaces[i].getElementsByTagName('title')[0].textContent;
+ var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title;
+ var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource');
+ var use;
+ if(title == NAMESPACE) {
+ use = 'In use';
+ } else {
+ use = '<a href="#" class="use-namespace">Use</a>';
+ }
+ $('#namespaces-list').append('<tr data-name="' + title + '">><td>' + titleText + '</td><td>' + use + '</td><td><a href="#" class="delete-namespace">Delete</a></td><td><a href="#" class="namespace-properties">Properties</a></td><td><a href="#" class="clone-namespace">Clone</a></td><td><a href="' + RO_URL_PREFIX + 'namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></td></tr>');
}
- $('#namespaces-list').append('<tr data-name="' + title + '">><td>' + titleText + '</td><td>' + use + '</td><td><a href="#" class="delete-namespace">Delete</a></td><td><a href="#" class="namespace-properties">Properties</a></td><td><a href="#" class="clone-namespace">Clone</a></td><td><a href="' + RO_URL_PREFIX + 'namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></td></tr>');
+ $('.use-namespace').click(function(e) {
+ e.preventDefault();
+ useNamespace($(this).parents('tr').data('name'));
+ });
+ $('.delete-namespace').click(function(e) {
+ e.preventDefault();
+ deleteNamespace($(this).parents('tr').data('name'));
+ });
+ $('.namespace-properties').click(function(e) {
+ e.preventDefault();
+ getNamespaceProperties($(this).parents('tr').data('name'));
+ });
+ $('.namespace-properties-java').click(function(e) {
+ e.preventDefault();
+ getNamespaceProperties($(this).parents('tr').data('name'), 'java');
+ });
+ $('.clone-namespace').click(function(e) {
+ e.preventDefault();
+ cloneNamespace($(this).parents('tr').data('name'));
+ $('#namespace-create-errors').html('');
+ });
+ $('.namespace-service-description').click(function(e) {
+ return confirm('This can be an expensive operation. Proceed anyway?');
+ });
}
- $('.use-namespace').click(function(e) {
- e.preventDefault();
- useNamespace($(this).parents('tr').data('name'));
- });
- $('.delete-namespace').click(function(e) {
- e.preventDefault();
- deleteNamespace($(this).parents('tr').data('name'));
- });
- $('.namespace-properties').click(function(e) {
- e.preventDefault();
- getNamespaceProperties($(this).parents('tr').data('name'));
- });
- $('.namespace-properties-java').click(function(e) {
- e.preventDefault();
- getNamespaceProperties($(this).parents('tr').data('name'), 'java');
- });
- $('.clone-namespace').click(function(e) {
- e.preventDefault();
- cloneNamespace($(this).parents('tr').data('name'));
- $('#namespace-create-errors').html('');
- });
- $('.namespace-service-description').click(function(e) {
- return confirm('This can be an expensive operation. Proceed anyway?');
- });
- NAMESPACES_READY = true;
- });
+ };
+ $.ajax(settings);
}
-// waits for namespaces to be loaded, then tries to use the supplied namespace
-function selectNamespace(name) {
- if(!NAMESPACES_READY) {
- setTimeout(function() { selectNamespace(name); }, 10);
- } else {
- useNamespace(name);
- }
-}
-
-// waits for default namespace to be loaded, then uses it
-function selectDefaultNamespace() {
- if(!DEFAULT_NAMESPACE_READY) {
- setTimeout(function() { selectDefaultNamespace(); }, 10);
- } else {
- selectNamespace(DEFAULT_NAMESPACE);
- }
-}
-
function useNamespace(name) {
if(!namespaceExists(name)) {
return;
@@ -437,12 +424,16 @@
}
function getDefaultNamespace() {
- $.get(RO_URL_PREFIX + 'namespace?describe-each-named-graph=false&describe-default-namespace=true', function(data) {
- // Chrome does not work with rdf\:Description, so look for Description too
- var defaultDataset = $(data).find('rdf\\:Description, Description');
- DEFAULT_NAMESPACE = defaultDataset.find('title')[0].textContent;
- DEFAULT_NAMESPACE_READY = true;
- });
+ var settings = {
+ async: false,
+ url: RO_URL_PREFIX + 'namespace?describe-each-named-graph=false&describe-default-namespace=true',
+ success: function(data) {
+ // Chrome does not work with rdf\:Description, so look for Description too
+ var defaultDataset = $(data).find('rdf\\:Description, Description');
+ DEFAULT_NAMESPACE = defaultDataset.find('title')[0].textContent;
+ }
+ };
+ $.ajax(settings);
}
@@ -1396,12 +1387,8 @@
}
function exploreNamespacedURI(namespace, uri, nopush) {
- if(!NAMESPACES_READY) {
- setTimeout(function() { exploreNamespacedURI(namespace, uri, nopush); }, 10);
- } else {
- selectNamespace(namespace);
- explore(uri, nopush);
- }
+ useNamespace(namespace);
+ explore(uri, nopush);
}
function explore(uri, nopush) {
@@ -1584,13 +1571,18 @@
}
function showHealthTab() {
- $.get('/status?health', function(data) {
- if(data.deployment == 'HA') {
- $('#tab-selector a[data-target=health]').show();
- } else {
- $('#tab-selector a[data-target=health]').remove();
+ var settings = {
+ async: false,
+ url: '/status?health',
+ success: function(data) {
+ if(data.deployment == 'HA') {
+ $('#tab-selector a[data-target=health]').show();
+ } else {
+ $('#tab-selector a[data-target=health]').remove();
+ }
}
- });
+ };
+ $.ajax(settings);
}
@@ -1665,11 +1657,11 @@
/* Local storage functions */
function loadLastNamespace() {
- if(localStorage['lastNamespace']) {
- selectNamespace(localStorage['lastNamespace']);
+ if(localStorage['lastNamespace'] && namespaceExists(localStorage['lastNamespace'])) {
+ useNamespace(localStorage['lastNamespace']);
} else {
// no previously selected namespace, or it doesn't exist - use the default
- selectDefaultNamespace();
+ useNamespace(DEFAULT_NAMESPACE);
}
}
@@ -1735,24 +1727,20 @@
}
function startup() {
- setupHandlers();
-
+ // load namespaces, default namespace, HA status
useLBS(true);
-
+ getNamespaces(true);
+ getDefaultNamespace();
showHealthTab();
- getNamespaces();
-
- getDefaultNamespace();
-
+ // complete setup
+ setupHandlers();
createNamespaceShortcuts();
-
createUpdateEditor();
-
createQueryEditor();
-
createExportOptions();
+ // restore last used namespace
loadLastNamespace();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-24 02:45:51
|
Revision: 8590
http://sourceforge.net/p/bigdata/code/8590
Author: tobycraig
Date: 2014-07-24 02:45:38 +0000 (Thu, 24 Jul 2014)
Log Message:
-----------
JSHint fixes
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-23 23:10:27 UTC (rev 8589)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 02:45:38 UTC (rev 8590)
@@ -1,9 +1,11 @@
$(function() {
+'use strict';
+
/* Global variables */
// LBS/non-LBS URL prefixes
-var RW_URL_PREFIX, RO_URL_PREFIX
+var RW_URL_PREFIX, RO_URL_PREFIX;
// query/update editors
var EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {};
@@ -36,7 +38,7 @@
'trix': 'trix',
//'xml': 'trix',
'ttl': 'turtle'
-};
+};
var RDF_CONTENT_TYPES = {
'n-quads': 'text/x-nquads',
'n-triples': 'text/plain',
@@ -98,18 +100,18 @@
// data export
var EXPORT_EXTENSIONS = {
- "application/rdf+xml": ['RDF/XML', 'rdf', true],
- "application/n-triples": ['N-Triples', 'nt', true],
- "application/x-turtle": ['Turtle', 'ttl', true],
- "text/rdf+n3": ['N3', 'n3', true],
- "application/trix": ['TriX', 'trix', true],
- "application/x-trig": ['TRIG', 'trig', true],
- "text/x-nquads": ['NQUADS', 'nq', true],
+ 'application/rdf+xml': ['RDF/XML', 'rdf', true],
+ 'application/n-triples': ['N-Triples', 'nt', true],
+ 'application/x-turtle': ['Turtle', 'ttl', true],
+ 'text/rdf+n3': ['N3', 'n3', true],
+ 'application/trix': ['TriX', 'trix', true],
+ 'application/x-trig': ['TRIG', 'trig', true],
+ 'text/x-nquads': ['NQUADS', 'nq', true],
- "text/csv": ['CSV', 'csv', false, exportCSV],
- "application/sparql-results+json": ['JSON', 'json', false, exportJSON],
- // "text/tab-separated-values": ['TSV', 'tsv', false, exportTSV],
- "application/sparql-results+xml": ['XML', 'xml', false, exportXML]
+ 'text/csv': ['CSV', 'csv', false, exportCSV],
+ 'application/sparql-results+json': ['JSON', 'json', false, exportJSON],
+ // 'text/tab-separated-values': ['TSV', 'tsv', false, exportTSV],
+ 'application/sparql-results+xml': ['XML', 'xml', false, exportXML]
};
@@ -117,7 +119,7 @@
function useLBS(state) {
// allows passing in of boolean, or firing on checkbox change
- if(typeof(state) != 'boolean') {
+ if(typeof state != 'boolean') {
state = this.checked;
}
if(state) {
@@ -152,7 +154,7 @@
if(!term) {
return;
}
- var query = 'select ?s ?p ?o { ?o bds:search "' + term + '" . ?s ?p ?o . }'
+ var query = 'select ?s ?p ?o { ?o bds:search "' + term + '" . ?s ?p ?o . }';
EDITORS.query.setValue(query);
$('#query-errors').hide();
$('#query-form').submit();
@@ -162,7 +164,7 @@
/* Tab selection */
-function clickTab(e) {
+function clickTab() {
showTab($(this).data('target'));
}
@@ -171,7 +173,7 @@
$('#' + tab + '-tab').show();
$('#tab-selector a').removeClass();
$('a[data-target=' + tab + ']').addClass('active');
- if(!nohash && window.location.hash.substring(1).indexOf(tab) != 0) {
+ if(!nohash && window.location.hash.substring(1).indexOf(tab) !== 0) {
window.location.hash = tab;
}
if(EDITORS[tab]) {
@@ -216,12 +218,11 @@
success: function(data) {
$('#namespaces-list').empty();
var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
- var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description')
- for(var i=0; i<namespaces.length; i++) {
- var title = namespaces[i].getElementsByTagName('title')[0].textContent;
- var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title;
- var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource');
- var use;
+ var namespaces = data.getElementsByTagNameNS(rdf, 'Description');
+ var i, title, titleText, use;
+ for(i=0; i<namespaces.length; i++) {
+ title = namespaces[i].getElementsByTagName('title')[0].textContent;
+ titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title;
if(title == NAMESPACE) {
use = 'In use';
} else {
@@ -250,7 +251,7 @@
cloneNamespace($(this).parents('tr').data('name'));
$('#namespace-create-errors').html('');
});
- $('.namespace-service-description').click(function(e) {
+ $('.namespace-service-description').click(function() {
return confirm('This can be an expensive operation. Proceed anyway?');
});
}
@@ -265,7 +266,7 @@
$('#current-namespace').html(name);
NAMESPACE = name;
getNamespaces();
- localStorage['lastNamespace'] = name;
+ localStorage.lastNamespace = name;
}
function deleteNamespace(namespace) {
@@ -277,7 +278,7 @@
if(confirm('Are you sure you want to delete the namespace ' + namespace + '?')) {
if(namespace == NAMESPACE) {
- // FIXME: what is the desired behaviour when deleting the current namespace?
+ useNamespace(DEFAULT_NAMESPACE);
}
var url = RW_URL_PREFIX + 'namespace/' + namespace;
var settings = {
@@ -343,11 +344,11 @@
}
function namespaceExists(name) {
- return $('#namespaces-list tr[data-name=' + name + ']').length != 0;
+ return $('#namespaces-list tr[data-name=' + name + ']').length !== 0;
}
function validateNamespaceOptions() {
- var errors = [];
+ var errors = [], i;
var name = $('#new-namespace-name').val().trim();
if(!name) {
errors.push('Enter a name');
@@ -359,10 +360,10 @@
errors.push('Inference is incompatible with quads mode');
}
$('#namespace-create-errors').html('');
- for(var i=0; i<errors.length; i++) {
+ for(i=0; i<errors.length; i++) {
$('#namespace-create-errors').append('<li>' + errors[i] + '</li>');
}
- return errors.length == 0;
+ return errors.length === 0;
}
function changeNamespaceMode() {
@@ -408,7 +409,7 @@
// TODO: allow for other options to be specified
var data = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">\n<properties>\n';
- for(key in NAMESPACE_PARAMS) {
+ for(var key in NAMESPACE_PARAMS) {
data += '<entry key="' + NAMESPACE_PARAMS[key] + '">' + params[key] + '</entry>\n';
}
data += '</properties>';
@@ -500,16 +501,16 @@
alert('File too large, enter local path to file');
EDITORS.update.setValue('/path/to/' + f.name);
setType('path');
- EDITORS.update.setOption('readOnly', false)
+ EDITORS.update.setOption('readOnly', false);
$('#large-file-message, #clear-file').hide();
} else {
var fr = new FileReader();
fr.onload = function(e) {
if(f.size > 10240) {
// do not use textarea
- EDITORS.update.setOption('readOnly', true)
+ EDITORS.update.setOption('readOnly', true);
$('#filename').html(f.name);
- $('#large-file-message, #clear-file').show()
+ $('#large-file-message, #clear-file').show();
EDITORS.update.setValue('');
FILE_CONTENTS = e.target.result;
} else {
@@ -527,8 +528,8 @@
if(e) {
e.preventDefault();
}
- $('#update-box').prop('disabled', false)
- $('#large-file-message, #clear-file').hide()
+ $('#update-box').prop('disabled', false);
+ $('#large-file-message, #clear-file').hide();
FILE_CONTENTS = null;
}
@@ -574,7 +575,7 @@
function handlePaste(e) {
// if the input is currently empty, try to identify the pasted content
var that = this;
- if(this.value == '') {
+ if(this.value === '') {
setTimeout(function() { setType(identify(that.value, true)); }, 10);
}
}
@@ -627,17 +628,17 @@
try {
e.preventDefault();
- } catch(e) {}
+ } catch(ex) {}
$('#update-response').show();
var url = RW_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql';
var settings = {
type: 'POST',
- data: FILE_CONTENTS == null ? EDITORS.update.getValue() : FILE_CONTENTS,
+ data: FILE_CONTENTS === null ? EDITORS.update.getValue() : FILE_CONTENTS,
success: updateResponseXML,
error: updateResponseError
- }
+ };
// determine action based on type
switch($('#update-type').val()) {
@@ -650,7 +651,7 @@
.append($('<input name="update">').val(settings.data))
.append('<input name="monitor" value="true">');
if($('#update-analytic').is(':checked')) {
- form.append('<input name="analytic" value="true">')
+ form.append('<input name="analytic" value="true">');
}
form.appendTo($('body'));
form.submit();
@@ -706,8 +707,8 @@
}
function updateResponseXML(data) {
- var modified = data.childNodes[0].attributes['modified'].value;
- var milliseconds = data.childNodes[0].attributes['milliseconds'].value;
+ var modified = data.childNodes[0].attributes.modified.value;
+ var milliseconds = data.childNodes[0].attributes.milliseconds.value;
$('#update-response, #update-clear-container').show();
$('#update-response iframe').attr('src', 'about:blank').hide();
$('#update-response pre').text('Modified: ' + modified + '\nMilliseconds: ' + milliseconds);
@@ -757,7 +758,7 @@
function deleteHistoryRow(e) {
e.preventDefault();
$(this).parents('tr').remove();
- if($('#query-history tbody tr').length == 0) {
+ if($('#query-history tbody tr').length === 0) {
$('#query-history').hide();
}
}
@@ -765,14 +766,14 @@
function submitQuery(e) {
try {
e.preventDefault();
- } catch(e) {}
+ } catch(ex) {}
// transfer CodeMirror content to textarea
EDITORS.query.save();
// do nothing if query is empty
var query = $('#query-box').val();
- if(query.trim() == '') {
+ if(query.trim() === '') {
return;
}
@@ -802,7 +803,7 @@
a.html(a.html().replace(/\n/g, '<br>'));
row.append('<td class="query-results">...</td>');
row.append('<td class="query-execution-time">...</td>');
- row.append('<td class="query-delete"><a href="#">X</a></td>')
+ row.append('<td class="query-delete"><a href="#">X</a></td>');
}
$('#query-history').show();
@@ -814,7 +815,7 @@
headers: { 'Accept': 'application/sparql-results+json, application/rdf+xml' },
success: showQueryResults,
error: queryResultsError
- }
+ };
$('#query-response').show().html('Query running...');
$('#query-pagination').hide();
@@ -864,7 +865,7 @@
function queryExport() {
var dataType = $('#export-format').val();
var filename = $('#export-filename').val();
- if(filename == '') {
+ if(filename === '') {
filename = 'export';
}
filename += '.' + EXPORT_EXTENSIONS[dataType][1];
@@ -984,14 +985,15 @@
$('#query-export-rdf').hide();
$('#query-response, #query-pagination, #query-export-container').show();
var table = $('<table>').appendTo($('#query-response'));
+ var i, tr;
if(this.dataTypes[1] == 'xml') {
// RDF
table.append($('<thead><tr><td>s</td><td>p</td><td>o</td></tr></thead>'));
var rows = $(data).find('Description');
- for(var i=0; i<rows.length; i++) {
+ for(i=0; i<rows.length; i++) {
// FIXME: are about and nodeID the only possible attributes here?
var s = rows[i].attributes['rdf:about'];
- if(typeof(s) == 'undefined') {
+ if(typeof s == 'undefined') {
s = rows[i].attributes['rdf:nodeID'];
}
s = s.textContent;
@@ -999,12 +1001,12 @@
var p = rows[i].children[j].tagName;
var o = rows[i].children[j].attributes['rdf:resource'];
// FIXME: is this the correct behaviour?
- if(typeof(o) == 'undefined') {
+ if(typeof o == 'undefined') {
o = rows[i].children[j].textContent;
} else {
o = o.textContent;
}
- var tr = $('<tr><td>' + (j == 0 ? s : '') + '</td><td>' + p + '</td><td>' + o + '</td>');
+ tr = $('<tr><td>' + (j === 0 ? s : '') + '</td><td>' + p + '</td><td>' + o + '</td>');
table.append(tr);
}
}
@@ -1014,7 +1016,7 @@
// save data for export and pagination
QUERY_RESULTS = data;
- if(typeof(data.boolean) != 'undefined') {
+ if(typeof data.boolean != 'undefined') {
// ASK query
table.append('<tr><td>' + data.boolean + '</td></tr>').addClass('boolean');
updateResultCountAndExecutionTime('' + data.boolean);
@@ -1027,7 +1029,7 @@
isRDF = true;
} else if(data.head.vars.length == 4 && data.head.vars[0] == 's' && data.head.vars[1] == 'p' && data.head.vars[2] == 'o' && data.head.vars[3] == 'c') {
// see if c is used or not
- for(var i=0; i<data.results.bindings.length; i++) {
+ for(i=0; i<data.results.bindings.length; i++) {
if('c' in data.results.bindings[i]) {
isRDF = false;
break;
@@ -1051,8 +1053,8 @@
// put query variables in table header
var thead = $('<thead>').appendTo(table);
- var tr = $('<tr>');
- for(var i=0; i<data.head.vars.length; i++) {
+ tr = $('<tr>');
+ for(i=0; i<data.head.vars.length; i++) {
tr.append('<th>' + data.head.vars[i] + '</th>');
}
thead.append(tr);
@@ -1130,7 +1132,7 @@
n = QUERY_RESULTS.results.bindings.length;
} else {
n = parseInt(n, 10);
- if(typeof n != 'number' || n % 1 != 0 || n < 1 || n == PAGE_SIZE) {
+ if(typeof n != 'number' || n % 1 !== 0 || n < 1 || n === PAGE_SIZE) {
return;
}
}
@@ -1144,7 +1146,7 @@
function handlePageSelector(e) {
if(e.which == 13) {
var n = parseInt(this.value, 10);
- if(typeof n != 'number' || n % 1 != 0 || n < 1 || n > TOTAL_PAGES) {
+ if(typeof n != 'number' || n % 1 !== 0 || n < 1 || n > TOTAL_PAGES) {
this.value = CURRENT_PAGE;
} else {
showPage(n);
@@ -1153,7 +1155,7 @@
}
function showPage(n) {
- if(typeof n != 'number' || n % 1 != 0 || n < 1 || n > TOTAL_PAGES) {
+ if(typeof n != 'number' || n % 1 !== 0 || n < 1 || n > TOTAL_PAGES) {
return;
}
@@ -1168,27 +1170,28 @@
// add matching bindings
var table = $('#query-response table');
+ var text, tdData;
for(var i=start; i<end; i++) {
var tr = $('<tr>');
for(var j=0; j<QUERY_RESULTS.head.vars.length; j++) {
if(QUERY_RESULTS.head.vars[j] in QUERY_RESULTS.results.bindings[i]) {
var binding = QUERY_RESULTS.results.bindings[i][QUERY_RESULTS.head.vars[j]];
if(binding.type == 'sid') {
- var text = getSID(binding);
+ text = getSID(binding);
} else {
- var text = binding.value;
+ text = binding.value;
if(binding.type == 'uri') {
text = abbreviate(text);
}
}
linkText = escapeHTML(text).replace(/\n/g, '<br>');
if(binding.type == 'typed-literal') {
- var tdData = ' class="literal" data-datatype="' + binding.datatype + '"';
+ tdData = ' class="literal" data-datatype="' + binding.datatype + '"';
} else {
if(binding.type == 'uri' || binding.type == 'sid') {
text = '<a href="' + buildExploreHash(text) + '">' + linkText + '</a>';
}
- var tdData = ' class="' + binding.type + '"';
+ tdData = ' class="' + binding.type + '"';
if(binding['xml:lang']) {
tdData += ' data-lang="' + binding['xml:lang'] + '"';
}
@@ -1259,6 +1262,7 @@
var re = /<< *([^ ]+) +([^ ]+) +([^ ]+) *>>/;
var vertex = !target.match(re);
+ // jshint multistr:true
var vertexQuery = '\
select ?col1 ?col2 ?incoming (count(?star) as ?star) {\n\
bind (URI as ?explore ) .\n\
@@ -1303,10 +1307,11 @@
}\n\
group by ?col1 ?col2 ?incoming';
+ var query;
if(vertex) {
- var query = vertexQuery.replace('URI', target);
+ query = vertexQuery.replace('URI', target);
} else {
- var query = edgeQuery.replace('SID', target);
+ query = edgeQuery.replace('SID', target);
}
var settings = {
type: 'POST',
@@ -1329,10 +1334,11 @@
// go through each binding, adding it to the appropriate table
$.each(data.results.bindings, function(i, binding) {
var cols = [binding.col1, binding.col2].map(function(col) {
+ var uri;
if(col.type == 'sid') {
- var uri = getSID(col);
+ uri = getSID(col);
} else {
- var uri = col.value;
+ uri = col.value;
if(col.type == 'uri') {
uri = abbreviate(uri);
}
@@ -1345,10 +1351,11 @@
});
var star = parseInt(binding.star.value);
if(star > 0) {
+ var sid;
if(binding.incoming.value == 'true') {
- var sid = '<< <' + binding.col1.value + '> <' + binding.col2.value + '> ' + $('#explore-form input[type=text]').val() + ' >>';
+ sid = '<< <' + binding.col1.value + '> <' + binding.col2.value + '> ' + $('#explore-form input[type=text]').val() + ' >>';
} else {
- var sid = '<< ' + $('#explore-form input[type=text]').val() + ' <' + binding.col1.value + '> <' + binding.col2.value + '> >>';
+ sid = '<< ' + $('#explore-form input[type=text]').val() + ' <' + binding.col1.value + '> <' + binding.col2.value + '> >>';
}
star = '<a href="' + buildExploreHash(sid) + '"><< * (' + star + ') >></a>';
} else {
@@ -1372,7 +1379,7 @@
var sections = {incoming: 'Incoming Links', outgoing: 'Outgoing Links', attributes: 'Attributes'};
for(var k in sections) {
var id = '#explore-' + k;
- if($(id + ' table tr').length == 0) {
+ if($(id + ' table tr').length === 0) {
$(id).html('No ' + sections[k]);
} else {
$(id).prepend('<h1>' + sections[k] + '</h1>');
@@ -1480,10 +1487,11 @@
var sparqlContainer = form.next().next();
var sparql = sparqlContainer.html();
+ var queryDetails;
if(details) {
- var queryDetails = $('<div>').append(sparqlContainer.nextUntil('h1')).html();
+ queryDetails = $('<div>').append(sparqlContainer.nextUntil('h1')).html();
} else {
- var queryDetails = '<a href="#">Details</a>';
+ queryDetails = '<a href="#">Details</a>';
}
// got all data, create a li for each query
@@ -1567,7 +1575,7 @@
container.addClass('box health-' + health);
container.appendTo($('#health-services'));
}
- })
+ });
}
function showHealthTab() {
@@ -1589,7 +1597,7 @@
/* Performance */
function loadPerformance(path) {
- if(typeof(path) == 'undefined') {
+ if(typeof path == 'undefined') {
path = '';
}
$.get(RO_URL_PREFIX + 'counters?' + path, function(data) {
@@ -1604,13 +1612,13 @@
/* Utility functions */
function getSID(binding) {
- return '<<\n ' + abbreviate(binding.value['s'].value) + '\n ' + abbreviate(binding.value['p'].value) + '\n ' + abbreviate(binding.value['o'].value) + '\n>>';
+ return '<<\n ' + abbreviate(binding.value.s.value) + '\n ' + abbreviate(binding.value.p.value) + '\n ' + abbreviate(binding.value.o.value) + '\n>>';
}
function abbreviate(uri) {
for(var nsGroup in NAMESPACE_SHORTCUTS) {
for(var ns in NAMESPACE_SHORTCUTS[nsGroup]) {
- if(uri.indexOf(NAMESPACE_SHORTCUTS[nsGroup][ns]) == 0) {
+ if(uri.indexOf(NAMESPACE_SHORTCUTS[nsGroup][ns]) === 0) {
return uri.replace(NAMESPACE_SHORTCUTS[nsGroup][ns], ns + ':');
}
}
@@ -1657,8 +1665,8 @@
/* Local storage functions */
function loadLastNamespace() {
- if(localStorage['lastNamespace'] && namespaceExists(localStorage['lastNamespace'])) {
- useNamespace(localStorage['lastNamespace']);
+ if(localStorage.lastNamespace && namespaceExists(localStorage.lastNamespace)) {
+ useNamespace(localStorage.lastNamespace);
} else {
// no previously selected namespace, or it doesn't exist - use the default
useNamespace(DEFAULT_NAMESPACE);
@@ -1670,6 +1678,7 @@
function setupHandlers() {
// debug to access closure variables
+ // jshint debug:true
$('html, textarea, select').bind('keydown', 'ctrl+d', function() { debugger; });
$('.use-lbs').change(useLBS);
@@ -1707,7 +1716,7 @@
$('#query-explain').change(handleExplain);
$('#query-details').change(handleDetails);
$('#query-history').on('click', '.query a', loadHistory);
- $('#query-history').on('click', '.query-delete a', deleteHistoryRow)
+ $('#query-history').on('click', '.query-delete a', deleteHistoryRow);
$('#query-response-clear').click(clearQueryResponse);
$('#query-export').click(showQueryExportModal);
$('#query-download').click(queryExport);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-24 05:53:54
|
Revision: 8591
http://sourceforge.net/p/bigdata/code/8591
Author: tobycraig
Date: 2014-07-24 05:53:45 +0000 (Thu, 24 Jul 2014)
Log Message:
-----------
Fixed missing variable declaration
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 02:45:38 UTC (rev 8590)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 05:53:45 UTC (rev 8591)
@@ -1654,7 +1654,7 @@
// It is used to get around CodeMirror updating the default config object
// passed to it with the values used, which are then applied to later uses
// of the default config object.
- dest = {};
+ var dest = {};
for(var key in src) {
dest[key] = src[key];
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tob...@us...> - 2014-07-24 23:36:37
|
Revision: 8592
http://sourceforge.net/p/bigdata/code/8592
Author: tobycraig
Date: 2014-07-24 23:36:30 +0000 (Thu, 24 Jul 2014)
Log Message:
-----------
Added load last explored URI upon startup
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 05:53:45 UTC (rev 8591)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-24 23:36:30 UTC (rev 8592)
@@ -259,14 +259,18 @@
$.ajax(settings);
}
-function useNamespace(name) {
- if(!namespaceExists(name)) {
+function useNamespace(name, leaveLast) {
+ if(!namespaceExists(name) || name === NAMESPACE) {
return;
}
$('#current-namespace').html(name);
NAMESPACE = name;
getNamespaces();
- localStorage.lastNamespace = name;
+ // this is for loading the last explored URI, which might otherwise
+ // overwrite the last used namespace
+ if(!leaveLast) {
+ localStorage.lastNamespace = name;
+ }
}
function deleteNamespace(namespace) {
@@ -1067,7 +1071,7 @@
$('#query-response a').click(function(e) {
e.preventDefault();
- explore(this.textContent);
+ explore(NAMESPACE, this.textContent);
});
}
}
@@ -1170,7 +1174,7 @@
// add matching bindings
var table = $('#query-response table');
- var text, tdData;
+ var text, tdData, linkText;
for(var i=start; i<end; i++) {
var tr = $('<tr>');
for(var j=0; j<QUERY_RESULTS.head.vars.length; j++) {
@@ -1389,22 +1393,22 @@
$('#explore-results a').click(function(e) {
e.preventDefault();
var components = parseHash(this.hash);
- exploreNamespacedURI(components[2], components[3]);
+ explore(components[2], components[3]);
});
}
-function exploreNamespacedURI(namespace, uri, nopush) {
- useNamespace(namespace);
- explore(uri, nopush);
-}
-
-function explore(uri, nopush) {
+function explore(namespace, uri, noPush, loadLast) {
+ useNamespace(namespace, loadLast);
$('#explore-form input[type=text]').val(uri);
$('#explore-form').submit();
- showTab('explore', true);
- if(!nopush) {
+ if(!loadLast) {
+ showTab('explore', true);
+ }
+ if(!noPush) {
history.pushState(null, null, '#explore:' + NAMESPACE + ':' + uri);
}
+ localStorage.lastExploreNamespace = namespace;
+ localStorage.lastExploreURI = uri;
}
function parseHash(hash) {
@@ -1420,8 +1424,8 @@
if(!hash) {
$('#tab-selector a:first').click();
} else {
- if(hash[1] == 'explore') {
- exploreNamespacedURI(hash[2], hash[3], true);
+ if(hash[1] == 'explore' && typeof hash[2] !== 'undefined') {
+ explore(hash[2], hash[3], true);
} else {
$('a[data-target=' + hash[1] + ']').click();
}
@@ -1673,7 +1677,13 @@
}
}
+function loadLastExplore() {
+ if(localStorage.lastExploreURI) {
+ explore(localStorage.lastExploreNamespace, localStorage.lastExploreURI, true, true);
+ }
+}
+
/* Startup functions */
function setupHandlers() {
@@ -1749,7 +1759,8 @@
createQueryEditor();
createExportOptions();
- // restore last used namespace
+ // restore last used namespace and explored URI
+ loadLastExplore();
loadLastNamespace();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|