mirror of https://gitee.com/bigwinds/arangodb
added scale function
This commit is contained in:
parent
1871ca9533
commit
009a02d402
|
@ -273,9 +273,32 @@
|
|||
this.buildSubNavBar(menus);
|
||||
},
|
||||
|
||||
scaleability: undefined,
|
||||
|
||||
//nav for cluster/nodes view
|
||||
buildNodesSubNav: function(type) {
|
||||
|
||||
if (this.scaleability === undefined) {
|
||||
var self = this;
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
cache: false,
|
||||
url: arangoHelper.databaseUrl("/_admin/cluster/numberOfServers"),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
if (data.numberOfCoordinators !== null && data.numberOfDBServers !== null) {
|
||||
self.scaleability = true;
|
||||
self.buildNodesSubNav();
|
||||
}
|
||||
else {
|
||||
self.scaleability = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var menus = {
|
||||
Coordinators: {
|
||||
route: '#cNodes'
|
||||
|
@ -285,13 +308,30 @@
|
|||
}
|
||||
};
|
||||
|
||||
menus.Scale = {
|
||||
route: '#sNodes',
|
||||
disabled: true
|
||||
};
|
||||
|
||||
if (type === 'coordinator') {
|
||||
menus.Coordinators.active = true;
|
||||
}
|
||||
else if (type === 'scale') {
|
||||
if (this.scaleability === true) {
|
||||
menus.Scale.active = true;
|
||||
}
|
||||
else {
|
||||
window.App.navigate('#nodes', {trigger: true});
|
||||
}
|
||||
}
|
||||
else {
|
||||
menus.DBServers.active = true;
|
||||
}
|
||||
|
||||
if (this.scaleability === true) {
|
||||
menus.Scale.disabled = false;
|
||||
}
|
||||
|
||||
this.buildSubNavBar(menus);
|
||||
},
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
"nodes": "cNodes",
|
||||
"cNodes": "cNodes",
|
||||
"dNodes": "dNodes",
|
||||
"sNodes": "sNodes",
|
||||
"node/:name": "node",
|
||||
//"nLogs/:name": "nLogs",
|
||||
"logs": "logs",
|
||||
|
@ -160,7 +161,10 @@
|
|||
|
||||
window.isCoordinator(callback);
|
||||
|
||||
this.initFinished = true;
|
||||
if (frontendConfig.isCluster === false) {
|
||||
this.initFinished = true;
|
||||
}
|
||||
|
||||
this.arangoDatabase = new window.ArangoDatabase();
|
||||
this.currentDB = new window.CurrentDatabase();
|
||||
|
||||
|
@ -320,6 +324,25 @@
|
|||
this.nodesView.render();
|
||||
},
|
||||
|
||||
sNodes: function (initialized) {
|
||||
this.checkUser();
|
||||
if (!initialized || this.isCluster === undefined) {
|
||||
this.waitForInit(this.sNodes.bind(this));
|
||||
return;
|
||||
}
|
||||
if (this.isCluster === false) {
|
||||
this.routes[""] = 'dashboard';
|
||||
this.navigate("#dashboard", {trigger: true});
|
||||
return;
|
||||
}
|
||||
|
||||
this.scaleView = new window.ScaleView({
|
||||
coordinators: this.coordinatorCollection,
|
||||
dbServers: this.dbServers[0]
|
||||
});
|
||||
this.scaleView.render();
|
||||
},
|
||||
|
||||
addAuth: function (xhr) {
|
||||
var u = this.clusterPlan.get("user");
|
||||
if (!u) {
|
||||
|
@ -823,8 +846,9 @@
|
|||
this.userManagementView.render(true);
|
||||
},
|
||||
|
||||
fetchDBS: function() {
|
||||
fetchDBS: function(callback) {
|
||||
var self = this;
|
||||
var cb = false;
|
||||
|
||||
this.coordinatorCollection.each(function(coordinator) {
|
||||
self.dbServers.push(
|
||||
|
@ -833,8 +857,20 @@
|
|||
})
|
||||
);
|
||||
});
|
||||
|
||||
this.initFinished = true;
|
||||
|
||||
_.each(this.dbServers, function(dbservers) {
|
||||
dbservers.fetch();
|
||||
dbservers.fetch({
|
||||
success: function() {
|
||||
if (cb === false) {
|
||||
if (callback) {
|
||||
callback();
|
||||
cb = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
<script id="clusterView.ejs" type="text/template">
|
||||
|
||||
<div class="headerBar" style="margin-top: -60px">
|
||||
<div class="headerButtonBar">
|
||||
<ul class="headerButtonList">
|
||||
<li class="enabled">
|
||||
<a id="exportCollection" class="headerButton">
|
||||
<span title="Scale cluster nodes"><i class="fa fa-sliders"></i></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="clusterContent" class="innerContent">
|
||||
|
||||
<div class="pure-g cluster-values">
|
||||
|
|
Loading…
Reference in New Issue