From 14a7305a06c2a9651593137094a8d2f39af66c05 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Wed, 16 Mar 2016 21:26:09 +0000 Subject: NMS: Enable simple SNMP viewing. --- web/nms.gathering.org/js/nms-info-box.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'web/nms.gathering.org/js') 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 = ' ' + x + ' '; + swtitle.innerHTML = ' ' + x + ' '; 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"; -- cgit v1.2.3