|
From: <tob...@us...> - 2014-06-03 23:26:49
|
Revision: 8443
http://sourceforge.net/p/bigdata/code/8443
Author: tobycraig
Date: 2014-06-03 23:26:41 +0000 (Tue, 03 Jun 2014)
Log Message:
-----------
#938 - Added LBS support to workbench
Modified Paths:
--------------
branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js
Modified: branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js 2014-06-03 14:58:09 UTC (rev 8442)
+++ branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js 2014-06-03 23:26:41 UTC (rev 8443)
@@ -1,7 +1,8 @@
$(function() {
// global variables
-var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACE_URL, NAMESPACES_READY, NAMESPACE_SHORTCUTS, FILE_CONTENTS, QUERY_RESULTS;
+var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACES_READY, NAMESPACE_SHORTCUTS, FILE_CONTENTS, QUERY_RESULTS;
+var RW_URL_PREFIX = '/bigdata/LBS/leader/', RO_URL_PREFIX = '/bigdata/LBS/read/';
var CODEMIRROR_DEFAULTS, EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {};
var PAGE_SIZE = 50, TOTAL_PAGES, CURRENT_PAGE;
var NAMESPACE_PARAMS = {
@@ -100,7 +101,7 @@
/* Namespaces */
function getNamespaces() {
- $.get('/bigdata/namespace?describe-each-named-graph=false', function(data) {
+ $.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')
@@ -114,11 +115,11 @@
} else {
use = '<a href="#" class="use-namespace">Use</a>';
}
- $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a> - <a href="#" class="namespace-properties">Properties</a> (Download <a href="/bigdata/namespace/' + title + '/properties" download="' + title + '.xml">XML</a>/<a href="#" class="namespace-properties-java">Java</a>) - <a href="#" class="clone-namespace">Clone</a> - <a href="/bigdata/namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></li>');
+ $('#namespaces-list').append('<li data-name="' + title + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a> - <a href="#" class="namespace-properties">Properties</a> - <a href="' + RO_URL_PREFIX + 'namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></li>');
}
$('.use-namespace').click(function(e) {
e.preventDefault();
- useNamespace($(this).parent().data('name'), $(this).parent().data('url'));
+ useNamespace($(this).parent().data('name'));
});
$('.delete-namespace').click(function(e) {
e.preventDefault();
@@ -152,10 +153,9 @@
}
}
-function useNamespace(name, url) {
+function useNamespace(name) {
$('#current-namespace').html(name);
NAMESPACE = name;
- NAMESPACE_URL = url;
getNamespaces();
}
@@ -170,7 +170,7 @@
if(namespace == NAMESPACE) {
// FIXME: what is the desired behaviour when deleting the current namespace?
}
- var url = '/bigdata/namespace/' + namespace;
+ var url = RW_URL_PREFIX + 'namespace/' + namespace;
var settings = {
type: 'DELETE',
success: getNamespaces,
@@ -181,7 +181,7 @@
}
function getNamespaceProperties(namespace, download) {
- var url = '/bigdata/namespace/' + namespace + '/properties';
+ var url = RO_URL_PREFIX + 'namespace/' + namespace + '/properties';
if(!download) {
$('#namespace-properties h1').html(namespace);
$('#namespace-properties table').empty();
@@ -203,7 +203,7 @@
}
function cloneNamespace(namespace) {
- var url = '/bigdata/namespace/' + namespace + '/properties';
+ var url = RO_URL_PREFIX + 'namespace/' + namespace + '/properties';
$.get(url, function(data) {
var reversed_params = {};
for(var key in NAMESPACE_PARAMS) {
@@ -247,17 +247,17 @@
success: function() { $('#new-namespace-name').val(''); getNamespaces(); },
error: function(jqXHR, textStatus, errorThrown) { debugger;alert(jqXHR.responseText); }
};
- $.ajax('/bigdata/namespace', settings);
+ $.ajax(RW_URL_PREFIX + 'namespace', settings);
}
$('#namespace-create').submit(createNamespace);
function getDefaultNamespace() {
- $.get('/bigdata/namespace?describe-each-named-graph=false&describe-default-namespace=true', function(data) {
+ $.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;
var url = defaultDataset.find('sparqlEndpoint')[0].attributes['rdf:resource'].textContent;
- useNamespace(DEFAULT_NAMESPACE, url);
+ useNamespace(DEFAULT_NAMESPACE);
});
}
@@ -514,6 +514,7 @@
$('#update-response').show();
+ var url = RW_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql';
var settings = {
type: 'POST',
data: FILE_CONTENTS == null ? EDITORS.update.getValue() : FILE_CONTENTS,
@@ -528,7 +529,7 @@
if($('#update-monitor').is(':checked')) {
// create form and submit it, sending output to the iframe
var form = $('<form method="POST" target="update-response-container">')
- .attr('action', NAMESPACE_URL)
+ .attr('action', url)
.append($('<input name="update">').val(settings.data))
.append('<input name="monitor" value="true">');
if($('#update-analytic').is(':checked')) {
@@ -564,7 +565,7 @@
$('#update-response pre').show().html('Data loading...');
- $.ajax(NAMESPACE_URL, settings);
+ $.ajax(url, settings);
}
$('#update-clear').click(function() {
@@ -639,6 +640,7 @@
return;
}
+ var url = RO_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql';
var settings = {
type: 'POST',
data: $('#query-form').serialize(),
@@ -650,7 +652,7 @@
$('#query-response').show().html('Query running...');
$('#query-pagination').hide();
- $.ajax(NAMESPACE_URL, settings);
+ $.ajax(url, settings);
$('#query-explanation').empty();
if($('#query-explain').is(':checked')) {
@@ -661,7 +663,7 @@
success: showQueryExplanation,
error: queryResultsError
};
- $.ajax(NAMESPACE_URL, settings);
+ $.ajax(url, settings);
} else {
$('#query-explanation').hide();
}
@@ -719,7 +721,7 @@
success: function() { downloadFile(data, dataType, filename); },
error: downloadRDFError
};
- $.ajax('/bigdata/sparql?workbench&convert', settings);
+ $.ajax(RO_URL_PREFIX + 'sparql?workbench&convert', settings);
} else {
// not RDF
export_extensions[dataType][3](filename);
@@ -1100,7 +1102,7 @@
success: updateExploreStart,
error: updateExploreError
};
- $.ajax(NAMESPACE_URL, settings);
+ $.ajax(RO_URL_PREFIX + 'namespace/' + NAMESPACE + '/sparql', settings);
}
function updateExploreStart(data) {
@@ -1227,7 +1229,7 @@
if(e) {
e.preventDefault();
}
- $.get('/bigdata/status', function(data) {
+ $.get(RO_URL_PREFIX + 'status', function(data) {
// get data inside a jQuery object
data = $('<div>').append(data);
getStatusNumbers(data);
@@ -1251,7 +1253,7 @@
});
function showQueries(details) {
- var url = '/bigdata/status?showQueries';
+ var url = RO_URL_PREFIX + 'status?showQueries';
if(details) {
url += '=details';
}
@@ -1303,7 +1305,7 @@
e.preventDefault();
if(confirm('Cancel query?')) {
var id = $(this).data('queryId');
- $.post('/bigdata/status?cancelQuery&queryId=' + id, function() { getStatus(); });
+ $.post(RW_URL_PREFIX + 'status?cancelQuery&queryId=' + id, function() { getStatus(); });
$(this).parents('li').remove();
}
}
@@ -1311,7 +1313,7 @@
function getQueryDetails(e) {
e.preventDefault();
var id = $(this).data('queryId');
- $.ajax({url: '/bigdata/status?showQueries=details&queryId=' + id,
+ $.ajax({url: RO_URL_PREFIX + 'status?showQueries=details&queryId=' + id,
success: function(data) {
// get data inside a jQuery object
data = $('<div>').append(data);
@@ -1332,7 +1334,7 @@
/* Performance */
$('#tab-selector a[data-target=performance]').click(function(e) {
- $.get('/bigdata/counters', function(data) {
+ $.get(RO_URL_PREFIX + 'counters', function(data) {
$('#performance-tab .box').html(data);
});
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|