Added DeviceSearchBarServerAndClientName option, #3260

Ylian Saint-Hilaire committed Nov 8, 2021 at 11:04 UTC 966392b779e6a6f90aa1cd4a940a0cdedf3063c3
4 files changed +18 -13
meshcentral-config-schema.json
+1
@@ -306,6 +306,7 @@
306 "loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
307 "guestDeviceSharing": { "type": "boolean", "default": true, "description": "When set to false, the desktop/terminal sharing link feature is not available." },
308 "autoRemoveInactiveDevices": { "type": "integer", "default": 0, "minimum": 0, "maximum": 2000, "description": "Number of days a device can be inactive before it's removed. 0 disables this feature. Device group setting will override this value." },
309 + "DeviceSearchBarServerAndClientName": { "type": "boolean", "default": false, "description": "When set to true, the devices search box will match on both the server name and client name of a device." },
310 "altMessenging": {
311 "type": "object",
312 "properties": {
views/default-mobile.handlebars
+9 -10
@@ -2055,6 +2055,7 @@
2055 updateNaggleFlags |= flags;
2056 if (updateNaggleTimer == null) {
2057 updateNaggleTimer = setTimeout(function () {
2058 + if (updateNaggleFlags & 1) { onSearchInputChanged(); }
2059 if (updateNaggleFlags & 4) { updateDevices(); updateDeviceDetails(); }
2060 if (updateNaggleFlags & 128) { updateMeshes(); }
2061 updateNaggleTimer = null;
@@ -2674,7 +2675,7 @@
2675 function onRealNameCheckBox() {
2676 showRealNames = Q('RealNameCheckBox').checked;
2677 putstore('showRealNames', showRealNames ? 1 : 0);
2677 - mainUpdate(4);
2678 + mainUpdate(5);
2679 }
2680
2681 function onOnlineCheckBox(e) {
@@ -2763,15 +2764,13 @@
2764 try {
2765 var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
2766 for (var d in nodes) {
2766 - nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase()));
2767 - if ((nodes[d].v == false) && nodes[d].tags) {
2768 - for (var s in nodes[d].tags) {
2769 - if (rx.test(nodes[d].tags[s].toLowerCase())) {
2770 - nodes[d].v = true;
2771 - break;
2772 - } else {
2773 - nodes[d].v = false;
2774 - }
2767 + if (features2 & 0x00008000) {
2768 + nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()));
2769 + } else {
2770 + if (showRealNames) {
2771 + nodes[d].v = (nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase());
2772 + } else {
2773 + nodes[d].v = rx.test(nodes[d].name.toLowerCase());
2774 }
2775 }
2776 }
views/default.handlebars
+7 -3
@@ -5577,10 +5577,14 @@
5577 try {
5578 var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
5579 for (var d in nodes) {
5580 - if (showRealNames) {
5581 - if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(d); }
5580 + if (features2 & 0x00008000) { // Both server and client names must match
5581 + if (rx.test(nodes[d].name.toLowerCase()) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()))) { r.push(d); }
5582 } else {
5583 - if (rx.test(nodes[d].name.toLowerCase())) { r.push(d); }
5583 + if (showRealNames) {
5584 + if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(d); }
5585 + } else {
5586 + if (rx.test(nodes[d].name.toLowerCase())) { r.push(d); }
5587 + }
5588 }
5589 }
5590 } catch (ex) { for (var d in nodes) { r.push(d); } }
webserver.js
+1
@@ -2846,6 +2846,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2846 if (domain.clipboardset == false) { features2 += 0x00001000; } // Disable clipboard set
2847 if ((typeof domain.desktop == 'object') && (domain.desktop.viewonly == true)) { features2 += 0x00002000; } // Indicates remote desktop is viewonly
2848 if (domain.mailserver != null) { features2 += 0x00004000; } // Indicates email server is active
2849 + if (domain.devicesearchbarserverandclientname) { features2 += 0x00008000; } // Search bar will find both server name and client name
2850 return { features: features, features2: features2 };
2851 }
2852