From 162977906265df2782845a092707f7176a6d5a45 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Sat, 2 Jul 2016 17:29:07 +0200 Subject: Customizable titles on health map and sticky panes Click a field in a switch summary and the health map will use it as a legend, assuming it isn't already showing information. And remember what panel was used last when browsing switches. --- web/js/nms-info-box.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'web/js/nms-info-box.js') 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 = '' + snmpJson[obj].ifDescr + ' ' + snmpJson[obj].ifAlias + '' + traffic + ''; 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 = "
" + tmp.data[x].value + '
'; + 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); /* -- cgit v1.2.3