From 3b3cae42beec3d40dfab17c67ae41fb88418a231 Mon Sep 17 00:00:00 2001 From: hkernbach Date: Tue, 7 Jun 2016 15:26:42 +0200 Subject: [PATCH] scale view --- .../APP/frontend/js/templates/clusterView.ejs | 5 -- .../APP/frontend/js/templates/scaleView.ejs | 4 +- .../APP/frontend/js/views/documentsView.js | 2 +- .../APP/frontend/js/views/nodesView.js | 8 +-- .../APP/frontend/js/views/scaleView.js | 65 +++++++++++-------- .../APP/frontend/scss/_screenSizes.scss | 64 +++++++++++++++++- 6 files changed, 107 insertions(+), 41 deletions(-) diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/clusterView.ejs b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/clusterView.ejs index d49c7044af..64270e04c5 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/clusterView.ejs +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/clusterView.ejs @@ -3,11 +3,6 @@
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/scaleView.ejs b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/scaleView.ejs index abcf9ec321..51fe3295b4 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/scaleView.ejs +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/scaleView.ejs @@ -22,8 +22,8 @@
- +
@@ -33,8 +33,8 @@
- +
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js index 4a11018905..cab3b86bee 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/documentsView.js @@ -999,7 +999,7 @@ total = $('#totalDocuments'); } if (this.type === 'document') { - total.html(numeral(this.collection.getTotal()).format('0,0') + " document(s)"); + total.html(numeral(this.collection.getTotal()).format('0,0') + " doc(s)"); } if (this.type === 'edge') { total.html(numeral(this.collection.getTotal()).format('0,0') + " edge(s)"); diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/nodesView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/nodesView.js index f8243a8c3f..5550f1c0fe 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/nodesView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/nodesView.js @@ -16,6 +16,7 @@ }, initialize: function (options) { + clearInterval(this.intervalFunction); if (window.App.isCluster) { this.dbServers = options.dbServers; @@ -24,11 +25,10 @@ this.toRender = options.toRender; //start polling with interval - window.setInterval(function() { - if (window.location.hash === '#cNodes' || window.location.hash === '#dNodes') { + this.intervalFunction = window.setInterval(function() { + if (window.location.hash === '#cNodes' || window.location.hash === '#dNodes' || window.location.hash === '#nodes') { - var callback = function(data) { - }; + console.log("rerender health"); } }, this.interval); diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/scaleView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/scaleView.js index 8721d9b6f0..8af413c595 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/scaleView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/scaleView.js @@ -19,16 +19,18 @@ }, setCoordSize: function(number) { - //TODO AJAX API CALL + var self = this; + var data = { + numberOfCoordinators: number + }; + $.ajax({ - type: "POST", - url: arangoHelper.databaseUrl("/_admin/cluster/setCoordSize"), + type: "PUT", + url: arangoHelper.databaseUrl("/_admin/cluster/numberOfServers"), contentType: "application/json", - data: JSON.stringify({ - value: number - }), + data: JSON.stringify(data), success: function() { - $('#plannedCoords').html(number); + self.updateTable(data); }, error: function() { arangoHelper.arangoError("Scale", "Could not set coordinator size."); @@ -37,16 +39,18 @@ }, setDBsSize: function(number) { - //TODO AJAX API CALL + var self = this; + var data = { + numberOfDBServers: number + }; + $.ajax({ - type: "POST", - url: arangoHelper.databaseUrl("/_admin/cluster/setDBsSize"), + type: "PUT", + url: arangoHelper.databaseUrl("/_admin/cluster/numberOfServers"), contentType: "application/json", - data: JSON.stringify({ - value: number - }), + data: JSON.stringify(data), success: function() { - $('#plannedCoords').html(number); + self.updateTable(data); }, error: function() { arangoHelper.arangoError("Scale", "Could not set coordinator size."); @@ -158,25 +162,30 @@ }, updateTable: function(data) { - $('#plannedCoords').html(data.numberOfCoordinators); - $('#plannedDBs').html(data.numberOfDBServers); - var scalingActive = 'scaling in progress'; var scalingDone = 'no scaling process active'; - if (this.coordinators.toJSON().length === data.numberOfCoordinators) { - $('#statusCoords').html(scalingDone); + if (data.numberOfCoordinators) { + $('#plannedCoords').html(data.numberOfCoordinators); + + if (this.coordinators.toJSON().length === data.numberOfCoordinators) { + $('#statusCoords').html(scalingDone); + } + else { + $('#statusCoords').html(scalingActive); + } } - else { - $('#statusCoords').html(scalingActive); - } - - if (this.dbServers.toJSON().length === data.numberOfDBServers) { - $('#statusDBs').html(scalingDone); - } - else { - $('#statusDBs').html(scalingActive); + + if (data.numberOfDBServers) { + $('#plannedDBs').html(data.numberOfDBServers); + if (this.dbServers.toJSON().length === data.numberOfDBServers) { + $('#statusDBs').html(scalingDone); + } + else { + $('#statusDBs').html(scalingActive); + } } + }, waitForDBServers: function(callback) { diff --git a/js/apps/system/_admin/aardvark/APP/frontend/scss/_screenSizes.scss b/js/apps/system/_admin/aardvark/APP/frontend/scss/_screenSizes.scss index 463b25c18c..17fd87f88f 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/scss/_screenSizes.scss +++ b/js/apps/system/_admin/aardvark/APP/frontend/scss/_screenSizes.scss @@ -1,5 +1,33 @@ @media (max-width: 568px) { + //PAGINATION + + .pagination-line { + .pre-pagi, + .las-pagi { + display: none; + } + + .arango-pagination { + li:first-child, + li:last-child { + margin-left: 0; + margin-right: 0; + } + } + + li a { + padding: 2px 4px; + } + } + + //LOG + #arangoLogTable { + .table-cell0 { + display: none; + } + } + //LOGIN .login-window { padding: 10px 10px 40px; @@ -35,6 +63,11 @@ } // NAVIGATION TOP + + .breadcrumb { + display: none; + } + .subnavmenu { a { font-size: 8pt; @@ -142,6 +175,33 @@ } @media (max-width: 768px) { + //PAGINATION + + .pagination-line { + .pre-pagi, + .las-pagi { + display: none; + } + + .arango-pagination { + li:first-child, + li:last-child { + margin-left: 0; + margin-right: 0; + } + } + + li a { + padding: 2px 4px; + } + } + + // NAVIGATION TOP + + .breadcrumb { + display: none; + } + .dashboard-large-chart, .dashboard-tendency-container { box-sizing: content-box; @@ -193,7 +253,9 @@ //actions sub menu .headerButtonBar { - display: none; + span { + display: none; + } } .dashboard-bar-chart-container {