mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Added device group name to search results as config option (#5544)
This commit is contained in:
		
							parent
							
								
									a3717095e7
								
							
						
					
					
						commit
						bc0550a791
					
				
					 5 changed files with 47 additions and 12 deletions
				
			
		| 
						 | 
					@ -1204,6 +1204,11 @@ See description for information about each item.
 | 
				
			||||||
            "default": false,
 | 
					            "default": false,
 | 
				
			||||||
            "description": "When set to true, the devices search box will match on both the server name and client name of a device."
 | 
					            "description": "When set to true, the devices search box will match on both the server name and client name of a device."
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
 | 
					          "deviceSearchBarGroupName": {
 | 
				
			||||||
 | 
					            "type": "boolean",
 | 
				
			||||||
 | 
					            "default": false,
 | 
				
			||||||
 | 
					            "description": "When set to true, the devices search box will match on group name too."
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
          "agentSelfGuestSharing": {
 | 
					          "agentSelfGuestSharing": {
 | 
				
			||||||
            "type": [
 | 
					            "type": [
 | 
				
			||||||
              "boolean",
 | 
					              "boolean",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1197,6 +1197,11 @@
 | 
				
			||||||
            "default": false,
 | 
					            "default": false,
 | 
				
			||||||
            "description": "When set to true, the devices search box will match on both the server name and client name of a device."
 | 
					            "description": "When set to true, the devices search box will match on both the server name and client name of a device."
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
 | 
					          "deviceSearchBarGroupName": {
 | 
				
			||||||
 | 
					            "type": "boolean",
 | 
				
			||||||
 | 
					            "default": false,
 | 
				
			||||||
 | 
					            "description": "When set to true, the devices search box will match on group name too."
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
          "agentSelfGuestSharing": {
 | 
					          "agentSelfGuestSharing": {
 | 
				
			||||||
            "type": [
 | 
					            "type": [
 | 
				
			||||||
              "boolean",
 | 
					              "boolean",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2904,12 +2904,24 @@
 | 
				
			||||||
                    var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
 | 
					                    var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
 | 
				
			||||||
                    for (var d in nodes) {
 | 
					                    for (var d in nodes) {
 | 
				
			||||||
                        if (features2 & 0x00008000) {
 | 
					                        if (features2 & 0x00008000) {
 | 
				
			||||||
                            nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()));
 | 
					                            if(features2 & 0x10000000){
 | 
				
			||||||
 | 
					                                nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || (rx.test(meshes[nodes[d].meshid].name.toLowerCase())) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()));
 | 
				
			||||||
 | 
					                            }else {
 | 
				
			||||||
 | 
					                                nodes[d].v = (rx.test(nodes[d].name.toLowerCase())) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()));
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            if (showRealNames) {
 | 
					                            if(features2 & 0x10000000){
 | 
				
			||||||
                                nodes[d].v = (nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase());
 | 
					                                if (showRealNames) {
 | 
				
			||||||
                            } else {
 | 
					                                    nodes[d].v = (nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()) || (rx.test(meshes[nodes[d].meshid].name.toLowerCase()));
 | 
				
			||||||
                                nodes[d].v = rx.test(nodes[d].name.toLowerCase());
 | 
					                                } else {
 | 
				
			||||||
 | 
					                                    nodes[d].v = rx.test(nodes[d].name.toLowerCase()) || (rx.test(meshes[nodes[d].meshid].name.toLowerCase()));
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }else{
 | 
				
			||||||
 | 
					                                if (showRealNames) {
 | 
				
			||||||
 | 
					                                    nodes[d].v = (nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase());
 | 
				
			||||||
 | 
					                                } else {
 | 
				
			||||||
 | 
					                                    nodes[d].v = rx.test(nodes[d].name.toLowerCase());
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6157,15 +6157,27 @@
 | 
				
			||||||
                // Device name search
 | 
					                // Device name search
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
 | 
					                    var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
 | 
				
			||||||
                    for (var d in nodes) {
 | 
					                      for (var d in nodes) {
 | 
				
			||||||
                        if (features2 & 0x00008000) { // Both server and client names must match
 | 
					                        if (features2 & 0x00008000) { // Both server and client names must match
 | 
				
			||||||
                            if (rx.test(nodes[d].name.toLowerCase()) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()))) { r.push(d); }
 | 
					                            if(features2 & 0x10000000){
 | 
				
			||||||
                        } else {
 | 
					                                if (rx.test(nodes[d].name.toLowerCase()) || rx.test(meshes[nodes[d].meshid].name.toLowerCase()) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()))) { r.push(d); }
 | 
				
			||||||
                            if (showRealNames) {
 | 
					                            }else {
 | 
				
			||||||
                                if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(d); }
 | 
					                                if (rx.test(nodes[d].name.toLowerCase()) || ((nodes[d].rnamel != null) && rx.test(nodes[d].rnamel.toLowerCase()))) { r.push(d); }
 | 
				
			||||||
                            } else {
 | 
					 | 
				
			||||||
                                if (rx.test(nodes[d].name.toLowerCase())) { r.push(d); }
 | 
					 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					                        } else {
 | 
				
			||||||
 | 
					                            if(features2 & 0x10000000){
 | 
				
			||||||
 | 
					                                if (showRealNames) {
 | 
				
			||||||
 | 
					                                    if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase()) || rx.test(meshes[nodes[d].meshid].name.toLowerCase()) ) { r.push(d); }
 | 
				
			||||||
 | 
					                                } else {
 | 
				
			||||||
 | 
					                                    if (rx.test(nodes[d].name.toLowerCase()) || rx.test(meshes[nodes[d].meshid].name.toLowerCase()) ) { r.push(d); }
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }else {
 | 
				
			||||||
 | 
					                                if (showRealNames) {
 | 
				
			||||||
 | 
					                                    if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(d); }
 | 
				
			||||||
 | 
					                                } else {
 | 
				
			||||||
 | 
					                                    if (rx.test(nodes[d].name.toLowerCase())) { r.push(d); }
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }       
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } catch (ex) { for (var d in nodes) { r.push(d); } }
 | 
					                } catch (ex) { for (var d in nodes) { r.push(d); } }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3226,6 +3226,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
 | 
				
			||||||
        if ((parent.msgserver != null) && (parent.msgserver.providers != 0)) { features2 += 0x02000000; } // User messaging server is enabled
 | 
					        if ((parent.msgserver != null) && (parent.msgserver.providers != 0)) { features2 += 0x02000000; } // User messaging server is enabled
 | 
				
			||||||
        if ((parent.msgserver != null) && (parent.msgserver.providers != 0) && ((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false))) { features2 += 0x04000000; } // User messaging 2FA is allowed
 | 
					        if ((parent.msgserver != null) && (parent.msgserver.providers != 0) && ((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.msg2factor != false))) { features2 += 0x04000000; } // User messaging 2FA is allowed
 | 
				
			||||||
        if (domain.scrolltotop == true) { features2 += 0x08000000; } // Show the "Scroll to top" button
 | 
					        if (domain.scrolltotop == true) { features2 += 0x08000000; } // Show the "Scroll to top" button
 | 
				
			||||||
 | 
					        if (domain.devicesearchbargroupname === true) { features2 += 0x10000000; } // Search bar will find by group name too
 | 
				
			||||||
        return { features: features, features2: features2 };
 | 
					        return { features: features, features2: features2 };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue