Skip to content

Commit

Permalink
dist update
Browse files Browse the repository at this point in the history
  • Loading branch information
derSascha committed Mar 9, 2017
1 parent e449b99 commit 7dace8e
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 63 deletions.
16 changes: 8 additions & 8 deletions _site/js/all.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion _site/js/collection/node/NodeListModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ var NodeListModel = Backbone.Collection.extend({
console.log("Inside NodeList");
},
url:function () {
return '/_cluster/state?filter_nodes=false&filter_metadata=true&filter_routing_table=true&filter_blocks=true&filter_indices=true';
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
return "/_cluster/state/master_node,nodes,metadata,routing_table,blocks"
}
else {
return '/_cluster/state?filter_nodes=false&filter_metadata=true&filter_routing_table=true&filter_blocks=true&filter_indices=true';
}
},
parse:function (data) {
if (data.master_node) {
Expand Down
10 changes: 4 additions & 6 deletions _site/js/model/node/NodeInfoModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ var NodeInfoModel = Backbone.Model.extend({
this.nodeId = args.nodeId;
},
url:function () {
if (this.nodeId) {
return '/_cluster/nodes/' + this.nodeId + '?all=true';
// 100rc1 return '/_nodes/' + this.nodeId + '?all=true';
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
return '/_cluster/nodes' + (this.nodeId ? '/' + this.nodeId : '') + '/_all';
}
else {
return '/_cluster/nodes?all=true';
//100rc1 return '/_nodes?all=true';
return '/_cluster/nodes' + (this.nodeId ? '/' + this.nodeId : '') + '?all=true';
}
}

});
});
61 changes: 32 additions & 29 deletions _site/js/model/node/NodeModelFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,51 @@

function NodeInfoModelFactory() {
this.create = function (nodeId) {
if (versionUtil.isNewer("0.99.0", cluster.versionNumber.concat)) {
var model = new NodeInfoModel({nodeId:nodeId, connectionRootURL:cluster.get("connectionRootURL")}); //{
var model = new NodeInfoModel({nodeId:nodeId, connectionRootURL:cluster.get("connectionRootURL")});
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
model.url = function () {
if (nodeId) {
return '/_nodes/' + nodeId + '?all=true';
}
else {
return '/_nodes?all=true';
}
return (nodeId) ? "/_nodes/" + (nodeId) + "/_all" : "/_nodes/_all"
};
return model;
}
else {
return new NodeInfoModel({nodeId:nodeId, connectionRootURL:cluster.get("connectionRootURL")});
else if (versionUtil.isNewer("0.99.0", cluster.versionNumber.concat)) {
model.url = function () {
return (nodeId) ? "/_nodes/" + (nodeId) + "?all=true" : "/_nodes?all=true"
};
}
return model;
}
}

function NodeStatsModelFactory() {
this.create = function (nodeId) {
if (versionUtil.isNewer("0.99.0", cluster.versionNumber.concat)) {
var model = new NodeStatsModel({nodeId:nodeId, connectionRootURL:cluster.get("connectionRootURL")}); //{
var model = new NodeStatsModel({nodeId:nodeId, connectionRootURL:cluster.get("connectionRootURL")});
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
model.url = function () {
return '/_nodes/' + this.nodeId + '/stats?all=1';
return '/_nodes/' + this.nodeId + '/stats/_all';
};
return model;
}
else {
return new NodeStatsModel({nodeId:nodeId, connectionRootURL:cluster.get("connectionRootURL")});
else if (versionUtil.isNewer("0.99.0", cluster.versionNumber.concat)) {
model.url = function () {
return '/_nodes/' + this.nodeId + '/stats?all=1';
};
}
return model;
}
}

function NodeStatsListModelFactory() {
this.create = function (selectedNodes) {
var model = new NodeStatsListModel({connectionRootURL:cluster.get("connectionRootURL"), selectedNodes:selectedNodes});
if (versionUtil.isNewer("0.99.0", cluster.versionNumber.concat)) {
var urlSuffix = '?all=1';
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
urlSuffix = '/_all';
}

model.url = function () {
var sNodes = this.get('selectedNodes');
if (sNodes == undefined || sNodes.length === 0) {
return '/_nodes/stats?all=1';
return '/_nodes/stats' + urlSuffix;
}
else {
var nodes = '';
Expand All @@ -68,27 +72,29 @@ function NodeStatsListModelFactory() {
nodes = nodes + ',';
}
}
return '/_nodes/' + nodes + '/stats?all=1';
return '/_nodes/' + nodes + '/stats' + urlSuffix;
}


};
return model;
}
else {
return model;
}
return model;
}
}

