mirror of https://github.com/jumpserver/jumpserver
feat: 为所有api添加搜索
parent
5d13f1e357
commit
a87ff2d880
|
@ -13,10 +13,12 @@ __all__ = [
|
||||||
class AdHocViewSet(OrgBulkModelViewSet):
|
class AdHocViewSet(OrgBulkModelViewSet):
|
||||||
serializer_class = AdHocSerializer
|
serializer_class = AdHocSerializer
|
||||||
permission_classes = ()
|
permission_classes = ()
|
||||||
|
search_fields = ('name', 'comment')
|
||||||
model = AdHoc
|
model = AdHoc
|
||||||
|
|
||||||
def allow_bulk_destroy(self, qs, filtered):
|
def allow_bulk_destroy(self, qs, filtered):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super().get_queryset()
|
queryset = super().get_queryset()
|
||||||
return queryset.filter(creator=self.request.user)
|
return queryset.filter(creator=self.request.user)
|
||||||
|
|
|
@ -118,6 +118,7 @@ class CeleryTaskExecutionViewSet(CommonApiMixin, viewsets.ModelViewSet):
|
||||||
serializer_class = CeleryTaskExecutionSerializer
|
serializer_class = CeleryTaskExecutionSerializer
|
||||||
http_method_names = ('get', 'post', 'head', 'options',)
|
http_method_names = ('get', 'post', 'head', 'options',)
|
||||||
queryset = CeleryTaskExecution.objects.all()
|
queryset = CeleryTaskExecution.objects.all()
|
||||||
|
search_fields = ('name',)
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
task_id = self.request.query_params.get('task_id')
|
task_id = self.request.query_params.get('task_id')
|
||||||
|
|
|
@ -26,6 +26,7 @@ def set_task_to_serializer_data(serializer, task):
|
||||||
class JobViewSet(OrgBulkModelViewSet):
|
class JobViewSet(OrgBulkModelViewSet):
|
||||||
serializer_class = JobSerializer
|
serializer_class = JobSerializer
|
||||||
permission_classes = ()
|
permission_classes = ()
|
||||||
|
search_fields = ('name', 'comment')
|
||||||
model = Job
|
model = Job
|
||||||
|
|
||||||
def allow_bulk_destroy(self, qs, filtered):
|
def allow_bulk_destroy(self, qs, filtered):
|
||||||
|
@ -63,6 +64,7 @@ class JobExecutionViewSet(OrgBulkModelViewSet):
|
||||||
http_method_names = ('get', 'post', 'head', 'options',)
|
http_method_names = ('get', 'post', 'head', 'options',)
|
||||||
permission_classes = ()
|
permission_classes = ()
|
||||||
model = JobExecution
|
model = JobExecution
|
||||||
|
search_fields = ('material',)
|
||||||
|
|
||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
instance = serializer.save()
|
instance = serializer.save()
|
||||||
|
|
|
@ -26,6 +26,7 @@ class PlaybookViewSet(OrgBulkModelViewSet):
|
||||||
serializer_class = PlaybookSerializer
|
serializer_class = PlaybookSerializer
|
||||||
permission_classes = ()
|
permission_classes = ()
|
||||||
model = Playbook
|
model = Playbook
|
||||||
|
search_fields = ('name', 'comment')
|
||||||
|
|
||||||
def allow_bulk_destroy(self, qs, filtered):
|
def allow_bulk_destroy(self, qs, filtered):
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue