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);
},
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,
CollectionTypes: {},

View File

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

View File

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

View File

@ -93,9 +93,11 @@
if (!from) {
fromServer = $(e.currentTarget).parent().parent().attr('leader');
fromServer = arangoHelper.getDatabaseServerId(fromServer);
} else {
leader = $(e.currentTarget).parent().parent().attr('leader');
fromServer = from;
leader = arangoHelper.getDatabaseServerId(leader);
fromServer = arangoHelper.getDatabaseServerId(from);
}
var buttons = [];
@ -184,14 +186,14 @@
async: true,
success: function (data) {
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.App.shardsView.render();
}, 2000);
}, 3000);
}
},
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) {
window.setTimeout(function () {
self.render(false);
}, 1500);
}, 3000);
arangoHelper.arangoNotification('Started rebalance process.');
}
},
@ -287,7 +289,7 @@
if (doRerender) {
window.setTimeout(function () {
self.render();
}, 1500);
}, 3000);
}
},