aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/js/nms.js
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-03-16 19:31:48 +0000
committerKristian Lyngstol <kly@kly.no>2016-03-16 19:31:48 +0000
commit314bc052854aabb44dd9272ddd82176be5c469d5 (patch)
treef24943727a66aa32cb231830cd5f1f214d12ceb5 /web/nms.gathering.org/js/nms.js
parent77525f31852c93f7e336b0172a9f87674941fd09 (diff)
NMS: Implement improved ping map
e69-2 is looking good. Now with a separate age-entity. Not really used for anything fancy right now, but could be.
Diffstat (limited to 'web/nms.gathering.org/js/nms.js')
-rw-r--r--web/nms.gathering.org/js/nms.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/web/nms.gathering.org/js/nms.js b/web/nms.gathering.org/js/nms.js
index 0484ffa..025fab9 100644
--- a/web/nms.gathering.org/js/nms.js
+++ b/web/nms.gathering.org/js/nms.js
@@ -320,7 +320,17 @@ function setUpdater(fo)
{
nmsMap.reset();
nmsData.unregisterHandlerWildcard("mapHandler");
- fo.init();
+ try {
+ fo.init();
+ } catch (e) {
+ /*
+ * This can happen typically on initial load where the data
+ * hasn't been retrieved yet. Instead of breaking the
+ * entire init-process, just bail out here.
+ */
+ console.log("Possibly broken handler: " + fo.name);
+ console.log(e);
+ }
var foo = document.getElementById("updater_name");
foo.innerHTML = fo.name + " ";
document.location.hash = fo.tag;
@@ -455,6 +465,13 @@ function initNMS() {
nmsData.registerSource("ping", "/api/public/ping");
nmsData.registerSource("switches","/api/public/switches");
nmsData.registerSource("switchstate","/api/public/switch-state");
+
+ // This is a magic dummy-source, it's purpose is to give a unified
+ // way to get ticks every second. It is mainly meant to allow map
+ // handlers to register for ticks so they will execute without data
+ // (and thus notice stale data instead of showing a green ping-map
+ // despite no pings)
+ nmsData.registerSource("ticker","bananabananbanana");
// Private
nmsData.registerSource("snmp","/api/private/snmp");