aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/nms-search.js
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-05-22 22:42:14 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-05-22 22:42:14 +0200
commite7022dcbe2863f0e682f1200de9ed81ef00e2103 (patch)
treeacd25e6bebdcb3d2f12f905556c0e13cb5814a2d /web/js/nms-search.js
parent61e77fad0ed324cc57cc939b258bc31c6b2c6365 (diff)
front: Live search and tweaked mgmt info
Fixes #2 Also, since I didn't bother splitting the commits, this tweaks the information provided from the snmp handler and management handler. Notably treating IPv4 and IPv6 management addresses as equals.
Diffstat (limited to 'web/js/nms-search.js')
-rw-r--r--web/js/nms-search.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/js/nms-search.js b/web/js/nms-search.js
index 7d4c9a6..748c8c2 100644
--- a/web/js/nms-search.js
+++ b/web/js/nms-search.js
@@ -1,6 +1,8 @@
"use strict";
var nmsSearch = nmsSearch || {
+ _handler: false,
+ _lastId: false
};
nmsSearch.helpText = [
@@ -91,6 +93,18 @@ nmsSearch.reset = function() {
nmsSearch.search();
}
+nmsSearch._enableTimer = function() {
+ if (nmsSearch._handler == false) {
+ nmsSearch._handler = setInterval(nmsSearch.search,1000);
+ }
+}
+
+nmsSearch._disableTimer = function() {
+ if (nmsSearch._handler != false) {
+ clearInterval(nmsSearch.search);
+ }
+}
+
nmsSearch.search = function() {
var el = document.getElementById("searchbox");
var id = false;
@@ -108,7 +122,9 @@ nmsSearch.search = function() {
nmsMap.setSwitchHighlight(sw,false);
}
}
+ nmsSearch._enableTimer();
} else {
+ nmsSearch._disableTimer();
nmsMap.disableHighlights();
}
if(matches.length == 1) {