Skip to content

Commit ee0571b

Browse files
feat: trigger execution detail
1 parent 7efdb3c commit ee0571b

File tree

8 files changed

+366
-48
lines changed

8 files changed

+366
-48
lines changed

ui/src/locales/lang/en-US/views/trigger.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
title: 'Trigger',
33
tip: 'When triggered, the system will automatically call task execution based on the input parameters settings',
44
task: 'Task',
5+
triggerTask: 'Trigger Task',
56
taskExecution: 'Task Execution',
67
delete: {
78
confirmTitle: 'Confirm deleting trigger:',
@@ -38,6 +39,9 @@ export default {
3839
placeholder: 'Please enter the trigger name',
3940
requiredMessage: 'Please enter the trigger name',
4041
},
42+
event_url: {
43+
label: 'Copy URL to your application',
44+
},
4145
},
4246
requestParameter: 'Request Parameters',
4347
}

ui/src/locales/lang/zh-CN/views/trigger.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
title: '触发器',
33
tip: '触发时系统将会根据入参设置自动调用任务执行',
44
task: '任务',
5+
triggerTask: '触发任务',
56
taskExecution: '任务执行',
67
delete: {
78
confirmTitle: '是否删除触发器:',
@@ -38,6 +39,10 @@ export default {
3839
placeholder: '请输入触发器名称',
3940
requiredMessage: '请输入触发器名称',
4041
},
42+
event_url: {
43+
label: '复制 URL 到你的应用',
44+
},
4145
},
4246
requestParameter: '请求参数',
47+
xecutionRecord: '执行记录',
4348
}

ui/src/locales/lang/zh-Hant/views/trigger.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
title: '觸發器',
33
tip: '觸發時系統將會根據入參設置自動調用任務執行',
44
task: '任務',
5+
triggerTask: '觸發任務',
56
taskExecution: '任務執行',
67
delete: {
78
confirmTitle: '是否刪除觸發器:',
@@ -38,6 +39,9 @@ export default {
3839
placeholder: '請輸入觸發器名稱',
3940
requiredMessage: '請輸入觸發器名稱',
4041
},
42+
event_url: {
43+
label: '複製 URL 到你的應用',
44+
},
4145
},
4246
requestParameter: '請求參數',
4347
}

ui/src/views/knowledge-workflow/component/execution-record/ExecutionDetailDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<el-row :gutter="16" class="lighter">
2929
<el-col :span="6">
3030
<p class="color-secondary mb-4">{{ $t('workflow.initiator') }}</p>
31-
<p>{{ props.currentContent?.meta.user_name || '-' }}</p>
31+
<p>{{ props.currentContent?.meta?.user_name || '-' }}</p>
3232
</el-col>
3333
<el-col :span="6">
3434
<p class="color-secondary mb-4">{{ $t('common.status.label') }}</p>

