aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/css/nms.css3
-rw-r--r--web/js/nms-info-box.js30
-rw-r--r--web/js/nms-map-handlers.js29
-rw-r--r--web/js/nms-map.js5
4 files changed, 48 insertions, 19 deletions
diff --git a/web/css/nms.css b/web/css/nms.css
index 9f2e246..3d523e2 100644
--- a/web/css/nms.css
+++ b/web/css/nms.css
@@ -23,6 +23,9 @@ canvas {
text-decoration: underline;
cursor: pointer;
}
+.clickable {
+ cursor: pointer;
+}
.left {
width: 22ch;
diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js
index d5d9e77..88b2073 100644
--- a/web/js/nms-info-box.js
+++ b/web/js/nms-info-box.js
@@ -246,6 +246,7 @@ var windowHandler = function () {
this.bodyObj = false;
this._panels = {};
this._view = "";
+ this._viewId = {};
this._window = {};
this.windowTypes = false;
this.panelTypes = false;
@@ -337,8 +338,15 @@ var windowHandler = function () {
this.show();
};
this.showView = function (viewId) {
- if(!viewId || viewId == '')
- viewId = "initial";
+ if(!viewId || viewId == '') {
+ console.log(this);
+ if (this._viewId[this._window.id] == undefined)
+ viewId = "initial";
+ else
+ viewId = this._viewId[this._window.id];
+ } else {
+ this._viewId[this._window.id] = viewId;
+ }
if(!this._window.views || !this._window.views[viewId])
return;
this.unloadView();
@@ -634,8 +642,6 @@ var switchPortsPanel = function () {
}
} catch(e) {};
-
-
groupObj.innerHTML = '<span class="panel-heading" style="display:block;"><a class="collapse-controller" role="button" data-toggle="collapse" href="#'+cleanObj+'-group">' + snmpJson[obj].ifDescr + ' </a><small>' + snmpJson[obj].ifAlias + '</small><span class="pull-right">' + traffic + '<i class="btn-xs ' + button + '"><span class="glyphicon ' + glyphicon + '" title="' + title + '" aria-hidden="true"></span></i></span></span>';
var groupObjCollapse = document.createElement("div");
@@ -1077,7 +1083,10 @@ var switchSummaryPanel = function() {
if (handlers[h].getInfo != undefined) {
var tmp = handlers[h].getInfo(this.sw);
for (var x in tmp.data) {
- content.push([tmp.data[x].description, tmp.data[x].value]);
+ if (tmp.data[x].value != undefined) {
+ var d = "<div class=\"clickable\" onclick='nmsInfoBox.setLegendPick(\""+ handlers[h].tag + "\", " + x + ");'>" + tmp.data[x].value + '</div>';
+ content.push([tmp.data[x].description, d]);
+ }
}
}
}
@@ -1086,8 +1095,6 @@ var switchSummaryPanel = function() {
for(var i in content) {
if(content[i][1] == '' || content[i][1] == null)
continue;
- if(content[i][1] == undefined || content[i][1])
- content[i][1] == "No data";
contentCleaned.push(content[i]);
}
var table = nmsInfoBox._makeTable(contentCleaned);
@@ -1095,6 +1102,15 @@ var switchSummaryPanel = function() {
this._render(table);
};
};
+nmsInfoBox.setLegendPick = function(tag,id) {
+ if (nms.legendPick != undefined) {
+ if (nms.legendPick.handler == tag && nms.legendPick.idx == id) {
+ nms.legendPick = undefined;
+ return;
+ }
+ }
+ nms.legendPick = {handler: tag, idx: id};
+}
nmsInfoBox.addPanelType("switchSummary",switchSummaryPanel);
/*
diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js
index 0abad4c..18e80dd 100644
--- a/web/js/nms-map-handlers.js
+++ b/web/js/nms-map-handlers.js
@@ -81,6 +81,7 @@ var handler_health = {
var handler_mgmt = {
getInfo:mgmtInfo,
+ tag:"mgmt",
name:"Management info"
};
@@ -132,15 +133,12 @@ function uplinkInfo(sw)
{
var ret = new handlerInfo("uplink","Uplinks");
ret.why = "Uplinks";
- ret.score =0;
+ ret.score = 0;
if (testTree(nmsData,['switchstate','switches',sw,'uplinks','live'])) {
var u = parseInt(nmsData.switchstate.switches[sw].uplinks.live);
var t = parseInt(nmsData.switchstate.switches[sw].uplinks.total);
- ret.data[0].value = u;
- ret.data[0].description = "Active uplinks";
- ret.data[1] = {};
- ret.data[1].value = t;
- ret.data[1].description = "Configured uplinks";
+ ret.data[0].value = u + " / " + t;
+ ret.data[0].description = "Uplinks (live/configured)";
if (nmsData.switches.switches[sw].subnet4 == undefined ||
nmsData.switches.switches[sw].subnet4 == null) {
if (u == t) {
@@ -499,10 +497,7 @@ function dhcpInfo(sw) {
if (testTree(nmsData,['dhcp','switches',sw,'clients'])) {
ret.data[1] = {};
ret.data[1].value = nmsData.dhcp.switches[sw].clients;
- ret.data[1].description = "Active clients";
- ret.data[2] = {};
- ret.data[2].value = nmsData.dhcp.switches[sw].addresses;
- ret.data[2].description = "Active IPs";
+ ret.data[1].description = "DHCP clients";
}
if (testTree(nmsData,['switches','switches',sw, 'tags'])) {
if (nmsData.switches.switches[sw].tags.includes('ignoredhcp')) {
@@ -719,6 +714,7 @@ function cpuInit() {
function healthInfo(sw) {
var worst = new handlerInfo("health", "Health");
+ var realdata = {};
worst.score = 0;
worst.why = "All good";
for (var h in handlers) {
@@ -727,6 +723,7 @@ function healthInfo(sw) {
if (handlers[h].getInfo == undefined)
continue;
var ret = handlers[h].getInfo(sw);
+ realdata[handlers[h].tag] = ret.data;
if (ret.score > worst.score) {
worst = ret;
}
@@ -735,6 +732,8 @@ function healthInfo(sw) {
description: "Health (lower is better)",
value: worst.score + " (" + worst.why + ")"
}];
+ realdata['health'] = worst.data;
+ worst.realdata = realdata;
return worst;
}
@@ -746,8 +745,14 @@ function healthUpdater() {
nmsMap.setSwitchColor(sw, nmsColor.getColorStop(worst.score));
if (worst.score > 200)
nmsMap.setSwitchInfo(sw, worst.tag);
- else
- nmsMap.setSwitchInfo(sw, undefined);
+ else {
+ if (nms.legendPick != undefined &&
+ testTree(worst.realdata,[nms.legendPick.handler,nms.legendPick.idx])) {
+ nmsMap.setSwitchInfo(sw,worst.realdata[nms.legendPick.handler][nms.legendPick.idx].value);
+ } else {
+ nmsMap.setSwitchInfo(sw, undefined);
+ }
+ }
}
}
diff --git a/web/js/nms-map.js b/web/js/nms-map.js
index f95cde5..5669acb 100644
--- a/web/js/nms-map.js
+++ b/web/js/nms-map.js
@@ -114,6 +114,11 @@ nmsMap.reset = function() {
};
nmsMap.setSwitchInfo = function(sw,info) {
+ if (info != undefined) {
+ var textl = info.length;
+ if (textl > 15)
+ info = info.slice(0,15);
+ }
if (this._info[sw] != info) {
this._info[sw] = info;
this._drawSwitchInfo(sw);