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