From c811fc6f162224c1a12c7eed41045de049c180f5 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 15 Sep 2021 19:12:10 -0700 Subject: [PATCH] Fixed tag search case issue, #3136 --- meshctrl.js | 3 ++- views/default.handlebars | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/meshctrl.js b/meshctrl.js index 002da181..187876e4 100644 --- a/meshctrl.js +++ b/meshctrl.js @@ -2211,7 +2211,8 @@ function getDevicesThatMatchFilter(nodes, x) { } else if (tagSearch != null) { // Tag filter for (var d in nodes) { - if (((nodes[d].tags == null) && (tagSearch == '')) || ((nodes[d].tags != null) && (nodes[d].tags.indexOf(tagSearch) >= 0))) { r.push(nodes[d]); } + if ((nodes[d].tags == null) && (tagSearch == '')) { r.push(d); } + else if (nodes[d].tags != null) { for (var j in nodes[d].tags) { if (nodes[d].tags[j].toLowerCase() == tagSearch) { r.push(d); break; } } } } } else if (agentTagSearch != null) { // Agent Tag filter diff --git a/views/default.handlebars b/views/default.handlebars index 9438fff0..7a150c7c 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -5472,14 +5472,15 @@ for (var d in nodes) { r.push(d); } } else if (ipSearch != null) { // IP address search - for (var d in nodes) { if ((nodes[d].ip != null) && (nodes[d].ip.indexOf(ipSearch) >= 0)) { r.push(d); } } + for (var d in nodes) { if ((nodes[d].ip != null) && (nodes[d].ip.toLowerCase().indexOf(ipSearch) >= 0)) { r.push(d); } } } else if (groupSearch != null) { // Group filter for (var d in nodes) { if (meshes[nodes[d].meshid].name.toLowerCase().indexOf(groupSearch) >= 0) { r.push(d); } } } else if (tagSearch != null) { // Tag filter for (var d in nodes) { - if (((nodes[d].tags == null) && (tagSearch == '')) || ((nodes[d].tags != null) && (nodes[d].tags.indexOf(tagSearch) >= 0))) { r.push(d); } + if ((nodes[d].tags == null) && (tagSearch == '')) { r.push(d); } + else if (nodes[d].tags != null) { for (var j in nodes[d].tags) { if (nodes[d].tags[j].toLowerCase() == tagSearch) { r.push(d); break; } }} } } else if (agentTagSearch != null) { // Agent Tag filter