diff --git a/html/admin/js/graphViewer/graph/arangoAdapter.js b/html/admin/js/graphViewer/graph/arangoAdapter.js index ff2bfdd32f..00fe1fb8af 100644 --- a/html/admin/js/graphViewer/graph/arangoAdapter.js +++ b/html/admin/js/graphViewer/graph/arangoAdapter.js @@ -34,6 +34,7 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w initialX = {}, initialY = {}, api = {}, + queries = {}, findNode = function(id) { var res = $.grep(nodes, function(e){ @@ -156,8 +157,15 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w }, - sendQuery = function(query, onSuccess) { - var data = {query: query}; + sendQuery = function(query, bindVars, onSuccess) { + if (query !== queries.connectedEdges) { + bindVars["@nodes"] = nodeCollection; + } + bindVars["@edges"] = edgeCollection; + var data = { + query: query, + bindVars: bindVars + }; $.ajax({ type: "POST", url: api.cursor, @@ -234,11 +242,9 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w }, permanentlyRemoveEdgesOfNode = function (nodeId) { - var query = "FOR e IN " + edgeCollection - + " FILTER e._to == " + JSON.stringify(nodeId) - + " || e._from == " + JSON.stringify(nodeId) - + " RETURN e"; - sendQuery(query, function(res) { + sendQuery(queries.connectedEdges, { + id: nodeId + }, function(res) { _.each(res, self.deleteEdge); }); }; @@ -252,6 +258,50 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w api.node = api.base + "document?collection=" + nodeCollection; api.edge = api.base + "edge?collection=" + edgeCollection; + queries.nodeById = "FOR n IN @@nodes" + + " FILTER n._id == @id" + + " LET links = (" + + " FOR l IN @@edges" + + " FILTER n._id == l._from" + + " FOR t IN @@nodes" + + " FILTER t._id == l._to" + + " RETURN t._id" + + " )" + + " RETURN MERGE(n, {\"children\" : links})"; + queries.traversalById = "RETURN TRAVERSAL(" + + "@@nodes, " + + "@@edges, " + + "@id, " + + "\"outbound\", {" + + "strategy: \"depthfirst\"," + + "maxDepth: 1," + + "paths: true" + + "})"; + queries.traversalByAttribute = function(attr) { + return "FOR n IN @@nodes " + + " FILTER n." + attr + + " == @value" + + " RETURN TRAVERSAL(" + + "@@nodes, " + + "@@edges, " + + "n._id, " + + "\"outbound\", {" + + "strategy: \"depthfirst\"," + + "maxDepth: 1," + + "paths: true" + + "})"; + }; + queries.childrenCentrality = "FOR u IN @@nodes" + + " FILTER u._id == @id" + + " LET g = (" + + " FOR l in @@edges" + + " FILTER l._from == u._id" + + " RETURN 1 )" + + " RETURN length(g)"; + queries.connectedEdges = "FOR e IN @@edges" + + " FILTER e._to == @id" + + " || e._from == @id" + + " RETURN e"; initialX.range = width / 2; initialX.start = width / 4; @@ -266,65 +316,33 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w }; self.oldLoadNodeFromTreeById = function(nodeId, callback) { - var loadNodeQuery = - "FOR n IN " + nodeCollection - + " FILTER n._id == " + JSON.stringify(nodeId) - + " LET links = (" - + " FOR l IN " + edgeCollection - + " FILTER n._id == l._from" - + " FOR t IN " + nodeCollection - + " FILTER t._id == l._to" - + " RETURN t._id" - + " )" - + " RETURN MERGE(n, {\"children\" : links})"; - sendQuery(loadNodeQuery, function(res) { + sendQuery(queries.nodeById, { + id: nodeId + }, function(res) { parseResultOfQuery(res, callback); }); }; self.loadNodeFromTreeById = function(nodeId, callback) { - var traversal = "RETURN TRAVERSAL(" - + nodeCollection + ", " - + edgeCollection + ", " - + "\"" + nodeId + "\", " - + "\"outbound\", {" - + "strategy: \"depthfirst\"," - + "maxDepth: 1," - + "paths: true" - + "})"; - sendQuery(traversal, function(res) { + sendQuery(queries.traversalById, { + id: nodeId + }, function(res) { parseResultOfTraversal(res, callback); }); }; self.loadNodeFromTreeByAttributeValue = function(attribute, value, callback) { - var traversal = "FOR n in " - + nodeCollection - + " FILTER n." + attribute - + " == " + JSON.stringify(value) - + " RETURN TRAVERSAL(" - + nodeCollection + ", " - + edgeCollection + ", " - + "n._id, " - + "\"outbound\", {" - + "strategy: \"depthfirst\"," - + "maxDepth: 1," - + "paths: true" - + "})"; - sendQuery(traversal, function(res) { + sendQuery(queries.traversalByAttribute(attribute), { + value: value + }, function(res) { parseResultOfTraversal(res, callback); }); }; self.requestCentralityChildren = function(nodeId, callback) { - var requestChildren = "for u in " + nodeCollection - + " filter u._id == " + JSON.stringify(nodeId) - + " let g = (" - + " for l in " + edgeCollection - + " filter l._from == u._id" - + " return 1 )" - + " return length(g)"; - sendQuery(requestChildren, function(res) { + sendQuery(queries.childrenCentrality,{ + id: nodeId + }, function(res) { callback(res[0]); }); }; @@ -447,5 +465,11 @@ function ArangoAdapter(arangodb, nodes, edges, nodeCollection, edgeCollection, w }); }; + self.changeTo = function (nodesCol, edgesCol ) { + nodeCollection = nodesCol; + edgeCollection = edgesCol; + api.node = api.base + "document?collection=" + nodeCollection; + api.edge = api.base + "edge?collection=" + edgeCollection; + }; } \ No newline at end of file diff --git a/html/admin/js/graphViewer/graph/edgeShaper.js b/html/admin/js/graphViewer/graph/edgeShaper.js index 5d3a116b7d..3e7d7dff37 100644 --- a/html/admin/js/graphViewer/graph/edgeShaper.js +++ b/html/admin/js/graphViewer/graph/edgeShaper.js @@ -213,7 +213,8 @@ function EdgeShaper(parent, flags, idfunc) { .attr("text-anchor", "middle") // Define text-anchor .attr("stroke", "black") .text(function(d) { - return d[label] !== undefined ? d[label] : ""; // Which value should be used as label + // Which value should be used as label + return d._data[label] !== undefined ? d._data[label] : ""; }); }; } @@ -274,7 +275,7 @@ function EdgeShaper(parent, flags, idfunc) { case "attribute": addColor = function (line, g) { g.attr("stroke", function(e) { - return colourMapper.getColour(e[color.key]); + return colourMapper.getColour(e._data[color.key]); }); }; break; diff --git a/html/admin/js/graphViewer/graph/nodeShaper.js b/html/admin/js/graphViewer/graph/nodeShaper.js index ddf3b3106e..46c24bd157 100644 --- a/html/admin/js/graphViewer/graph/nodeShaper.js +++ b/html/admin/js/graphViewer/graph/nodeShaper.js @@ -204,7 +204,7 @@ function NodeShaper(parent, flags, idfunc) { .attr("fill", "black") .attr("stroke", "black") .text(function(d) { - return d[label] !== undefined ? d[label] : ""; // Which value should be used as label + return d._data[label] !== undefined ? d._data[label] : ""; }); }; } diff --git a/html/admin/js/graphViewer/jasmine_test/runnerArangoAdapter.html b/html/admin/js/graphViewer/jasmine_test/runnerArangoAdapter.html index 2ff8107728..087559bd42 100644 --- a/html/admin/js/graphViewer/jasmine_test/runnerArangoAdapter.html +++ b/html/admin/js/graphViewer/jasmine_test/runnerArangoAdapter.html @@ -6,6 +6,7 @@ + @@ -14,16 +15,21 @@ + + + + + diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js index a0a25ed768..d67581720e 100644 --- a/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js @@ -48,8 +48,12 @@ arangodb, nodesCollection, nodesCollId, + altNodesCollection, + altNodesCollId, edgesCollection, edgesCollId, + altEdgesCollection, + altEdgesCollId, callbackCheck, checkCallbackFunction = function() { callbackCheck = true; @@ -182,6 +186,8 @@ try { dropCollection(nodesCollection); dropCollection(edgesCollection); + dropCollection(altNodesCollection); + dropCollection(altEdgesCollection); }catch(e){ } @@ -190,11 +196,17 @@ setupArangoContent = function() { nodesCollection = "TestNodes321"; edgesCollection = "TestEdges321"; + altNodesCollection = "TestNodes654"; + altEdgesCollection = "TestEdges654"; + deleteArangoContent(); createCollection(nodesCollection, "Document", function(id) {nodesCollId = id;}); createCollection(edgesCollection, "Edge", function(id) {edgesCollId = id;}); + + createCollection(altNodesCollection, "Document", function(id) {altNodesCollId = id;}); + createCollection(altEdgesCollection, "Edge", function(id) {altEdgesCollId = id;}); }; beforeEach(function() { @@ -247,6 +259,37 @@ }); }); + it('should be able to load a tree node from ArangoDB' + + ' by internal attribute and value', function() { + + var c0, c1, c2, c3, c4; + + runs(function() { + c0 = insertNode(nodesCollection, 0); + c1 = insertNode(nodesCollection, 1); + c2 = insertNode(nodesCollection, 2); + c3 = insertNode(nodesCollection, 3); + c4 = insertNode(nodesCollection, 4); + + insertEdge(edgesCollection, c0, c1); + insertEdge(edgesCollection, c0, c2); + insertEdge(edgesCollection, c0, c3); + insertEdge(edgesCollection, c0, c4); + + callbackCheck = false; + adapter.loadNodeFromTreeByAttributeValue("id", 0, checkCallbackFunction); + }); + + waitsFor(function() { + return callbackCheck; + }); + + runs(function() { + existNodes([c0, c1, c2, c3, c4]); + expect(nodes.length).toEqual(5); + }); + }); + it('should be able to request the number of children centrality', function() { var c0, c1 ,c2 ,c3 ,c4, children; @@ -324,6 +367,73 @@ }); + it('should be able to switch to different collections', function() { + var c0, c1, e1_2, insertedId; + + runs(function() { + c0 = insertNode(altNodesCollection, 0); + c1 = insertNode(altNodesCollection, 1); + e1_2 = insertEdge(altEdgesCollection, c0, c1); + + adapter.changeTo(altNodesCollection, altEdgesCollection); + + callbackCheck = false; + adapter.loadNodeFromTreeById(c0, checkCallbackFunction); + }); + + waitsFor(function() { + return callbackCheck; + }); + + runs(function() { + existNodes([c0, c1]); + expect(nodes.length).toEqual(2); + + callbackCheck = false; + adapter.createNode({}, function(node) { + insertedId = node._id; + callbackCheck = true; + }); + this.addMatchers({ + toBeStoredPermanently: function() { + var id = this.actual, + res = false; + $.ajax({ + type: "GET", + url: arangodb + "/_api/document/" + id, + contentType: "application/json", + processData: false, + async: false, + success: function(data) { + res = true; + }, + error: function(data) { + try { + var temp = JSON.parse(data); + throw "[" + temp.errorNum + "] " + temp.errorMessage; + } + catch (e) { + throw "Undefined ERROR"; + } + } + }); + return res; + } + }); + + }); + + waitsFor(function() { + return callbackCheck; + }); + + runs(function() { + expect(insertedId).toBeStoredPermanently(); + existNode(insertedId); + }); + + }); + describe('that has already loaded one graph', function() { var c0, c1, c2, c3, c4, c5, c6, c7; diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterUISpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterUISpec.js new file mode 100644 index 0000000000..8955aa2244 --- /dev/null +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterUISpec.js @@ -0,0 +1,115 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ +/*global beforeEach, afterEach */ +/*global describe, it, expect*/ +/*global runs, waitsFor, spyOn */ +/*global window, eb, loadFixtures, document */ +/*global $, _, d3*/ +/*global helper*/ +/*global ArangoAdapterControls */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + + +(function () { + "use strict"; + + describe('Arango Adapter UI', function () { + var adapter, adapterUI, list; + + beforeEach(function () { + adapter = { + changeTo: function(){} + }; + list = document.createElement("ul"); + document.body.appendChild(list); + list.id = "control_list"; + adapterUI = new ArangoAdapterControls(list, adapter); + spyOn(adapter, 'changeTo'); + this.addMatchers({ + toBeTag: function(name) { + var el = this.actual; + this.message = function() { + return "Expected " + el.tagName.toLowerCase() + " to be a " + name; + }; + return el.tagName.toLowerCase() === name; + }, + + toConformToListCSS: function() { + var li = this.actual, + a = li.firstChild, + lbl = a.firstChild; + expect(li).toBeTag("li"); + expect(a).toBeTag("a"); + expect(lbl).toBeTag("label"); + return true; + } + }); + }); + + afterEach(function () { + document.body.removeChild(list); + }); + + it('should throw errors if not setup correctly', function() { + expect(function() { + var e = new ArangoAdapterControls(); + }).toThrow("A list element has to be given."); + expect(function() { + var e = new ArangoAdapterControls(list); + }).toThrow("The ArangoAdapter has to be given."); + }); + + it('should be able to add a change collections control to the list', function() { + runs(function() { + adapterUI.addControlChangeCollections(); + + expect($("#control_list #control_collections").length).toEqual(1); + expect($("#control_list #control_collections")[0]).toConformToListCSS(); + + helper.simulateMouseEvent("click", "control_collections"); + + expect($("#control_collections_modal").length).toEqual(1); + + $("#control_collections_nodecollection").attr("value", "newNodes"); + $("#control_collections_edgecollection").attr("value", "newEdges"); + + helper.simulateMouseEvent("click", "control_collections_submit"); + + expect(adapter.changeTo).toHaveBeenCalledWith( + "newNodes", + "newEdges" + ); + }); + }); + + it('should be able to add all controls to the list', function() { + adapterUI.addAll(); + expect($("#control_list #control_collections").length).toEqual(1); + }); + }); +}()); \ No newline at end of file diff --git a/html/admin/js/graphViewer/jasmine_test/specEdgeShaper/edgeShaperSpec.js b/html/admin/js/graphViewer/jasmine_test/specEdgeShaper/edgeShaperSpec.js index 881469d49b..3c5118f958 100644 --- a/html/admin/js/graphViewer/jasmine_test/specEdgeShaper/edgeShaperSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specEdgeShaper/edgeShaperSpec.js @@ -355,19 +355,27 @@ edges = [{ source: n1, target: n2, - label: "lbl1" + _data: { + label: "lbl1" + } },{ source: n2, target: n3, - label: "lbl2" + _data: { + label: "lbl2" + } },{ source: n3, target: n4, - label: "lbl3" + _data: { + label: "lbl3" + } },{ source: n4, target: n1, - label: "lbl1" + _data: { + label: "lbl1" + } }], shaper = new EdgeShaper(d3.select("svg"), { @@ -586,22 +594,30 @@ { "source": nodes[0], "target": nodes[1], - "label": "first" + _data: { + label: "first" + } }, { "source": nodes[1], "target": nodes[2], - "label": "second" + _data: { + label: "second" + } }, { "source": nodes[2], "target": nodes[3], - "label": "third" + _data: { + label: "third" + } }, { "source": nodes[3], "target": nodes[0], - "label": "fourth" + _data: { + label: "fourth" + } } ]; shaper.drawEdges(edges); @@ -637,7 +653,9 @@ { "source": nodes[0], "target": nodes[1], - "label": "first" + _data: { + "label": "first" + } } ]; shaper.drawEdges(edges); @@ -651,22 +669,29 @@ { "source": nodes[0], "target": nodes[1], - "label": "correct" + _data: { + "label": "correct" + } }, { "source": nodes[1], "target": nodes[2], - "alt": "incorrect" + _data: { + "alt": "incorrect" + } }, { "source": nodes[2], - "target": nodes[3] + "target": nodes[3], + _data: {} }, { "source": nodes[3], "target": nodes[0], - "label": "correct", - "alt": "incorrect" + _data: { + "label": "correct", + "alt": "incorrect" + } } ]; shaper.drawEdges(edges); @@ -684,12 +709,16 @@ { "source": nodes[0], "target": nodes[1], - "label": "old" + _data: { + "label": "old" + } }, { "source": nodes[1], "target": nodes[0], - "new": "new" + _data: { + "new": "new" + } } ]; shaper.drawEdges(edges); diff --git a/html/admin/js/graphViewer/jasmine_test/specNodeShaper/nodeShaperSpec.js b/html/admin/js/graphViewer/jasmine_test/specNodeShaper/nodeShaperSpec.js index ba8a3f47c7..93f1336df6 100644 --- a/html/admin/js/graphViewer/jasmine_test/specNodeShaper/nodeShaperSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specNodeShaper/nodeShaperSpec.js @@ -235,7 +235,22 @@ shaper; beforeEach(function() { - nodes = [{_id: 1}, {_id: 2}, {_id: 3}]; + nodes = [{ + _id: 1, + _data: { + + } + }, { + _id: 2, + _data: { + + } + }, { + _id: 3, + _data: { + + } + }]; clicked = []; shaper = new NodeShaper(d3.select("svg")); shaper.drawNodes(nodes); @@ -305,9 +320,9 @@ it('should be able to reshape a single node only', function() { shaper.changeTo({label: "label"}); - nodes[0].label = "false"; - nodes[1].label = "true"; - nodes[2].label = "false_again"; + nodes[0]._data.label = "false"; + nodes[1]._data.label = "true"; + nodes[2]._data.label = "false_again"; expect($("#1 text").length).toEqual(1); expect($("#2 text").length).toEqual(1); expect($("#3 text").length).toEqual(1); @@ -326,8 +341,6 @@ }); }); - - describe('configured for circle', function () { var shaper; @@ -522,8 +535,6 @@ }); }); - - describe('configured for label', function () { var shaper; @@ -534,7 +545,12 @@ }); it('should add a text element', function () { - var node = [{_id: 1, "label": "MyLabel"}]; + var node = [{ + _id: 1, + _data: { + "label": "MyLabel" + } + }]; shaper.drawNodes(node); expect($("svg .node")[0]).toBeDefined(); expect($("svg .node").length).toEqual(1); @@ -550,10 +566,31 @@ it('should ignore other attributes', function () { var nodes = [ - {_id: 1, "label": "correct"}, - {_id: 2, "alt": "incorrect"}, - {_id: 3, "alt": "incorrect"}, - {_id: 4, "label": "correct", "alt": "incorrect"}]; + { + _id: 1, + _data: { + "label": "correct" + } + }, + { + _id: 2, + _data: { + "alt": "incorrect" + } + }, + { + _id: 3, + _data: { + "alt": "incorrect" + } + }, + { + _id: 4, + _data: { + "label": "correct", + "alt": "incorrect" + } + }]; shaper.drawNodes(nodes); expect($("svg #1 text")[0].textContent).toEqual("correct"); expect($("svg #2 text")[0].textContent).toEqual(""); @@ -562,7 +599,12 @@ }); it('should also print "0" as a label', function() { - var node = [{_id: 1, "label": 0}]; + var node = [{ + _id: 1, + _data: { + "label": 0 + } + }]; shaper.drawNodes(node); expect($("svg .node text")[0]).toBeDefined(); expect($("svg .node text").length).toEqual(1); @@ -572,8 +614,10 @@ it('should be able to switch to another label during runtime', function() { var node = [{ _id: 1, - label: "before", - switched: "after" + _data: { + label: "before", + switched: "after" + } }]; shaper.drawNodes(node); expect($("svg .node text")[0].textContent).toEqual("before"); @@ -592,11 +636,11 @@ if (node._id === 4) { return "correct"; } - if (node.label) { - return node.label; + if (node._data.label) { + return node._data.label; } - if (node.alt) { - return node.alt; + if (node._data.alt) { + return node._data.alt; } return "default"; }; @@ -609,11 +653,36 @@ it('should display the correct labels according to the function', function () { var nodes = [ - {_id: 1, "label": "correct"}, - {_id: 2, "alt": "correct"}, - {_id: 3, "label": "correct", "alt": "incorrect"}, - {_id: 4, "label": "incorrect", "alt": "incorrect"}, - {_id: 5} + { + _id: 1, + _data: { + "label": "correct" + } + }, + { + _id: 2, + _data: { + "alt": "correct" + } + }, + { + _id: 3, + _data: { + "label": "correct", + "alt": "incorrect" + } + }, + { + _id: 4, + _data: { + "label": "incorrect", + "alt": "incorrect" + } + }, + { + _id: 5, + _data: {} + } ]; shaper.drawNodes(nodes); expect($("text").length).toEqual(5); @@ -712,7 +781,9 @@ it('should draw circle elements', function () { var node = [{ _id: 1, - "label": "correct" + _data: { + "label": "correct" + } }]; shaper.drawNodes(node); expect($("svg .node").length).toEqual(1); diff --git a/html/admin/js/graphViewer/ui/arangoAdapterControls.js b/html/admin/js/graphViewer/ui/arangoAdapterControls.js new file mode 100644 index 0000000000..8d16e1fafb --- /dev/null +++ b/html/admin/js/graphViewer/ui/arangoAdapterControls.js @@ -0,0 +1,66 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ +/*global $, _, d3*/ +/*global document*/ +/*global modalDialogHelper, uiComponentsHelper*/ +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// +function ArangoAdapterControls(list, adapter) { + "use strict"; + + if (list === undefined) { + throw "A list element has to be given."; + } + if (adapter === undefined) { + throw "The ArangoAdapter has to be given."; + } + var self = this, + baseClass = "adapter"; + + this.addControlChangeCollections = function() { + var prefix = "control_collections", + idprefix = prefix + "_"; + uiComponentsHelper.createButton(baseClass, list, "Collections", prefix, function() { + modalDialogHelper.createModalDialog("Switch Collections", + idprefix, [{ + type: "text", + id: "nodecollection" + },{ + type: "text", + id: "edgecollection" + }], function () { + var nodes = $("#" + idprefix + "nodecollection").attr("value"), + edges = $("#" + idprefix + "edgecollection").attr("value"); + adapter.changeTo(nodes, edges); + } + ); + }); + }; + + this.addAll = function() { + this.addControlChangeCollections(); + }; +} \ No newline at end of file diff --git a/html/admin/js/routers/router.js b/html/admin/js/routers/router.js index 1dcc7ea595..f3b991ab23 100644 --- a/html/admin/js/routers/router.js +++ b/html/admin/js/routers/router.js @@ -18,7 +18,7 @@ $(document).ready(function() { "application/available/:key" : "applicationInstall", "applications/installed" : "applicationsInstalled", "applications/available" : "applicationsAvailable", - "applications/documentation" : "applicationsDocumentation", + "application/documentation/:key" : "appDocumentation", "graph" : "graph" }, @@ -223,12 +223,9 @@ $(document).ready(function() { }, - - applicationsDocumentation: function() { - if (this.appDocuView === undefined) { - this.appDocuView = new window.AppDocumentationView(); - } - this.appDocuView.render(); + appDocumentation: function(key) { + var docuView = new window.AppDocumentationView({key: key}); + docuView.render(); this.naviView.selectMenuItem('applications-menu'); } diff --git a/html/admin/js/templates/navigationView.ejs b/html/admin/js/templates/navigationView.ejs index 530b87847b..62b2cce877 100644 --- a/html/admin/js/templates/navigationView.ejs +++ b/html/admin/js/templates/navigationView.ejs @@ -14,7 +14,6 @@