diff --git a/html/admin/js/graphViewer/graph/arangoAdapter.js b/html/admin/js/graphViewer/graph/arangoAdapter.js index 59403d8c09..d24675b290 100644 --- a/html/admin/js/graphViewer/graph/arangoAdapter.js +++ b/html/admin/js/graphViewer/graph/arangoAdapter.js @@ -48,7 +48,8 @@ function ArangoAdapter(nodes, edges, config) { } var self = this, - absAdapter = new AbstractAdapter(nodes, edges, this), + absAdapter, + absConfig = {}, api = {}, queries = {}, nodeCollection, @@ -199,7 +200,13 @@ function ArangoAdapter(nodes, edges, config) { _.each(res, self.deleteEdge); }); }; - + + + if (config.prioList) { + absConfig.prioList = config.prioList; + } + absAdapter = new AbstractAdapter(nodes, edges, this, absConfig); + parseConfig(config); api.base = arangodb.lastIndexOf("http://", 0) === 0 diff --git a/html/admin/js/graphViewer/graph/foxxAdapter.js b/html/admin/js/graphViewer/graph/foxxAdapter.js index aeed0e001c..e0c1aa4e92 100644 --- a/html/admin/js/graphViewer/graph/foxxAdapter.js +++ b/html/admin/js/graphViewer/graph/foxxAdapter.js @@ -41,8 +41,11 @@ function FoxxAdapter(nodes, edges, route, config) { throw "The route has to be given."; } + config = config || {}; + var self = this, - absAdapter = new AbstractAdapter(nodes, edges, this), + absConfig = {}, + absAdapter, routes = {}, baseRoute = route, requestBase = { @@ -195,8 +198,11 @@ function FoxxAdapter(nodes, edges, route, config) { callback(first); } }; - - config = config || {}; + + if (config.prioList) { + absConfig.prioList = config.prioList; + } + absAdapter = new AbstractAdapter(nodes, edges, this, absConfig); parseConfig(config); fillRoutes(); diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/abstractAdapterSpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/abstractAdapterSpec.js index c655d1cd8a..fa27a79d43 100644 --- a/html/admin/js/graphViewer/jasmine_test/specAdapter/abstractAdapterSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/abstractAdapterSpec.js @@ -146,6 +146,17 @@ expect(window.NodeReducer).wasCalledWith(nodes, edges); }); + it('should send the nodeReducer the configuration if given', function() { + spyOn(window, "NodeReducer"); + var nodes = [], + edges = [], + config = { + prioList: ["foo", "bar", "baz"] + }, + t = new AbstractAdapter(nodes, edges, descendant, config); + expect(window.NodeReducer).wasCalledWith(nodes, edges, ["foo", "bar", "baz"]); + }); + it('should create a ModularityJoiner worker', function() { spyOn(window, "WebWorkerWrapper"); var nodes = [], diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js index f74bacc76a..12f326c92d 100644 --- a/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/arangoAdapterSpec.js @@ -94,7 +94,8 @@ return new ArangoAdapter([], [], { nodeCollection: "", - edgeCollection: "" + edgeCollection: "", + prioList: ["foo", "bar", "baz"] }); }); diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/foxxAdapterSpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/foxxAdapterSpec.js index 44fa650e8f..5527cc6f91 100644 --- a/html/admin/js/graphViewer/jasmine_test/specAdapter/foxxAdapterSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/foxxAdapterSpec.js @@ -76,7 +76,7 @@ } }); - return new FoxxAdapter([], [], "foxx/route"); + return new FoxxAdapter([], [], "foxx/route", {prioList: ["foo", "bar", "baz"]}); }); var adapter, diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js index 33ca3a5d35..dc130518ab 100644 --- a/html/admin/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js @@ -81,6 +81,7 @@ var describeInterface = function (testee) { /** * Expectations on constructor: +* Created with config: {prioList: ["foo", "bar", "baz"]} * loadNode -> Adds {_id: 1} -{_id:"1-2"}-> {_id: 2} * createEdge({source: {_id: 1}, target: {_id: 1}}) -> {_id: "1-2", _from:1, _to:2} * createNode({}) -> {_id: 1} @@ -126,13 +127,23 @@ var describeIntegeration = function(constructor) { }; - spyOn(window, "AbstractAdapter").andCallFake(function(nodes, edges, descendant) { + spyOn(window, "AbstractAdapter").andCallFake(function(nodes, edges, descendant, config) { mockedAbstract.nodes = nodes; mockedAbstract.edges = edges; return mockedAbstract; }); }); + it('should create the AbstractAdapter with correct values', function() { + testee = constructor(); + expect(window.AbstractAdapter).wasCalledWith( + [], + [], + testee, + {prioList: ["foo", "bar", "baz"]} + ); + }); + it('should call setNodeLimit on the abstract', function() { spyOn(mockedAbstract, "setNodeLimit"); testee = constructor();