mirror of https://gitee.com/bigwinds/arangodb
ui routes modified to fit cluster api
This commit is contained in:
parent
8e5a28d6fc
commit
a4e00b8c8d
|
@ -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: {},
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue