From 5888975d67d5908034edb8116d65994797e3683e Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 23 Dec 2019 16:11:08 -0800 Subject: [PATCH] Fixed multi-desktop with filter, added tag:xxx filter. --- package.json | 2 +- views/default.handlebars | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a627f4ac..f5966821 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.6-l", + "version": "0.4.6-m", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default.handlebars b/views/default.handlebars index 325211e6..61b1afb0 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -3068,7 +3068,7 @@ if ((meshrights & 8) || (meshrights & 256)) { // Requires remote control rights or desktop view only rights //var conn = 0; //if ((node.conn & 1) != 0) { conn = 1; } else if ((node.conn & 6) != 0) { conn = 2; } // Check what type of connect we can do (Agent vs AMT) - if (node.conn & 1) { count++; } + if ((node.conn & 1) && (node.v == true)) { count++; } } } } @@ -3077,7 +3077,7 @@ // Perform connect all for (var i in nodes) { - if ((multiDesktop[nodes[i]._id] == null) && ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + nodes[i]._id) >= 0))) { + if ((nodes[i].v == true) && (multiDesktop[nodes[i]._id] == null) && ((multiDesktopFilter.length == 0) || (multiDesktopFilter.indexOf('devid_' + nodes[i]._id) >= 0))) { toggleKvmDevice(nodes[i]._id); } } @@ -3638,13 +3638,15 @@ function onConsoleFocus(x) { consoleFocus = x; } function onSearchInputChanged() { - var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', x); - var userSearch = null, ipSearch = null, groupSearch = null; + var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', Q('SearchInput').value); + var userSearch = null, ipSearch = null, groupSearch = null, tagSearch = null; if (x.startsWith("user:")) { userSearch = x.substring(5); } else if (x.startsWith("u:")) { userSearch = x.substring(2); } else if (x.startsWith("ip:")) { ipSearch = x.substring(3); } else if (x.startsWith("group:")) { groupSearch = x.substring(6); } else if (x.startsWith("g:")) { groupSearch = x.substring(2); } + else if (x.startsWith("tag:")) { tagSearch = Q('SearchInput').value.trim().substring(4); } + else if (x.startsWith("t:")) { tagSearch = Q('SearchInput').value.trim().substring(2); } if (x == '') { // No search @@ -3655,7 +3657,10 @@ } else if (groupSearch != null) { // Group filter for (var d in nodes) { nodes[d].v = (meshes[nodes[d].meshid].name.toLowerCase().indexOf(groupSearch) >= 0); } - } else if (userSearch != null) { + } else if (tagSearch != null) { + // Tag filter + for (var d in nodes) { nodes[d].v = ((nodes[d].tags != null) && (nodes[d].tags.indexOf(tagSearch) >= 0)); } + } else if (userSearch != null) { // User search for (var d in nodes) { nodes[d].v = false;