ui/src/views/trigger/component/TriggerDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
</div>
112112
</div>
113113
<el-card v-if="form.trigger_type === 'EVENT'" shadow="never" class="card-never mt-16">
114-
<el-form-item label="复制 URL 到你的应用">
114+
<el-form-item :label="$t('views.trigger.from.event_url.label')">
115115
<div class="complex-input flex align-center w-full" style="background-color: #ffffff">
116116
<el-input class="complex-input__left" v-bind:modelValue="event_url"></el-input>
117117

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
<template>
2+
<el-drawer
3+
v-model="visible"
4+
size="800px"
5+
:modal="false"
6+
destroy-on-close
7+
:before-close="closeHandle"
8+
:close-on-click-modal="false"
9+
:close-on-press-escape="false"
10+
:show-close="false"
11+
>
12+
<template #header>
13+
<div class="flex align-center" style="margin-left: -8px">
14+
<el-button class="cursor mr-4" link @click.prevent="visible = false">
15+
<el-icon :size="20">
16+
<Back />
17+
</el-icon>
18+
</el-button>
19+
<h4>{{ $t('chat.executionDetails.title') }}</h4>
20+
</div>
21+
</template>
22+
<div>
23+
<el-scrollbar>
24+
<h4 class="title-decoration-1 mb-16 mt-4">
25+
{{ $t('workflow.ExecutionRecord') }}
26+
</h4>
27+
<el-card class="mb-24" shadow="never" style="--el-card-padding: 12px 16px">
28+
<el-row :gutter="16" class="lighter">
29+
<el-col :span="6">
30+
<p class="color-secondary mb-4">{{ $t('views.trigger.triggerTask') }}</p>
31+
<p class="flex align-center">
32+
<el-avatar shape="square" :size="22" style="background: none" class="mr-8">
33+
<img
34+
v-if="props.currentContent?.source_type === 'TOOL'"
35+
:src="resetUrl(props.currentContent?.source_icon, resetUrl('./favicon.ico'))"
36+
alt=""
37+
/>
38+
<img
39+
v-if="props.currentContent?.source_type === 'APPLICATION'"
40+
:src="resetUrl(props.currentContent?.source_icon, resetUrl('./favicon.ico'))"
41+
alt=""
42+
/>
43+
</el-avatar>
44+
45+
<span class="ellipsis-1" :title="props.currentContent?.source_name">{{
46+
props.currentContent?.source_name || '-'
47+
}}</span>
48+
</p>
49+
</el-col>
50+
<el-col :span="6">
51+
<p class="color-secondary mb-4">{{ $t('common.status.label') }}</p>
52+
<p>
53+
<el-text
54+
class="color-text-primary"
55+
v-if="props.currentContent?.state === 'SUCCESS'"
56+
>
57+
<el-icon class="color-success"><SuccessFilled /></el-icon>
58+
{{ $t('common.status.success') }}
59+
</el-text>
60+
<el-text
61+
class="color-text-primary"
62+
v-else-if="props.currentContent?.state === 'FAILURE'"
63+
>
64+
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
65+
{{ $t('common.status.fail') }}
66+
</el-text>
67+
<el-text
68+
class="color-text-primary"
69+
v-else-if="props.currentContent?.state === 'REVOKED'"
70+
>
71+
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
72+
{{ $t('common.status.REVOKED') }}
73+
</el-text>
74+
<el-text
75+
class="color-text-primary"
76+
v-else-if="props.currentContent?.state === 'REVOKE'"
77+
>
78+
<el-icon class="is-loading color-primary"><Loading /></el-icon>
79+
{{ $t('common.status.REVOKE') }}
80+
</el-text>
81+
<el-text class="color-text-primary" v-else>
82+
<el-icon class="is-loading color-primary"><Loading /></el-icon>
83+
{{ $t('common.status.STARTED') }}
84+
</el-text>
85+
</p>
86+
</el-col>
87+
<el-col :span="6">
88+
<p class="color-secondary mb-4">{{ $t('chat.KnowledgeSource.consumeTime') }}</p>
89+
<p>
90+
{{
91+
props.currentContent?.run_time != undefined
92+
? props.currentContent?.run_time?.toFixed(2) + 's'
93+
: '-'
94+
}}
95+
</p>
96+
</el-col>
97+
<el-col :span="6">
98+
<p class="color-secondary mb-4">{{ $t('chat.executionDetails.createTime') }}</p>
99+
<p>{{ datetimeFormat(props.currentContent?.create_time) }}</p>
100+
</el-col>
101+
</el-row>
102+
</el-card>
103+
<h4 class="title-decoration-1 mb-16 mt-4">
104+
{{ $t('chat.executionDetails.title') }}
105+
</h4>
106+
<template v-for="(item, index) in arraySort(detail ?? [], 'index')" :key="index">
107+
<ExecutionDetailCard :data="item"> </ExecutionDetailCard>
108+
</template>
109+
</el-scrollbar>
110+
</div>
111+
<template #footer>
112+
<div>
113+
<el-button @click="pre" :disabled="pre_disable || loading">{{
114+
$t('common.pages.prev')
115+
}}</el-button>
116+
<el-button @click="next" :disabled="next_disable || loading">{{
117+
$t('common.pages.next')
118+
}}</el-button>
119+
</div>
120+
</template>
121+
</el-drawer>
122+
</template>
123+
124+
<script setup lang="ts">
125+
import { ref, computed, watch } from 'vue'
126+
import { useRoute } from 'vue-router'
127+
import { arraySort } from '@/utils/array'
128+
import { isAppIcon, resetUrl } from '@/utils/common'
129+
import ExecutionDetailCard from '@/components/execution-detail-card/index.vue'
130+
import { datetimeFormat } from '@/utils/time'
131+
import triggerAPI from '@/api/trigger/trigger'
132+
const props = withDefaults(
133+
defineProps<{
134+
/**
135+
* 当前的action_id
136+
*/
137+
currentId: string
138+
currentContent: any
139+
/**
140+
* 下一条
141+
*/
142+
next: () => void
143+
/**
144+
* 上一条
145+
*/
146+
pre: () => void
147+
148+
pre_disable: boolean
149+
150+
next_disable: boolean
151+
}>(),
152+
{},
153+
)
154+
155+
const emit = defineEmits(['update:currentId', 'update:currentContent'])
156+
157+
const route = useRoute()
158+
159+
const apiType = computed(() => {
160+
if (route.path.includes('shared')) {
161+
return 'systemShare'
162+
} else if (route.path.includes('resource-management')) {
163+
return 'systemManage'
164+
} else {
165+
return 'workspace'
166+
}
167+
})
168+
169+
const detail = ref<any>(null)
170+
171+
const loading = ref(false)
172+
const visible = ref(false)
173+
174+
function closeHandle() {}
175+
176+
watch(
177+
() => props.currentId,
178+
() => {
179+
getDetail()
180+
},
181+
)
182+
183+
watch(visible, (bool) => {
184+
if (!bool) {
185+
emit('update:currentId', '')
186+
emit('update:currentContent', null)
187+
}
188+
})
189+
190+
function getDetail() {
191+
triggerAPI
192+
.getTriggerTaskRecordDetails(
193+
props.currentContent?.trigger_id,
194+
props.currentContent?.trigger_task_id,
195+
props.currentContent?.id,
196+
)
197+
.then((ok) => {
198+
detail.value = Object.values(ok.data.details)
199+
})
200+
}
201+
202+
const open = (row: any) => {
203+
visible.value = true
204+
}
205+
206+
defineExpose({
207+
open,
208+
})
209+
</script>
210+
<style lang="scss"></style>

0 commit comments

Comments
 (0)