mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'sharding' of https://github.com/triAGENS/ArangoDB into sharding
This commit is contained in:
commit
e81e057510
|
@ -70,6 +70,25 @@
|
||||||
res.json(resList);
|
res.json(resList);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
controller.get("/Coordinators", function(req, res) {
|
||||||
|
var resList = [],
|
||||||
|
list = coords.getList(),
|
||||||
|
noBeat = beats.noBeat();
|
||||||
|
|
||||||
|
_.each(list, function(url, k) {
|
||||||
|
var v = {};
|
||||||
|
v.name = k;
|
||||||
|
v.url = url;
|
||||||
|
resList.push(v);
|
||||||
|
if (_.contains(noBeat, k)) {
|
||||||
|
v.status = "critical";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
v.status = "ok";
|
||||||
|
});
|
||||||
|
res.json(resList);
|
||||||
|
});
|
||||||
|
|
||||||
controller.get("/Databases", function(req, res) {
|
controller.get("/Databases", function(req, res) {
|
||||||
var list = dbs.getList();
|
var list = dbs.getList();
|
||||||
res.json(_.map(list, function(d) {
|
res.json(_.map(list, function(d) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true */
|
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true */
|
||||||
/*global window, Backbone */
|
/*global window, Backbone, console */
|
||||||
(function() {
|
(function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
window.ClusterCoordinators = Backbone.Collection.extend({
|
window.ClusterCoordinators = Backbone.Collection.extend({
|
||||||
|
@ -8,32 +8,47 @@
|
||||||
url: "/_admin/aardvark/cluster/Coordinators",
|
url: "/_admin/aardvark/cluster/Coordinators",
|
||||||
|
|
||||||
getList: function() {
|
getList: function() {
|
||||||
return [
|
this.fetch({
|
||||||
{
|
async: false
|
||||||
name: "Charly",
|
});
|
||||||
url: "tcp://192.168.0.1:1337",
|
return this.map(function(m) {
|
||||||
status: "ok"
|
return m.forList();
|
||||||
},
|
});
|
||||||
{
|
|
||||||
name: "Carlos",
|
|
||||||
url: "tcp://192.168.0.2:1337",
|
|
||||||
status: "critical"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Chantalle",
|
|
||||||
url: "tcp://192.168.0.5:1337",
|
|
||||||
status: "ok"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getOverview: function() {
|
getOverview: function() {
|
||||||
// Fake data
|
this.fetch({
|
||||||
return {
|
async: false
|
||||||
plan: 3,
|
});
|
||||||
having: 2,
|
var res = {
|
||||||
status: "critical"
|
plan: 0,
|
||||||
|
having: 0,
|
||||||
|
status: "ok"
|
||||||
|
},
|
||||||
|
updateStatus = function(to) {
|
||||||
|
if (res.status === "critical") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.status = to;
|
||||||
};
|
};
|
||||||
|
this.each(function(m) {
|
||||||
|
res.plan++;
|
||||||
|
switch (m.get("status")) {
|
||||||
|
case "ok":
|
||||||
|
res.having++;
|
||||||
|
break;
|
||||||
|
case "warning":
|
||||||
|
res.having++;
|
||||||
|
updateStatus("warning");
|
||||||
|
break;
|
||||||
|
case "critical":
|
||||||
|
updateStatus("critical");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.debug("Undefined server state occured. This is still in development");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
window.ClusterCollection = Backbone.Model.extend({
|
window.ClusterCollection = Backbone.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
"name": "",
|
"name": "",
|
||||||
"id": "",
|
|
||||||
"status": "ok"
|
"status": "ok"
|
||||||
},
|
},
|
||||||
|
|
||||||
idAttribute: "id",
|
idAttribute: "name",
|
||||||
|
|
||||||
forList: function() {
|
forList: function() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -4,15 +4,23 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.ClusterCoordinator = Backbone.Model.extend({
|
window.ClusterCoordinator = Backbone.Model.extend({
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
"name": "",
|
"name": "",
|
||||||
"url": ""
|
"url": "",
|
||||||
|
"status": "ok"
|
||||||
},
|
},
|
||||||
|
|
||||||
idAttribute: "name",
|
idAttribute: "name",
|
||||||
|
|
||||||
url: function() {
|
url: "/_admin/aardvark/cluster/Coordinators",
|
||||||
return "/_admin/aardvark/cluster/Coordinators";
|
|
||||||
|
forList: function() {
|
||||||
|
return {
|
||||||
|
name: this.get("name"),
|
||||||
|
status: this.get("status"),
|
||||||
|
url: this.get("url")
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -223,12 +223,21 @@ module.exports = function(karma) {
|
||||||
// 'test/specs/graphViewer/specNodeReducer/modularityJoinerSpec.js',
|
// 'test/specs/graphViewer/specNodeReducer/modularityJoinerSpec.js',
|
||||||
// 'test/specs/graphViewer/specWindowObjects/workerWrapperSpec.js',
|
// 'test/specs/graphViewer/specWindowObjects/workerWrapperSpec.js',
|
||||||
'test/specs/graphViewer/specContextMenu/contextMenuSpec.js',
|
'test/specs/graphViewer/specContextMenu/contextMenuSpec.js',
|
||||||
|
|
||||||
// Arango
|
// Arango
|
||||||
'test/specs/arango/arangoSpec.js',
|
'test/specs/arango/arangoSpec.js',
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
'test/specs/models/currentDatabaseSpec.js',
|
'test/specs/models/currentDatabaseSpec.js',
|
||||||
'test/specs/models/graphSpec.js',
|
'test/specs/models/graphSpec.js',
|
||||||
|
|
||||||
|
// Collections
|
||||||
|
'test/specs/collections/clusterServersSpec.js',
|
||||||
|
'test/specs/collections/clusterDatabasesSpec.js',
|
||||||
|
'test/specs/collections/clusterCollectionsSpec.js',
|
||||||
|
'test/specs/collections/clusterShardsSpec.js',
|
||||||
|
|
||||||
|
|
||||||
// Views
|
// Views
|
||||||
'test/specs/views/editListEntryViewSpec.js',
|
'test/specs/views/editListEntryViewSpec.js',
|
||||||
'test/specs/views/collectionViewSpec.js',
|
'test/specs/views/collectionViewSpec.js',
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Cluster Collection View", function() {
|
describe("Cluster Collection View", function() {
|
||||||
var view, div, shardsView, shardCol;
|
var view, div, shardsView, shardCol, server, db;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
server = "pavel";
|
||||||
|
db = "_system";
|
||||||
div = document.createElement("div");
|
div = document.createElement("div");
|
||||||
div.id = "clusterCollections";
|
div.id = "clusterCollections";
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
@ -81,7 +83,7 @@
|
||||||
view = new window.ClusterCollectionView({
|
view = new window.ClusterCollectionView({
|
||||||
collection: collCol
|
collection: collCol
|
||||||
});
|
});
|
||||||
view.render();
|
view.render(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not unrender the server view", function() {
|
it("should not unrender the server view", function() {
|
||||||
|
@ -117,27 +119,18 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to Documents", function() {
|
it("should be able to navigate to Documents", function() {
|
||||||
info = {
|
|
||||||
name: "Documents"
|
|
||||||
};
|
|
||||||
$("#Documents").click();
|
$("#Documents").click();
|
||||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
expect(shardsView.render).toHaveBeenCalledWith(db, "Documents", server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to Edges", function() {
|
it("should be able to navigate to Edges", function() {
|
||||||
info = {
|
|
||||||
name: "Edges"
|
|
||||||
};
|
|
||||||
$("#Edges").click();
|
$("#Edges").click();
|
||||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
expect(shardsView.render).toHaveBeenCalledWith(db, "Edges", server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to People", function() {
|
it("should be able to navigate to People", function() {
|
||||||
info = {
|
|
||||||
name: "People"
|
|
||||||
};
|
|
||||||
$("#People").click();
|
$("#People").click();
|
||||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
expect(shardsView.render).toHaveBeenCalledWith(db, "People", server);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Cluster Database View", function() {
|
describe("Cluster Database View", function() {
|
||||||
var view, div, colView, colCol;
|
var view, div, colView, colCol, server;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
server = "pavel";
|
||||||
div = document.createElement("div");
|
div = document.createElement("div");
|
||||||
div.id = "clusterDatabases";
|
div.id = "clusterDatabases";
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
view = new window.ClusterDatabaseView({
|
view = new window.ClusterDatabaseView({
|
||||||
collection: dbCol
|
collection: dbCol
|
||||||
});
|
});
|
||||||
view.render();
|
view.render(server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not render the Server view", function() {
|
it("should not render the Server view", function() {
|
||||||
|
@ -116,19 +117,19 @@
|
||||||
it("should be able to navigate to _system", function() {
|
it("should be able to navigate to _system", function() {
|
||||||
db = "_system";
|
db = "_system";
|
||||||
$("#" + db).click();
|
$("#" + db).click();
|
||||||
expect(colView.render).toHaveBeenCalledWith(db);
|
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to myDatabase", function() {
|
it("should be able to navigate to myDatabase", function() {
|
||||||
db = "myDatabase";
|
db = "myDatabase";
|
||||||
$("#" + db).click();
|
$("#" + db).click();
|
||||||
expect(colView.render).toHaveBeenCalledWith(db);
|
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to otherDatabase", function() {
|
it("should be able to navigate to otherDatabase", function() {
|
||||||
db = "otherDatabase";
|
db = "otherDatabase";
|
||||||
$("#" + db).click();
|
$("#" + db).click();
|
||||||
expect(colView.render).toHaveBeenCalledWith(db);
|
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,11 +57,8 @@
|
||||||
dbView.render.reset();
|
dbView.render.reset();
|
||||||
view.render.reset();
|
view.render.reset();
|
||||||
var name = o.primary.name;
|
var name = o.primary.name;
|
||||||
info = {
|
|
||||||
name: name
|
|
||||||
};
|
|
||||||
$(getTile(name)).click();
|
$(getTile(name)).click();
|
||||||
expect(dbView.render).toHaveBeenCalledWith(info);
|
expect(dbView.render).toHaveBeenCalledWith(name);
|
||||||
expect(view.render).toHaveBeenCalledWith(true);
|
expect(view.render).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,27 +22,27 @@
|
||||||
describe("rendering", function() {
|
describe("rendering", function() {
|
||||||
|
|
||||||
var s1, s2, s3, shards, shardCol,
|
var s1, s2, s3, shards, shardCol,
|
||||||
checkButtonContent = function(col, cls) {
|
checkButtonContent = function(sh, cls) {
|
||||||
var btn = document.getElementById(col.name);
|
var btn = document.getElementById(sh.id);
|
||||||
expect(btn).toBeOfClass("btn");
|
expect(btn).toBeOfClass("btn");
|
||||||
expect(btn).toBeOfClass("btn-server");
|
expect(btn).toBeOfClass("btn-server");
|
||||||
expect(btn).toBeOfClass("shard");
|
expect(btn).toBeOfClass("shard");
|
||||||
expect(btn).toBeOfClass("btn-" + cls);
|
expect(btn).toBeOfClass("btn-" + cls);
|
||||||
expect($(btn).text()).toEqual(col.name);
|
expect($(btn).text()).toEqual(sh.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
s1 = {
|
s1 = {
|
||||||
name: "Shard 1",
|
id: "Shard 1",
|
||||||
status: "ok"
|
status: "ok"
|
||||||
};
|
};
|
||||||
s2 = {
|
s2 = {
|
||||||
name: "Shard 2",
|
id: "Shard 2",
|
||||||
status: "warning"
|
status: "warning"
|
||||||
};
|
};
|
||||||
s3 = {
|
s3 = {
|
||||||
name: "Shard 3",
|
id: "Shard 3",
|
||||||
status: "critical"
|
status: "critical"
|
||||||
};
|
};
|
||||||
shards = [
|
shards = [
|
||||||
|
|
Loading…
Reference in New Issue