Fixed tag search case issue, #3136
Ylian Saint-Hilaire committed
Sep 15, 2021 at 19:12 UTC
c811fc6f162224c1a12c7eed41045de049c180f5
2 files changed
+5
-3
meshctrl.js
+2
-1
@@ -2211,7 +2211,8 @@ function getDevicesThatMatchFilter(nodes, x) {
2211
} else if (tagSearch != null) {
2212
// Tag filter
2213
for (var d in nodes) {
2214
- if (((nodes[d].tags == null) && (tagSearch == '')) || ((nodes[d].tags != null) && (nodes[d].tags.indexOf(tagSearch) >= 0))) { r.push(nodes[d]); }
2214
+ if ((nodes[d].tags == null) && (tagSearch == '')) { r.push(d); }
2215
+ else if (nodes[d].tags != null) { for (var j in nodes[d].tags) { if (nodes[d].tags[j].toLowerCase() == tagSearch) { r.push(d); break; } } }
2216
}
2217
} else if (agentTagSearch != null) {
2218
// Agent Tag filter
views/default.handlebars
+3
-2
@@ -5472,14 +5472,15 @@
5472
for (var d in nodes) { r.push(d); }
5473
} else if (ipSearch != null) {
5474
// IP address search
5475
- for (var d in nodes) { if ((nodes[d].ip != null) && (nodes[d].ip.indexOf(ipSearch) >= 0)) { r.push(d); } }
5475
+ for (var d in nodes) { if ((nodes[d].ip != null) && (nodes[d].ip.toLowerCase().indexOf(ipSearch) >= 0)) { r.push(d); } }
5476
} else if (groupSearch != null) {
5477
// Group filter
5478
for (var d in nodes) { if (meshes[nodes[d].meshid].name.toLowerCase().indexOf(groupSearch) >= 0) { r.push(d); } }
5479
} else if (tagSearch != null) {
5480
// Tag filter
5481
for (var d in nodes) {
5482
- if (((nodes[d].tags == null) && (tagSearch == '')) || ((nodes[d].tags != null) && (nodes[d].tags.indexOf(tagSearch) >= 0))) { r.push(d); }
5482
+ if ((nodes[d].tags == null) && (tagSearch == '')) { r.push(d); }
5483
+ else if (nodes[d].tags != null) { for (var j in nodes[d].tags) { if (nodes[d].tags[j].toLowerCase() == tagSearch) { r.push(d); break; } }}
5484
}
5485
} else if (agentTagSearch != null) {
5486
// Agent Tag filter