From c70e294a0425a7d417bcf41677a55970e9e59489 Mon Sep 17 00:00:00 2001 From: Nicolai Tellefsen Date: Tue, 22 Mar 2016 20:34:56 +0100 Subject: NMS: Make sure switch redraw also redraws infotext --- web/nms.gathering.org/js/nms-map-handlers.js | 14 ++++++-------- web/nms.gathering.org/js/nms-map.js | 3 +++ 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'web/nms.gathering.org/js') diff --git a/web/nms.gathering.org/js/nms-map-handlers.js b/web/nms.gathering.org/js/nms-map-handlers.js index 0bec084..dac630a 100644 --- a/web/nms.gathering.org/js/nms-map-handlers.js +++ b/web/nms.gathering.org/js/nms-map-handlers.js @@ -235,15 +235,13 @@ function tempUpdater() continue; var tempObj = nmsData.snmp.snmp[sw]["misc"]["enterprises.2636.3.1.13.1.7.7.1.0.0"]; - Object.keys(tempObj).forEach(function (key) { - if(key == "") { - temp = tempObj[key] + "°C"; - t = temp_color(temp); - } - }); + if(tempObj[""]) { + temp = tempObj[""] + "°C"; + t = temp_color(temp); + nmsMap.setSwitchColor(sw, t); + nmsMap.setSwitchInfo(sw, temp); + } - nmsMap.setSwitchColor(sw, t); - nmsMap.setSwitchInfo(sw, temp); } } diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js index d595c4a..33c98b7 100644 --- a/web/nms.gathering.org/js/nms-map.js +++ b/web/nms.gathering.org/js/nms-map.js @@ -273,6 +273,9 @@ nmsMap._drawSwitch = function(sw) this._drawBox(this._c.switch.ctx, box['x'],box['y'],box['width'],box['height']); this._c.switch.ctx.shadowBlur = 0; this._drawText(this._c.text.ctx, sw,box); + + if(this._info[sw]) + this._drawSwitchInfo(sw); }; nmsMap._drawSwitchInfo = function(sw) { -- cgit v1.2.3 From 83bf82a8388e0207712b1fe9caff8935bcd06d46 Mon Sep 17 00:00:00 2001 From: Nicolai Tellefsen Date: Tue, 22 Mar 2016 20:48:31 +0100 Subject: NMS: Fix popovers embeded in info boxes --- web/nms.gathering.org/js/nms-info-box.js | 2 +- 1 file changed, 1 insertion(+), 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 2d12d56..e2c8eb7 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -88,6 +88,7 @@ nmsInfoBox._show = function(argument) { } this._container.appendChild(panel); this._container.style.display = "block"; + $('[data-toggle="popover"]').popover({placement:"top",container:'body'}); }; /* @@ -251,7 +252,6 @@ nmsInfoBox._windowTypes.switchInfo = { var commenttable = nmsInfoBox._makeCommentTable(comments); commenttable.id = "info-switch-comments-table"; domObj.appendChild(commenttable); - $(function () { $('[data-toggle="popover"]').popover({placement:"top",continer:'body'}) }) } // We have no data for this switch, but its still correct -- cgit v1.2.3 From 047b729a1e92446a1c5ce68f806b932b79c98642 Mon Sep 17 00:00:00 2001 From: Nicolai Tellefsen Date: Tue, 22 Mar 2016 21:00:57 +0100 Subject: NMS: Hide infobox when clicking empty canvas area --- web/nms.gathering.org/js/nms-info-box.js | 4 +--- web/nms.gathering.org/js/nms-map.js | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) (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 e2c8eb7..a2d4f86 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -5,9 +5,7 @@ * * Interface: nmsInfoBox.showWindow(windowType,optionalParameter), nmsInfoBox.hide(), nmsInfoBox.refresh() * - * Any windowTypes should at a minimum implement load, unload, getTitle, getContent, getChildContent - * - * TODO: Implement useful update methods on windowTypes + * Any windowTypes should at a minimum implement load, update, unload, getTitle, getContent, getChildContent * */ diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js index 33c98b7..7cbf274 100644 --- a/web/nms.gathering.org/js/nms-map.js +++ b/web/nms.gathering.org/js/nms-map.js @@ -413,6 +413,8 @@ nmsMap.canvasClick = function(e) } else { nmsInfoBox.click(sw); } + } else { + nmsInfoBox.hide(); } }; -- cgit v1.2.3