diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-03-16 21:26:09 +0000 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-03-16 21:26:09 +0000 |
commit | 14a7305a06c2a9651593137094a8d2f39af66c05 (patch) | |
tree | 98a104e1e6c93110b4b72217dcdcb065242c6e9b /web/nms.gathering.org/js/nms-info-box.js | |
parent | b1e9d762c58eb57e4d600750d1a4f0cbf47e7178 (diff) |
NMS: Enable simple SNMP viewing.
Diffstat (limited to 'web/nms.gathering.org/js/nms-info-box.js')
-rw-r--r-- | web/nms.gathering.org/js/nms-info-box.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js index 58beea5..b559ba2 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -64,6 +64,7 @@ nmsInfoBox._hide = function() swtop.style.display = 'none'; nmsInfoBox._showing = ""; nmsInfoBox._editHide(); + nmsInfoBox._snmpHide(); } /* @@ -173,6 +174,25 @@ nmsInfoBox._search = function() { } } +nmsInfoBox._snmp = function(x,tree) +{ + + nmsInfoBox._snmpHide(); + var container = document.createElement("div"); + container.id = "nmsInfoBox-snmp-show"; + + var swtop = document.getElementById("info-switch-parent"); + var output = document.createElement("output"); + output.id = "edit-output"; + output.style = "white-space: pre;"; + try { + output.value = JSON.stringify(nmsData.snmp.snmp[x][tree],null,4); + } catch(e) { + output.value = "(no recent data (yet)?)"; + } + container.appendChild(output); + swtop.appendChild(container); +} /* * Display info on switch "x" in the info-box * @@ -191,7 +211,7 @@ nmsInfoBox._show = function(x) nmsInfoBox._hide(); nmsInfoBox._showing = x; - swtitle.innerHTML = ' <button type="button" class="edit btn btn-xs btn-warning" onclick="nmsInfoBox._edit(\'' + x + '\');">Edit</button> ' + x + ' <button type="button" class="close" aria-label="Close" onclick="nmsInfoBox.hide();" style="float: right;"><span aria-hidden="true">×</span></button>'; + swtitle.innerHTML = ' <button type="button" class="edit btn btn-xs btn-warning" onclick="nmsInfoBox._edit(\'' + x + '\');">Edit</button> <button type="button" class="edit btn btn-xs btn-default" onclick="nmsInfoBox._snmp(\'' + x + '\',\'ports\');">Ports</button> <button type="button" class="edit btn btn-xs btn-default" onclick="nmsInfoBox._snmp(\'' + x + '\',\'misc\');">Misc</button> ' + x + ' <button type="button" class="close" aria-label="Close" onclick="nmsInfoBox.hide();" style="float: right;"><span aria-hidden="true">×</span></button>'; for (var v in sw) { if (v == "placement") { @@ -246,11 +266,17 @@ nmsInfoBox._editHide = function() { if (container != undefined) container.parentNode.removeChild(container); } +nmsInfoBox._snmpHide = function() { + var container = document.getElementById("nmsInfoBox-snmp-show"); + if (container != undefined) + container.parentNode.removeChild(container); +} nmsInfoBox._edit = function(sw) { var template = {}; var place = false; nmsInfoBox._editHide(); + nmsInfoBox._snmpHide(); var container = document.createElement("div"); container.id = "nmsInfoBox-edit-box"; |