mirror of https://github.com/jumpserver/jumpserver
				
				
				
			feat: support protocols search
							parent
							
								
									980394efed
								
							
						
					
					
						commit
						8764cdb733
					
				| 
						 | 
				
			
			@ -13,3 +13,13 @@ class ProtocolListApi(ListAPIView):
 | 
			
		|||
 | 
			
		||||
    def get_queryset(self):
 | 
			
		||||
        return list(Protocol.protocols())
 | 
			
		||||
 | 
			
		||||
    def filter_queryset(self, queryset):
 | 
			
		||||
        search = self.request.query_params.get("search", "").lower().strip()
 | 
			
		||||
        if not search:
 | 
			
		||||
            return queryset
 | 
			
		||||
        queryset = [
 | 
			
		||||
            p for p in queryset
 | 
			
		||||
            if search in p['label'].lower() or search in p['value'].lower()
 | 
			
		||||
        ]
 | 
			
		||||
        return queryset
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -349,7 +349,7 @@ class Protocol(ChoicesMixin, models.TextChoices):
 | 
			
		|||
        for protocol, config in cls.settings().items():
 | 
			
		||||
            if not xpack_enabled and config.get('xpack', False):
 | 
			
		||||
                continue
 | 
			
		||||
            protocols.append(protocol)
 | 
			
		||||
            protocols.append({'label': protocol.label, 'value': protocol.value})
 | 
			
		||||
 | 
			
		||||
        from assets.models.platform import PlatformProtocol
 | 
			
		||||
        custom_protocols = (
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue