diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-07-02 17:29:07 +0200 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-07-02 17:29:07 +0200 |
commit | 162977906265df2782845a092707f7176a6d5a45 (patch) | |
tree | d99d1b70d47ac4e3b8af258f29363302d0e0c973 /web/js/nms-info-box.js | |
parent | 88f59aee622a939c65b18cbcf5d59aaeda28bf96 (diff) |
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.
Diffstat (limited to 'web/js/nms-info-box.js')
-rw-r--r-- | web/js/nms-info-box.js | 30 |
1 files changed, 23 insertions, 7 deletions
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); /* |