cluster_search_ui/commit
Pengine server now relative variable.
author | Chris Dijkshoorn |
---|---|
Mon Dec 22 16:45:49 2014 +0100 | |
committer | Chris Dijkshoorn |
Mon Dec 22 16:45:49 2014 +0100 | |
commit | d17a1e0931f9b0b0cf5ef15242711fd22400397f |
tree | 0ca39243050a87dc92f3095f85be8754445fe983 |
parent | 5972776150a10c0af7fb727d6df89cf275db02ae |
Diff style: patch stat
diff --git a/web/js/result.js b/web/js/result.js index c69ff82..60a428c 100644 --- a/web/js/result.js +++ b/web/js/result.js @@ -5,6 +5,15 @@ displayOptions = { showAnnotations: true, } +itemServer = { + location: getServerItemUrl() +} + +function getServerItemUrl() { + var urlParts = document.location.href.split("item"); + return urlParts[0]; +} + function showResult(uri) { metadata(uri); annotations(uri); @@ -12,7 +21,8 @@ function showResult(uri) { function metadata(uri) { // Get metadata from server - new Pengine({application: 'enrichment', + new Pengine({server: itemServer.location + 'pengine', + application: 'enrichment', ask: 'metadata(' + Pengine.stringify(uri, {string:'atom'}) + ', Metadata),!', onsuccess: function () { $("#metadata").append(metadataWell(this.data, uri)); @@ -43,10 +53,11 @@ function metadataWell(data, uri) { function annotations(uri) { // Get metadata from server - new Pengine({application: 'enrichment', + var pengineServer = itemServer.location + 'pengine'; + new Pengine({server: pengineServer, + application: 'enrichment', ask: 'object_annotations(' + Pengine.stringify(uri, {string:'atom'}) + ', Annotations),!', onsuccess: function () { - console.log('The annotations', annotations); if(this.data[0].Annotations.annotations > 0) $("#metadata").append(annotationWell(this.data)); } diff --git a/web/js/search.js b/web/js/search.js index 71e2aab..aeb330c 100644 --- a/web/js/search.js +++ b/web/js/search.js @@ -9,6 +9,15 @@ displayOptions = { imageFilter: 'allObjects' } +server = { + location: getServerUrl() +} + +function getServerUrl() { + var urlParts = document.location.href.split("results"); + return urlParts[0]; +} + function search(keyword) { query = keyword; $(document).prop('title', 'Searching for ' + query); @@ -111,9 +120,11 @@ function addPath(clusterId) { // Generate HTML cluster path var pathUris = initialClusters[clusterId].path; var pathElements = $.el.h4(); + var serverUrl = getServerUrl(); // Get labels from server - new Pengine({application: 'enrichment', + new Pengine({server: server.location + 'pengine', + application: 'enrichment', ask: 'maplist(uri_label,' + Pengine.stringify(pathUris, {string:'atom'}) + ', Labels),!', onsuccess: function () { var path = []; @@ -166,7 +177,8 @@ function addItems(clusterId) { itemUris[i] = items[i].uri; // Get item enrichments from server, on success add pagination and thumbnails - new Pengine({application: 'enrichment', + new Pengine({server: server.location + 'pengine', + application: 'enrichment', ask: 'maplist(enrich_item,' + Pengine.stringify(itemUris, {string:'atom'}) + ', Items),!', onsuccess: function () { processEnrichment(this.data, clusterId);