From 16168e642a88fa22a184d21beb2d4b979dcf5469 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 30 Jun 2014 09:55:16 +0200 Subject: [PATCH 1/8] Fix test of NoCreate-Mode. --- js/client/tests/shell-noChangeMode-noncluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/client/tests/shell-noChangeMode-noncluster.js b/js/client/tests/shell-noChangeMode-noncluster.js index 3bb61a04d0..70bb0bdb7f 100644 --- a/js/client/tests/shell-noChangeMode-noncluster.js +++ b/js/client/tests/shell-noChangeMode-noncluster.js @@ -67,7 +67,7 @@ function changeOperationModeNegativeCaseTestSuite () { collections: {}, action: function () { var db = require('internal').db; - var result = db._changeMode('ReadOnly'); + var result = db._changeMode('NoCreate'); return result; } }); From 1ceb929483b5574b6fa6ac85e02fdb19014a09ca Mon Sep 17 00:00:00 2001 From: gschwab Date: Mon, 30 Jun 2014 10:17:00 +0200 Subject: [PATCH 2/8] karma tests changed --- .../specs/views/graphManagementViewSpec.js | 272 +++++++++--------- 1 file changed, 139 insertions(+), 133 deletions(-) diff --git a/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js b/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js index 798d48e6ca..94fcd26001 100644 --- a/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/graphManagementViewSpec.js @@ -4,147 +4,153 @@ /*global GraphManagementView, _, jasmine, $*/ (function () { - "use strict"; + "use strict"; - describe("Graph Management View", function () { + describe("Graph Management View", function () { - var view, - div, - modalDiv, - graphs, - collections, - e1, e2, e3, - f1, f2, f3, - t1, t2, t3, - o1, o2, o3, - sys1, cols; + var view, + div, + modalDiv, + graphs, + collections, + e1, e2, e3, + f1, f2, f3, + t1, t2, t3, + o1, o2, o3, + sys1, cols; - beforeEach(function () { - modalDiv = document.createElement("div"); - modalDiv.id = "modalPlaceholder"; - document.body.appendChild(modalDiv); - window.modalView = new window.ModalView(); - collections = new window.arangoCollections(cols); - graphs = new window.GraphCollection(); - div = document.createElement("div"); - div.id = "content"; - document.body.appendChild(div); - view = new window.GraphManagementView({ - collection: graphs, - collectionCollection: new window.arangoCollections() + beforeEach(function () { + modalDiv = document.createElement("div"); + modalDiv.id = "modalPlaceholder"; + document.body.appendChild(modalDiv); + window.modalView = new window.ModalView(); + collections = new window.arangoCollections(cols); + graphs = new window.GraphCollection(); + div = document.createElement("div"); + div.id = "content"; + document.body.appendChild(div); + view = new window.GraphManagementView({ + collection: graphs, + collectionCollection: new window.arangoCollections() + }); + }); + + afterEach(function () { + document.body.removeChild(div); + document.body.removeChild(modalDiv); + }); + + it("should fetch the graphs on render", function () { + spyOn(graphs, "fetch"); + view.render(); + expect(graphs.fetch).toHaveBeenCalledWith({async: false}); + }); + + describe("after rendering", function () { + + var g1, g2, g3; + + beforeEach(function () { + g1 = { + _id: "_graphs/g1", + _key: "g1", + _rev: "123", + edgeDefinitions: [ + { + collection: e1, + from: ["f1"], + to: ["t1"] + + } + ], + orphanCollections: ["o1"] + }; + g2 = { + _id: "_graphs/g2", + _key: "g2", + _rev: "321", + edgeDefinitions: [ + { + collection: e2, + from: ["f2"], + to: ["t2"] + + } + ], + orphanCollections: ["o2"] + }; + g3 = { + _id: "_graphs/g3", + _key: "g3", + _rev: "111", + edgeDefinitions: [ + { + collection: e3, + from: ["f3"], + to: ["t3"] + + } + ], + orphanCollections: ["o3"] + }; + spyOn(graphs, "fetch"); + graphs.add(g1); + graphs.add(g2); + graphs.add(g3); + view.render(); + }); + + it("should create a sorted list of all graphs", function () { + var list = $("div.tile h5.collectionName", "#graphManagementThumbnailsIn"); + expect(list.length).toEqual(3); + // Order would be g2, g3, g1 + expect($(list[0]).html()).toEqual(g1._key); + expect($(list[1]).html()).toEqual(g2._key); + expect($(list[2]).html()).toEqual(g3._key); + }); + + describe("creating a new graph", function () { + + it("should create a new empty graph", function () { + runs(function () { + $("#createGraph").click(); + }); + waitsFor(function () { + return $("#modal-dialog").css("display") === "block"; + }); + runs(function () { + $("#createNewGraphName").val("newGraph"); + $("#s2id_newEdgeDefinitions0").select2("val", ["newEdgeCol"]); + $("#s2id_fromCollections0").select2("val", ["newFrom1", "newFrom2"]); + $("#s2id_toCollections0").select2("val", ["newTo1", "newTo2"]); + $("#s2id_newVertexCollections").select2("val", ["newOrphan1", "newOrphan2"]); + $("#newGraphEdges").val("newEdges"); + spyOn($, "ajax").andCallFake(function (opts) { + expect(opts.type).toEqual("POST"); + expect(opts.url).toEqual("/_api/gharial"); + expect(opts.data).toEqual(JSON.stringify( + { + "name": "newGraph", + "edgeDefinitions": [ + { + collection: "newEdgeCol", + from: ["newFrom1", "newFrom2"], + to: ["newTo1", "newTo2"] + } + ], + "orphanCollections": ["newOrphan1", "newOrphan2"] + })); }); + $("#modalButton1").click(); + expect($.ajax).toHaveBeenCalled(); + }); }); - afterEach(function () { - document.body.removeChild(div); - document.body.removeChild(modalDiv); - }); - - it("should fetch the graphs on render", function () { - spyOn(graphs, "fetch"); - view.render(); - expect(graphs.fetch).toHaveBeenCalledWith({async: false}); - }); - - describe("after rendering", function () { - - var g1, g2, g3; - - beforeEach(function () { - g1 = { - _id: "_graphs/g1", - _key: "g1", - _rev: "123", - edgeDefinitions: - [ - { - collection: e1, - from: ["f1"], - to: ["t1"] - - } - ], - orphanCollections: ["o1"] - }; - g2 = { - _id: "_graphs/g2", - _key: "g2", - _rev: "321", - edgeDefinitions: - [ - { - collection: e2, - from: ["f2"], - to: ["t2"] - - } - ], - orphanCollections: ["o2"] - }; - g3 = { - _id: "_graphs/g3", - _key: "g3", - _rev: "111", - edgeDefinitions: - [ - { - collection: e3, - from: ["f3"], - to: ["t3"] - - } - ], - orphanCollections: ["o3"] - }; - spyOn(graphs, "fetch"); - graphs.add(g1); - graphs.add(g2); - graphs.add(g3); - view.render(); - }); - - it("should create a sorted list of all graphs", function () { - var list = $("div.tile h5.collectionName", "#graphManagementThumbnailsIn"); - expect(list.length).toEqual(3); - // Order would be g2, g3, g1 - expect($(list[0]).html()).toEqual(g1._key); - expect($(list[1]).html()).toEqual(g2._key); - expect($(list[2]).html()).toEqual(g3._key); - }); - - describe("creating a new graph", function () { - - it("should create a new empty graph", function () { - runs(function () { - $("#createGraph").click(); - }); - waitsFor(function () { - return $("#modal-dialog").css("display") === "block"; - }); - runs(function () { - $("#createNewGraphName").val("newGraph"); - $("#s2id_newEdgeDefinitions0").val(["newEdgeCol"]); - $("#newGraphEdges").val("newEdges"); - spyOn($, "ajax").andCallFake(function (opts) { - expect(opts.type).toEqual("POST"); - expect(opts.url).toEqual("/_api/gharial"); - expect(opts.data).toEqual(JSON.stringify( - { - "name":"newGraph", - "edgeDefinitions":[], - "orphanCollections":[] - })); - }); - $("#modalButton1").click(); - expect($.ajax).toHaveBeenCalled(); - }); - }); - - }); - - }); + }); }); + }); + }()); From f43a45f6c1196eab5143ef466d74d0f294402a27 Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Mon, 30 Jun 2014 10:26:17 +0200 Subject: [PATCH 3/8] Added resizing to new version of graph viewer --- .../system/aardvark/frontend/js/routers/router.js | 15 ++------------- .../frontend/js/views/graphManagementView.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/routers/router.js b/js/apps/system/aardvark/frontend/js/routers/router.js index e78668ea82..46ae579f0a 100644 --- a/js/apps/system/aardvark/frontend/js/routers/router.js +++ b/js/apps/system/aardvark/frontend/js/routers/router.js @@ -265,20 +265,9 @@ if (this.dashboardView) { this.dashboardView.resize(); } - if (this.graphView) { - this.graphView.handleResize($("#content").width()); + if (this.graphManagementView) { + this.graphManagementView.handleResize($("#content").width()); } - /* - var oldWidth = $('#content').width(); - var containerWidth = $(window).width() - 70; - var spanWidth = 240; - var divider = containerWidth / spanWidth; - var roundDiv = parseInt(divider, 10); - var newWidth = roundDiv * spanWidth - 2; - if (newWidth !== oldWidth && this.graphView) { - this.graphView.handleResize(newWidth); - } - */ }, userManagement: function () { diff --git a/js/apps/system/aardvark/frontend/js/views/graphManagementView.js b/js/apps/system/aardvark/frontend/js/views/graphManagementView.js index e03ce6a245..bd05173f46 100644 --- a/js/apps/system/aardvark/frontend/js/views/graphManagementView.js +++ b/js/apps/system/aardvark/frontend/js/views/graphManagementView.js @@ -42,12 +42,21 @@ }, true); }, + handleResize: function(w) { + if (!this.width || this.width !== w) { + this.width = w; + if (this.ui) { + this.ui.changeWidth(w); + } + } + }, + addNewGraph: function(e) { e.preventDefault(); this.createEditGraphModal(); }, - deleteGraph: function(e) { + deleteGraph: function() { var self = this; var name = $("#editGraphName")[0].value; this.collection.get(name).destroy({ @@ -144,7 +153,6 @@ editedVertexCollections = _.pluck($('#newVertexCollections').select2("data"), "text"), edgeDefinitions = [], newEdgeDefinitions = {}, - self = this, collection, from, to, From c36995c8b8d8c93ec82beea4c8395433e8e2714c Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 30 Jun 2014 11:00:31 +0200 Subject: [PATCH 4/8] Fix gharial test if not mounted under /system. --- UnitTests/HttpInterface/api-general-graph-spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTests/HttpInterface/api-general-graph-spec.rb b/UnitTests/HttpInterface/api-general-graph-spec.rb index 9d3e5466f9..28380ceb58 100644 --- a/UnitTests/HttpInterface/api-general-graph-spec.rb +++ b/UnitTests/HttpInterface/api-general-graph-spec.rb @@ -5,7 +5,7 @@ require 'json' require 'arangodb.rb' PREFIX = "api-general-graph" -URLPREFIX = "/system/gharial" +URLPREFIX = "/_api/gharial" def drop_graph(graph_name) cmd = URLPREFIX + "/" + graph_name From a2e7477751b49c3a90a2a385503aa42e09799b12 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 30 Jun 2014 11:07:56 +0200 Subject: [PATCH 5/8] Create setNumbers method for TransactionBase class. --- arangod/VocBase/voc-types.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arangod/VocBase/voc-types.h b/arangod/VocBase/voc-types.h index 7755906492..ff8a4f0e34 100644 --- a/arangod/VocBase/voc-types.h +++ b/arangod/VocBase/voc-types.h @@ -206,6 +206,16 @@ namespace triagens { #endif } +//////////////////////////////////////////////////////////////////////////////// +/// @brief set counters, used in replication client to transfer transactions +/// between threads. +//////////////////////////////////////////////////////////////////////////////// + + static void setNumbers (int numberInScope, int numberActive) { + _numberTrxInScope = numberInScope; + _numberTrxActive = numberActive; + } + //////////////////////////////////////////////////////////////////////////////// /// @brief assert that a transaction object is in scope in the current thread //////////////////////////////////////////////////////////////////////////////// From 874343697ec022803bae8305bebdccdfbc2914a8 Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Mon, 30 Jun 2014 11:09:07 +0200 Subject: [PATCH 6/8] Fixed resizing tests --- js/apps/system/aardvark/test/specs/router/routerSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/apps/system/aardvark/test/specs/router/routerSpec.js b/js/apps/system/aardvark/test/specs/router/routerSpec.js index 5957eb0f3f..0b41c954af 100644 --- a/js/apps/system/aardvark/test/specs/router/routerSpec.js +++ b/js/apps/system/aardvark/test/specs/router/routerSpec.js @@ -562,7 +562,7 @@ }); it("should handle resizing", function () { - r.graphView = graphDummy; + r.graphManagementView = graphDummy; r.dashboardView = dashboardDummy; spyOn(graphDummy, "handleResize"); spyOn(dashboardDummy, "resize"); From cd8079ed598e285d60f3b115889d4cc7a251105b Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Mon, 30 Jun 2014 11:10:00 +0200 Subject: [PATCH 7/8] Added some more whitespace on left and right. This allows to use scrollbars without triggering resizing --- .../aardvark/frontend/scss/_resizing.scss | 3 +- .../aardvark/frontend/scss/generated.css | 30 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/js/apps/system/aardvark/frontend/scss/_resizing.scss b/js/apps/system/aardvark/frontend/scss/_resizing.scss index 324c0df508..949297100a 100644 --- a/js/apps/system/aardvark/frontend/scss/_resizing.scss +++ b/js/apps/system/aardvark/frontend/scss/_resizing.scss @@ -31,6 +31,7 @@ div.resizecontainer { } @for $i from 1 through 11 { + $white-space: 10px; $min: $tile-width * $i; $content-size: $min - 12px; @@ -138,7 +139,7 @@ div.resizecontainer { $dashboard-height: 400px; } - @media (min-width: $min) and (max-width: $min + $tile-width - 1) { + @media (min-width: $min + $white-space) and (max-width: $min + $tile-width - 1 + $white-space) { div.resizecontainer { width: $content-size; } diff --git a/js/apps/system/aardvark/frontend/scss/generated.css b/js/apps/system/aardvark/frontend/scss/generated.css index 9833430d26..4528d15831 100644 --- a/js/apps/system/aardvark/frontend/scss/generated.css +++ b/js/apps/system/aardvark/frontend/scss/generated.css @@ -1449,9 +1449,9 @@ nav.navbar, footer.footer { background-color: #f87c0f; } .button-inactive { - background-color: lightgray; } + background-color: lightgrey; } .button-inactive:hover, .button-inactive:focus { - background-color: gray; } + background-color: grey; } ul.link-dropdown-menu, ul.user-dropdown-menu, ul.gv-dropdown-menu { -moz-border-radius: 3px; @@ -2111,7 +2111,7 @@ div.resizecontainer { @media (min-width: 1042px) and (max-width: 1284px) { #arangoCollectionUl a { font-size: 14px; } } -@media (min-width: 240px) and (max-width: 479px) { +@media (min-width: 250px) and (max-width: 489px) { div.resizecontainer { width: 228px; } @@ -2292,7 +2292,7 @@ div.resizecontainer { font-size: 10px; height: 100px; width: 0; } } -@media (min-width: 480px) and (max-width: 719px) { +@media (min-width: 490px) and (max-width: 729px) { div.resizecontainer { width: 468px; } @@ -2473,7 +2473,7 @@ div.resizecontainer { font-size: 10px; height: 100px; width: 0; } } -@media (min-width: 720px) and (max-width: 959px) { +@media (min-width: 730px) and (max-width: 969px) { div.resizecontainer { width: 708px; } @@ -2654,7 +2654,7 @@ div.resizecontainer { font-size: 10px; height: 100px; width: 0; } } -@media (min-width: 960px) and (max-width: 1199px) { +@media (min-width: 970px) and (max-width: 1209px) { div.resizecontainer { width: 948px; } @@ -2832,7 +2832,7 @@ div.resizecontainer { font-size: 11px; height: 117.5px; width: 60px; } } -@media (min-width: 1200px) and (max-width: 1439px) { +@media (min-width: 1210px) and (max-width: 1449px) { div.resizecontainer { width: 1188px; } @@ -3010,7 +3010,7 @@ div.resizecontainer { font-size: 12px; height: 135px; width: 65px; } } -@media (min-width: 1440px) and (max-width: 1679px) { +@media (min-width: 1450px) and (max-width: 1689px) { div.resizecontainer { width: 1428px; } @@ -3188,7 +3188,7 @@ div.resizecontainer { font-size: 13px; height: 150px; width: 70px; } } -@media (min-width: 1680px) and (max-width: 1919px) { +@media (min-width: 1690px) and (max-width: 1929px) { div.resizecontainer { width: 1668px; } @@ -3366,7 +3366,7 @@ div.resizecontainer { font-size: 14px; height: 170px; width: 80px; } } -@media (min-width: 1920px) and (max-width: 2159px) { +@media (min-width: 1930px) and (max-width: 2169px) { div.resizecontainer { width: 1908px; } @@ -3544,7 +3544,7 @@ div.resizecontainer { font-size: 15px; height: 200px; width: 85px; } } -@media (min-width: 2160px) and (max-width: 2399px) { +@media (min-width: 2170px) and (max-width: 2409px) { div.resizecontainer { width: 2148px; } @@ -3722,7 +3722,7 @@ div.resizecontainer { font-size: 15px; height: 150px; width: 70px; } } -@media (min-width: 2400px) and (max-width: 2639px) { +@media (min-width: 2410px) and (max-width: 2649px) { div.resizecontainer { width: 2388px; } @@ -3900,7 +3900,7 @@ div.resizecontainer { font-size: 15px; height: 150px; width: 70px; } } -@media (min-width: 2640px) and (max-width: 2879px) { +@media (min-width: 2650px) and (max-width: 2889px) { div.resizecontainer { width: 2628px; } @@ -4672,7 +4672,7 @@ pre.gv-object-view { width: 5%; } .user-menu-img { - background-color: lightgray; + background-color: lightgrey; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; @@ -5359,7 +5359,7 @@ pre.gv-object-view { color: #66ff00; } .jqconsole-cursor { - background-color: gray; } + background-color: grey; } .jqconsole-blurred .jqconsole-header .jqconsole-cursor { color: #c4cccc; } From 69c2eb78a5e740b5a2450cb9e0b6d121a33f6c1f Mon Sep 17 00:00:00 2001 From: gschwab Date: Mon, 30 Jun 2014 11:24:16 +0200 Subject: [PATCH 8/8] started deleting old graph view --- .../aardvark/frontend/js/routers/router.js | 17 ----------------- .../aardvark/test/specs/router/routerSpec.js | 9 --------- 2 files changed, 26 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/routers/router.js b/js/apps/system/aardvark/frontend/js/routers/router.js index 46ae579f0a..5524525a56 100644 --- a/js/apps/system/aardvark/frontend/js/routers/router.js +++ b/js/apps/system/aardvark/frontend/js/routers/router.js @@ -21,7 +21,6 @@ "applications": "applications", "application/documentation/:key": "appDocumentation", "graph": "graphManagement", - "graphManagement": "graphManagement", "userManagement": "userManagement", "userProfile": "userProfile", "logs": "logs" @@ -211,22 +210,6 @@ this.dashboardView.render(); }, - graph: function () { - var self = this; - if (!this.graphView) { - this.graphView = new window.GraphView({ - graphs: new window.GraphCollection(), - collection: this.arangoCollectionsStore - }); - } - this.arangoCollectionsStore.fetch({ - success: function () { - self.graphView.render(); - self.naviView.selectMenuItem('graphviewer-menu'); - } - }); - }, - graphManagement: function () { if (!this.graphManagementView) { this.graphManagementView = diff --git a/js/apps/system/aardvark/test/specs/router/routerSpec.js b/js/apps/system/aardvark/test/specs/router/routerSpec.js index 0b41c954af..6370407964 100644 --- a/js/apps/system/aardvark/test/specs/router/routerSpec.js +++ b/js/apps/system/aardvark/test/specs/router/routerSpec.js @@ -654,15 +654,6 @@ ); }); - it("should route to the graph management tab", function () { - simpleNavigationCheck( - "graphManagement", - "GraphManagementView", - "graphviewer-menu", - { collection: graphsDummy , - collectionCollection : { id : 'store', fetch : jasmine.any(Function) } } - ); - }); it("should route to the applications tab", function () { simpleNavigationCheck(