diff --git a/apps/trigger/serializers/trigger_task.py b/apps/trigger/serializers/trigger_task.py index 0e460b34cc0..baa28e0a162 100644 --- a/apps/trigger/serializers/trigger_task.py +++ b/apps/trigger/serializers/trigger_task.py @@ -127,6 +127,7 @@ class TriggerTaskRecordQuerySerializer(serializers.Serializer): workspace_id = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_("Workspace ID")) state = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_('Trigger state')) name = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_('Trigger name')) + source_type = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_('Source type')) order = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_('Order field')) def is_valid(self, *, raise_exception=False): @@ -146,6 +147,7 @@ def get_query_set(self): 'sdc.name': models.CharField(), 'ett.workspace_id': models.CharField(), 'ett.trigger_id': models.UUIDField(), + 'sdc.source_type': models.CharField() })) trigger_query_set = trigger_query_set.filter( **{'ett.trigger_id': self.data.get("trigger_id")}) @@ -157,6 +159,8 @@ def get_query_set(self): trigger_query_set = trigger_query_set.filter(**{'ett.state': self.data.get('state')}) if self.data.get("name"): trigger_query_set = trigger_query_set.filter(**{'sdc.name__contains': self.data.get('name')}) + if self.data.get('source_type'): + trigger_query_set = trigger_query_set.filter(**{'sdc.source_type': self.data.get('source_type')}) return trigger_query_set def list(self, with_valid=True): diff --git a/apps/trigger/views/trigger_task.py b/apps/trigger/views/trigger_task.py index 1ccca750afd..d105127cdd8 100644 --- a/apps/trigger/views/trigger_task.py +++ b/apps/trigger/views/trigger_task.py @@ -10,6 +10,8 @@ from drf_spectacular.utils import extend_schema from rest_framework.request import Request from rest_framework.views import APIView + +from common.auth import TokenAuth from common.auth.authentication import has_permissions from common import result from trigger.api.trigger_task import TriggerTaskRecordExecutionDetailsAPI, TriggerTaskRecordPageAPI, TriggerTaskAPI @@ -20,6 +22,8 @@ class TriggerTaskView(APIView): + authentication_classes = [TokenAuth] + @extend_schema( methods=['GET'], description=_('Get the task list of triggers'), @@ -43,6 +47,8 @@ class TriggerTaskRecordView(APIView): class TriggerTaskRecordExecutionDetailsView(APIView): + authentication_classes = [TokenAuth] + @extend_schema( methods=['GET'], description=_('Retrieve detailed records of tasks executed by the trigger.'), @@ -66,6 +72,8 @@ def get(self, request: Request, workspace_id: str, trigger_id: str, trigger_task class TriggerTaskRecordPageView(APIView): + authentication_classes = [TokenAuth] + @extend_schema( methods=['GET'], description=_('Get a paginated list of execution records for trigger tasks.'), @@ -83,6 +91,7 @@ def get(self, request: Request, workspace_id: str, trigger_id: str, current_page return result.success( TriggerTaskRecordQuerySerializer( data={'workspace_id': workspace_id, 'trigger_id': trigger_id, + 'source_type': request.query_params.get('source_type'), 'state': request.query_params.get('state'), 'name': request.query_params.get('name')}) .page(current_page, page_size)) diff --git a/ui/src/locales/lang/en-US/common.ts b/ui/src/locales/lang/en-US/common.ts index 238563c59ed..7e8fef2bd3a 100644 --- a/ui/src/locales/lang/en-US/common.ts +++ b/ui/src/locales/lang/en-US/common.ts @@ -148,4 +148,5 @@ export default { title: 'Execution Record', subTitle: 'View Execution Record', }, + sourceType: 'Source type', } diff --git a/ui/src/locales/lang/zh-CN/common.ts b/ui/src/locales/lang/zh-CN/common.ts index 8b77bb7ae61..76e58ab0404 100644 --- a/ui/src/locales/lang/zh-CN/common.ts +++ b/ui/src/locales/lang/zh-CN/common.ts @@ -147,5 +147,6 @@ export default { ExecutionRecord: { title: '执行记录', subTitle: '查看执行记录', - } + }, + sourceType: '资源类型', } diff --git a/ui/src/locales/lang/zh-Hant/common.ts b/ui/src/locales/lang/zh-Hant/common.ts index 740b9c8f92f..1d031079df6 100644 --- a/ui/src/locales/lang/zh-Hant/common.ts +++ b/ui/src/locales/lang/zh-Hant/common.ts @@ -147,4 +147,5 @@ export default { title: '執行記錄', subTitle: '查看執行記錄', }, + sourceType: '資源類型', } diff --git a/ui/src/views/trigger/execution-record/TriggerTaskRecordDrawer.vue b/ui/src/views/trigger/execution-record/TriggerTaskRecordDrawer.vue index 541bb9a3f79..668ce99ec02 100644 --- a/ui/src/views/trigger/execution-record/TriggerTaskRecordDrawer.vue +++ b/ui/src/views/trigger/execution-record/TriggerTaskRecordDrawer.vue @@ -16,6 +16,7 @@ > + + + + + >([]) const query = ref({ state: '', name: '', + source_type: '', order: '', }) const loading = ref(false) @@ -222,7 +239,6 @@ const getList = (isLoading?: boolean) => { } else return Promise.resolve() } - const pre_disable = computed(() => { const index = tableData.value.findIndex((item) => item.id === currentId.value) return index === 0 && paginationConfig.current_page === 1