1
0
Fork 0

ui routes modified to fit cluster api

This commit is contained in:
hkernbach 2017-01-26 16:54:42 +01:00
parent 8e5a28d6fc
commit a4e00b8c8d
4 changed files with 36 additions and 10 deletions

View File

@ -57,6 +57,30 @@
localStorage.setItem('jwtUser', username); localStorage.setItem('jwtUser', username);
}, },
getCoordinatorShortName: function (id) {
var shortName;
if (window.clusterHealth) {
_.each(window.clusterHealth, function (value, key) {
if (id === key) {
shortName = value.ShortName;
}
});
}
return shortName;
},
getDatabaseServerId: function (shortname) {
var id;
if (window.clusterHealth) {
_.each(window.clusterHealth, function (value, key) {
if (shortname === value.ShortName) {
id = key;
}
});
}
return id;
},
lastNotificationMessage: null, lastNotificationMessage: null,
CollectionTypes: {}, CollectionTypes: {},

View File

@ -106,11 +106,11 @@
$('#offlinePlaceholder').hide(); $('#offlinePlaceholder').hide();
var callbackFunction = function (data) { var callbackFunction = function (data) {
var health = data.Health; window.clusterHealth = data.Health;
var error = 0; var error = 0;
_.each(health, function (node) { _.each(window.clusterHealth, function (node) {
if (node.Status !== 'GOOD') { if (node.Status !== 'GOOD') {
error++; error++;
} }

View File

@ -1,6 +1,6 @@
/* jshint browser: true */ /* jshint browser: true */
/* jshint unused: false */ /* jshint unused: false */
/* global Backbone, templateEngine, $, window */ /* global Backbone, templateEngine, arangoHelper, $, window */
(function () { (function () {
'use strict'; 'use strict';
@ -39,7 +39,7 @@
var callback = function () { var callback = function () {
this.continueRender(); this.continueRender();
this.breadcrumb(this.coordname); this.breadcrumb(arangoHelper.getCoordinatorShortName(this.coordname));
// window.arangoHelper.buildNodeSubNav(this.coordname, 'Dashboard', 'Logs') // window.arangoHelper.buildNodeSubNav(this.coordname, 'Dashboard', 'Logs')
$(window).trigger('resize'); $(window).trigger('resize');
}.bind(this); }.bind(this);

View File

@ -93,9 +93,11 @@
if (!from) { if (!from) {
fromServer = $(e.currentTarget).parent().parent().attr('leader'); fromServer = $(e.currentTarget).parent().parent().attr('leader');
fromServer = arangoHelper.getDatabaseServerId(fromServer);
} else { } else {
leader = $(e.currentTarget).parent().parent().attr('leader'); leader = $(e.currentTarget).parent().parent().attr('leader');
fromServer = from; leader = arangoHelper.getDatabaseServerId(leader);
fromServer = arangoHelper.getDatabaseServerId(from);
} }
var buttons = []; var buttons = [];
@ -184,14 +186,14 @@
async: true, async: true,
success: function (data) { success: function (data) {
if (data.id) { if (data.id) {
arangoHelper.arangoNotification('Shard ' + shardName + ' will be moved to ' + toServer + '.'); arangoHelper.arangoNotification('Shard ' + shardName + ' will be moved to ' + arangoHelper.getDatabaseServerId(toServer) + '.');
window.setTimeout(function () { window.setTimeout(function () {
window.App.shardsView.render(); window.App.shardsView.render();
}, 2000); }, 3000);
} }
}, },
error: function () { error: function () {
arangoHelper.arangoError('Shard ' + shardName + ' could not be moved to ' + toServer + '.'); arangoHelper.arangoError('Shard ' + shardName + ' could not be moved to ' + arangoHelper.getDatabaseServerId(toServer) + '.');
} }
}); });
@ -213,7 +215,7 @@
if (data === true) { if (data === true) {
window.setTimeout(function () { window.setTimeout(function () {
self.render(false); self.render(false);
}, 1500); }, 3000);
arangoHelper.arangoNotification('Started rebalance process.'); arangoHelper.arangoNotification('Started rebalance process.');
} }
}, },
@ -287,7 +289,7 @@
if (doRerender) { if (doRerender) {
window.setTimeout(function () { window.setTimeout(function () {
self.render(); self.render();
}, 1500); }, 3000);
} }
}, },