aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-05-23 23:38:40 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-05-23 23:38:40 +0200
commit78684bd2f31a6e8bd174219d363d116e1273f6a2 (patch)
treec627e4bd936741927acd1caac992ad7ab092fd96 /web
parent58875862f3e882cdbdd04ea3129646d9e9b1e173 (diff)
front: Use RegExp all over for searches
creates some interesting opportunities, as searches can be combined. E.g.: '(row\d+-2|distro0|presse) can be used to mark multiple different switches now. Or '(::1$|^noc$|127.*\.14$) etc. Could probably get rid of the ""-hack now too. It was mainly meant for the automatic oplog entry on switch-creation, which can now use "^switch$" instead.
Diffstat (limited to 'web')
-rw-r--r--web/js/nms-search.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/web/js/nms-search.js b/web/js/nms-search.js
index f5cfb8c..46c0571 100644
--- a/web/js/nms-search.js
+++ b/web/js/nms-search.js
@@ -8,6 +8,7 @@ var nmsSearch = nmsSearch || {
nmsSearch.helpText = [
"The search box can be used to identify switches in several ways. The simplest is by name.",
"Searching by name can be done by just entering text, or if you want to match \"foobar1\" but not \"foobar15\" you can enclose the name in quotation marks. E.g.: foobar1 matches foobar1 and foobar1123123123, while \"foobar1\" only matches exactly foobar1.",
+ "All text-oriented searches are regular expressions. ^row\\d-2$ matches row1-2, row2-2, etc, but not row13-2 or rowx-2.",
"If you are using the non-public version of Gondul, you can also perform smart searches.",
"Distro search: Type the name of a distro-switch and all access switches registered to that distro switch will also be hilighted.",
'Active ports: Type "active>x", "active<x" or "active=x" to identify switch with "x" amount of active gigabit ethernet (ge) ports. E.g.: "active>30".',
@@ -64,22 +65,22 @@ nmsSearch.searchTest = function(id, sw) {
}
} catch (e) {}
try {
- if (nmsData.smanagement.switches[sw].mgmt_v4_addr.match(id)) {
+ if (re.test(nmsData.smanagement.switches[sw].mgmt_v4_addr)) {
return true;
}
- if (nmsData.smanagement.switches[sw].mgmt_v6_addr.match(id)) {
+ if (re.test(nmsData.smanagement.switches[sw].mgmt_v6_addr)) {
return true;
}
} catch (e) {}
try {
- if (nmsData.smanagement.switches[sw].subnet4.match(id)) {
+ if (re.test(nmsData.smanagement.switches[sw].subnet4)) {
return true;
}
- if (nmsData.smanagement.switches[sw].subnet6.match(id)) {
+ if (re.test(nmsData.smanagement.switches[sw].subnet6)) {
return true;
}
} catch (e) {}
- if (nmsData.snmp.snmp[sw].misc.sysDescr[0].toLowerCase().match(id)) {
+ if (re.test(nmsData.snmp.snmp[sw].misc.sysDescr[0])) {
return true;
}
} catch (e) {