aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Tellefsen <niccofyren@gmail.com>2016-03-22 20:34:56 +0100
committerNicolai Tellefsen <niccofyren@gmail.com>2016-03-22 20:34:56 +0100
commitc70e294a0425a7d417bcf41677a55970e9e59489 (patch)
treea6f2959dbf0e2bacc73032cf1f6b89d3d83190e6
parent66a7bec14c1f27ca566210978bc81da5f572034b (diff)
NMS: Make sure switch redraw also redraws infotext
-rw-r--r--web/nms.gathering.org/js/nms-map-handlers.js14
-rw-r--r--web/nms.gathering.org/js/nms-map.js3
2 files changed, 9 insertions, 8 deletions
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) {