Skip to content

Commit 33a195f

Browse files
committed
feat: add trigger type annotation to ToolRecord and shared tool queries
1 parent a8d5e97 commit 33a195f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

apps/tools/serializers/tool.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ def get_tool_records(self, current_page: int, page_size: int):
907907
application_subquery = Application.objects.filter(id=OuterRef('source_id')).values('name')[:1]
908908
knowledge_subquery = Knowledge.objects.filter(id=OuterRef('source_id')).values('name')[:1]
909909
trigger_subquery = Trigger.objects.filter(id=OuterRef('source_id')).values('name')[:1]
910+
trigger_type_subquery = Trigger.objects.filter(id=OuterRef('source_id')).values('trigger_type')[:1]
910911

911912
query_set = QuerySet(ToolRecord)
912913
query_set = query_set.filter(
@@ -919,6 +920,12 @@ def get_tool_records(self, current_page: int, page_size: int):
919920
default=Value(''),
920921
output_field=CharField()
921922
)
923+
).annotate(
924+
trigger_type=Case(
925+
When(source_type='TRIGGER', then=Subquery(trigger_type_subquery)),
926+
default=Value(''),
927+
output_field=CharField()
928+
)
922929
).annotate(
923930
tool_name=Subquery(
924931
Tool.objects.filter(id=OuterRef('tool_id')).values('name')[:1]
@@ -947,6 +954,7 @@ def get_tool_records(self, current_page: int, page_size: int):
947954
'source_name': record.source_name,
948955
'tool_name': record.tool_name,
949956
'tool_icon': record.tool_icon,
957+
'trigger_type': record.trigger_type,
950958
}
951959
)
952960

ui/src/views/tool/execution-record/ExecutionDetailDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
<el-icon class="color-success" :size="16" v-if="detail?.state === 'SUCCESS'">
129129
<CircleCheck />
130130
</el-icon>
131-
<el-icon class="is-loading" :size="16" v-if="detail?.state === 'STARTED'">
131+
<el-icon class="is-loading" :size="16" v-else-if="detail?.state === 'STARTED'">
132132
<Loading />
133133
</el-icon>
134134
<el-icon class="color-danger" :size="16" v-else>

0 commit comments

Comments
 (0)