diff options
Diffstat (limited to 'web/nms.gathering.org/js/nms-info-box.js')
-rw-r--r-- | web/nms.gathering.org/js/nms-info-box.js | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js index 5f16ec2..e0f9273 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -15,8 +15,8 @@ var nmsInfoBox = nmsInfoBox || { stats: {}, _container: false, //Container window _window: false, //Active window (reference to _windowTypes object or false) - _windowTypes: [], //List of all avaliable window types -} + _windowTypes: [] //List of all avaliable window types +}; /* * Shows a window from the _windowTypes list @@ -34,7 +34,7 @@ nmsInfoBox.showWindow = function (windowName,argument) { return; } } -} +}; /* * Refresh the active window @@ -44,7 +44,7 @@ nmsInfoBox.showWindow = function (windowName,argument) { */ nmsInfoBox.refresh = function() { nmsInfoBox._show(); -} +}; /* * Internal function to show the active _window and pass along any arguments @@ -84,7 +84,7 @@ nmsInfoBox._show = function(argument) { } this._container.appendChild(panel); this._container.style.display = "block"; -} +}; /* * Hide the active window and tell it to unload @@ -99,7 +99,7 @@ nmsInfoBox.hide = function() { nmsData.unregisterHandler("switches","switchshower"); nmsData.unregisterHandler("smanagement","switchshower"); nmsData.unregisterHandler("snmp","switchshower"); -} +}; /* * Window type: Add Switch @@ -134,7 +134,7 @@ nmsInfoBox._windowTypes.addSwitch = { data:myData, success: function (data, textStatus, jqXHR) { var result = JSON.parse(data); - if(result.switches_addded.length > 0) { + if(result.switches_addded.length > 0) { // FIXME unresolved variable switches_addded nmsInfoBox.hide(); } nmsData.invalidate("switches"); @@ -230,9 +230,10 @@ nmsInfoBox._windowTypes.switchInfo = { var template = {}; nmsInfoBox._editValues = {}; + var place; for (var v in this.swi) { if (v == "placement") { - var place = JSON.stringify(this.swi[v]); + place = JSON.stringify(this.swi[v]); template[v] = place; continue; } @@ -317,7 +318,7 @@ nmsInfoBox._windowTypes.switchInfo = { nmsInfoBox.click = function(sw) { this.showWindow("switchInfo",sw); -} +}; /* * General-purpose table-maker? @@ -347,7 +348,7 @@ nmsInfoBox._makeTable = function(content, caption) { td2.innerHTML = content[v][1]; } return table; -} +}; /* * Create and return a table for comments. @@ -390,7 +391,7 @@ nmsInfoBox._makeCommentTable = function(content) { td2.innerHTML = comment["comment"]; } return table; -} +}; nmsInfoBox._searchSmart = function(id, sw) { if (nmsData.smanagement.switches[sw].distro == id) { @@ -422,7 +423,7 @@ nmsInfoBox._searchSmart = function(id, sw) { } } return false; -} +}; /* * FIXME: Not sure this belongs here, it's really part of the "Core" ui, @@ -465,21 +466,21 @@ nmsInfoBox._search = function() { document.getElementById("searchbox").dataset.match = ''; document.getElementById("searchbox").removeEventListener("keydown",nmsInfoBox._searchKeyListener,false); } -} +}; nmsInfoBox._searchKeyListener = function(e) { if(e.keyCode == 13) { var sw = document.getElementById("searchbox").dataset.match; nmsInfoBox.showWindow("switchInfo",sw); } -} +}; nmsInfoBox._nullBlank = function(x) { if (x == null || x == false || x == undefined) return ""; return x; -} +}; nmsInfoBox._editChange = function(sw, v) { @@ -500,13 +501,9 @@ nmsInfoBox._editChange = function(sw, v) { var myData = nmsInfoBox._editStringify(sw); var out = document.getElementById("edit-output"); out.value = myData; -} +}; nmsInfoBox._editStringify = function(sw) { - for (var key in nmsInfoBox._editValues) { - var val = nmsInfoBox._editValues[key]; - } - nmsInfoBox._editValues['sysname'] = sw; - var myData = JSON.stringify([nmsInfoBox._editValues]); - return myData; -} + nmsInfoBox._editValues['sysname'] = sw; + return JSON.stringify([nmsInfoBox._editValues]); +}; |