diff options
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/nms-info-box.js | 31 | ||||
-rw-r--r-- | web/js/nms-map-handlers.js | 6 | ||||
-rw-r--r-- | web/js/nms-oplog.js | 4 | ||||
-rw-r--r-- | web/js/nms-ui-boxes.js | 4 | ||||
-rw-r--r-- | web/js/nms-ui-switch.js | 2 |
5 files changed, 10 insertions, 37 deletions
diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js index efb2d7b..6915b03 100644 --- a/web/js/nms-info-box.js +++ b/web/js/nms-info-box.js @@ -937,34 +937,13 @@ var switchSummaryPanel = function() { this.refresh(); }; this.refresh = function(reason) { - var content = []; - if (this.sw == false) { - console.log("ugh, cleanup failed?"); + if (this.box) { + this.box.refresh(); return; } - var topper = document.createElement("div"); - for ( var h in handlers ) { - if (handlers[h].getInfo != undefined) { - var tmp = handlers[h].getInfo(this.sw); - for (var x in tmp.data) { - 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]); - } - } - } - } - - var contentCleaned = []; - for(var i in content) { - if(content[i][1] == '' || content[i][1] == null) - continue; - contentCleaned.push(content[i]); - } - var table = nmsInfoBox._makeTable(contentCleaned); - topper.appendChild(table); - - this._render(topper); + this.box = new nmsSwitchSummary(this.sw); + this.box.attach(this.me) + this.box.show() }; }; nmsInfoBox.setLegendPick = function(tag,id) { diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js index 90f6922..d553fc0 100644 --- a/web/js/nms-map-handlers.js +++ b/web/js/nms-map-handlers.js @@ -387,11 +387,11 @@ function tempInfo(sw) var ret = new handlerInfo("temp","Temperature"); ret.why = "Temp"; ret.score = 0; - ret.data[0].value = "N/A"; + ret.data[0].value = undefined; if (testTree(nmsData,['switchstate','switches',sw,'temp'])) { var temp = nmsData.switchstate.switches[sw].temp; if (temp == undefined) { - ret.data[0].value = "N/A"; + ret.data[0].value = undefined; } else { temp = parseInt(temp); ret.data[0].value = temp + "°C"; @@ -475,7 +475,7 @@ function pingInfo(sw) ret.score = 900; } } else { - ret.data[0].value = "N/A - no ping replies"; + ret.data[0].value = "No ping replies"; ret.why = "No ping replies"; ret.score = 999; } diff --git a/web/js/nms-oplog.js b/web/js/nms-oplog.js index 42452ff..33b2c00 100644 --- a/web/js/nms-oplog.js +++ b/web/js/nms-oplog.js @@ -65,12 +65,8 @@ class nmsOplogInput extends nmsBox { this.nmsBox.searchbox.oninput(); } this.add(this._systems) - // This is to provide spacing.... should probably be solved in CSS. - // If this annoys you, then fix it. - this.add(new nmsBox("p",{html:{textContent:" ",style:{display: "inline"}}})) this._entry = new nmsBox("input", {html:{className:"form-control",type:"text",size:"30",placeholder:"Log entry"}}); this.add(this._entry) - this.add(new nmsBox("p",{html:{textContent:" ",style:{display: "inline"}}})) var button = new nmsBox("button",{html:{className:"btn btn-default",type:"button"}}); button.html.textContent = "Log"; button.container = this; diff --git a/web/js/nms-ui-boxes.js b/web/js/nms-ui-boxes.js index dda77c9..3de8ff2 100644 --- a/web/js/nms-ui-boxes.js +++ b/web/js/nms-ui-boxes.js @@ -214,13 +214,9 @@ class nmsTable extends nmsBox { var td1; var td2; tr = new nmsBox("tr"); - tr.html.className = content[0].toLowerCase().replace(/[^a-z0-9_]/g,""); for (var x in content) { var td = new nmsBox("td"); var child = content[x]; - if (x == 0) { - td.html.classList.add("left"); - } if (child instanceof nmsBox) { td.add(child); } else { diff --git a/web/js/nms-ui-switch.js b/web/js/nms-ui-switch.js index 0a9c52f..7887656 100644 --- a/web/js/nms-ui-switch.js +++ b/web/js/nms-ui-switch.js @@ -196,12 +196,14 @@ class nmsEditRow extends nmsBox { input.row = this; if (value.ro) { input.html.disabled = true; + input.html.title = "Read/only attribute"; } if (value instanceof nmsTypeSecret) { input.html.type = "password" input.html.autocomplete = "off" input.html.onfocus = function f() { this.type = "text" } input.html.oninput = function f() { this.type = "text" } + input.html.onblur = function f() { this.type = "password" } } input.html.onchange = function() { this.nmsBox.row.value = this.value |