function NodeInfoListModelFactory() {
this.create = function (selectedNodes) {
var model = new NodeInfoListModel({connectionRootURL:cluster.get("connectionRootURL"), selectedNodes:selectedNodes});
if (versionUtil.isNewer("0.99.0", cluster.versionNumber.concat)) {
var urlSuffix = '?all=1';
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
urlSuffix = '/_all';
}

model.url = function () {
var sNodes = this.get('selectedNodes');
if (sNodes == undefined || sNodes.length === 0) {
return '/_nodes?all=1';
return '/_nodes' + urlSuffix;
}
else {
var nodes = '';
Expand All @@ -98,13 +104,10 @@ function NodeInfoListModelFactory() {
nodes = nodes + ',';
}
}
return '/_nodes/' + nodes + '?all=1';
return '/_nodes/' + nodes + urlSuffix;
}
};
return model;
}
else {
return model;
}
return model;
}
}
7 changes: 6 additions & 1 deletion _site/js/model/node/NodeStatsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ var NodeStatsModel = Backbone.Model.extend({
this.nodeId = args.nodeId;
},
url:function () {
return '/_cluster/nodes/' + this.nodeId + '/stats?all=true&plugin=true';
if (versionUtil.isNewerOrEqual("5.0.0", cluster.versionNumber.concat)) {
return '/_nodes/' + this.nodeId + '/stats/_all';
}
else {
return '/_cluster/nodes/' + this.nodeId + '/stats?all=true&plugin=true';
}
},
fetch:function (options) {
console.log('Fetching NodeStats');
Expand Down
68 changes: 61 additions & 7 deletions _site/js/model/rest/RESTModelFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,64 @@

function RESTModelFactory() {
this.create = function (command) {
var model = new RESTModel({connectionRootURL:cluster.get("connectionRootURL"), cmd:command}); //{
if (versionUtil.isNewer("0.99.0", cluster.get("versionNumber").concat)) {
var model = new RESTModel({connectionRootURL:cluster.get("connectionRootURL"), cmd:command});
if (versionUtil.isNewerOrEqual("5.0.0", cluster.get("versionNumber").concat)) {
model.url = function () {
if (this.cmd == 'health') {
this.fetchURL = '/_cluster/health';
}
else if (this.cmd == 'state') {
this.fetchURL = '/_cluster/state';
}
else if (this.cmd == 'cluster_settings') {
this.fetchURL = '/_cluster/settings';
}
else if (this.cmd == 'ping') {
this.fetchURL = '/';
}
else if (this.cmd == 'nodeinfo') {
this.fetchURL = '/_nodes/_all';
}
else if (this.cmd == 'nodestats') {
this.fetchURL = '/_nodes/stats/_all';
}
else if (this.cmd == 'indexaliases') {
this.fetchURL = '/_aliases';
}
else if (this.cmd == 'indexsettings') {
this.fetchURL = '/_settings';
}
else if (this.cmd == 'indexstats') {
this.fetchURL = '/_stats/_all';
}
else if (this.cmd == 'indexstatus') {
this.fetchURL = '/_status';
}
else if (this.cmd == 'indexsegments') {
this.fetchURL = '/_segments';
}
else if (this.cmd == 'indexmappings') {
this.fetchURL = '/_mapping';
}
else if (this.cmd == 'indexrefresh') {
this.fetchURL = '/_refresh';
}
else if (this.cmd == 'indexflush') {
this.fetchURL = '/_flush';
}
else if (this.cmd == 'indexoptimize') {
this.fetchURL = '/_optimize';
}
else if (this.cmd == 'indexclearcache') {
this.fetchURL = '/_cache/clear';
}
else {
this.fetchURL = '/';
}
return this.fetchURL;
};
}
else if (versionUtil.isNewer("0.99.0", cluster.get("versionNumber").concat)) {
model.url = function () {
if (this.cmd == 'health') {
this.fetchURL = '/_cluster/health';
Expand Down Expand Up @@ -72,11 +128,9 @@ function RESTModelFactory() {
else {
this.fetchURL = '/';
}
return this.fetchURL; };
return model;
}
else {
return model;
return this.fetchURL;
};
}
return model;
}
}
3 changes: 2 additions & 1 deletion _site/js/model/settings/StatsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ var StatsModel = Backbone.Model.extend({
if (theNode.os.cpu !== undefined) {
_this.get('stats').cpucores = theNode.os.cpu.total_cores;
}
console.error(theNode.os);
if (theNode.os.mem !== undefined) {
_this.get('stats').totalmemory = theNode.os.mem.total_in_bytes;
}
Expand Down Expand Up @@ -126,4 +127,4 @@ var StatsModel = Backbone.Model.extend({
}

}
});
});
26 changes: 25 additions & 1 deletion _site/js/util/versionutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,28 @@ versionUtil.isNewer = function (a, b) {

}
return false;
};
};

/**
* @param a base to compare
* @param b arg to compare
* @return {Boolean} true if b >= a
*/
versionUtil.isNewerOrEqual = function (a, b) {
try {
var partsA = a.split('.');
var partsB = b.split('.');
var numParts = partsA.length > partsB.length ? partsA.length : partsB.length;
var i;

for (i = 0; i < numParts; i++) {
if ((parseInt(partsB[i], 10) || 0) !== (parseInt(partsA[i], 10) || 0)) {
return ((parseInt(partsB[i], 10) || 0) >= (parseInt(partsA[i], 10) || 0));
}
}
return false;
} catch (e) {

}
return false;
};
3 changes: 2 additions & 1 deletion _site/js/view/node/NodeStatsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var NodeStatView = Backbone.View.extend(
var nodeId = nodeStat.nodeId;
var jvmStats = this.buildJVMStats(nodeStat);
var osStats = nodeStat.nodes[nodeId].os;
console.error("Got: ", osStats);
var processStats = nodeStat.nodes[nodeId].process;
var nodeName = nodeStat.nodes[nodeId].name;
var address = nodeStat.nodes[nodeId].transport_address;
Expand Down Expand Up @@ -372,4 +373,4 @@ var NodeStatView = Backbone.View.extend(
threadindexchart: undefined,
threadsearchdata: undefined,
threadsearchchart: undefined
});
});
16 changes: 8 additions & 8 deletions js/all.min.js

Large diffs are not rendered by default.

0 comments on commit 7dace8e

Please sign in to comment.