From e7022dcbe2863f0e682f1200de9ed81ef00e2103 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Sun, 22 May 2016 22:42:14 +0200 Subject: 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. --- web/js/nms-search.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'web/js/nms-search.js') 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) { -- cgit v1.2.3