Skip to content

Commit 317d630

Browse files
perf: Execution details
1 parent 3e1d34b commit 317d630

File tree

8 files changed

+204
-89
lines changed

8 files changed

+204
-89
lines changed

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"cropperjs": "^1.6.2",
2929
"dingtalk-jsapi": "^3.1.0",
3030
"echarts": "^5.6.0",
31+
"el-table-infinite-scroll": "^3.0.8",
3132
"element-plus": "^2.11.7",
3233
"file-saver": "^2.0.5",
3334
"highlight.js": "^11.11.1",
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<el-table
3+
:max-height="tableHeight"
4+
v-bind="$attrs"
5+
ref="appTableRef"
6+
:height="tableHeight + 'px'"
7+
v-el-table-infinite-scroll="load"
8+
:infinite-scroll-disabled="disabled"
9+
>
10+
<slot></slot>
11+
</el-table>
12+
</template>
13+
<script setup lang="ts">
14+
import { ref, nextTick, watch, computed, onMounted } from 'vue'
15+
import { default as vElTableInfiniteScroll } from 'el-table-infinite-scroll'
16+
defineOptions({ name: 'AppTableInfiniteScroll' })
17+
18+
const props = defineProps({
19+
paginationConfig: {
20+
type: Object,
21+
required: true,
22+
default: () => ({
23+
current_page: 1,
24+
page_size: 50,
25+
total: 0,
26+
}),
27+
}, // option: { current_page , page_size, total }
28+
maxTableHeight: {
29+
type: Number,
30+
default: 300,
31+
},
32+
})
33+
const emit = defineEmits(['changePage'])
34+
35+
const appTableRef = ref()
36+
37+
const tableHeight = ref<number | string>('')
38+
const disabled = ref(false)
39+
40+
const load = () => {
41+
if (disabled.value) return
42+
43+
// props.paginationConfig.current_page++;
44+
if (props.paginationConfig.current_page <= props.paginationConfig.total) {
45+
emit('changePage')
46+
}
47+
48+
if (props.paginationConfig.current_page === props.paginationConfig.total) {
49+
disabled.value = true
50+
}
51+
}
52+
defineExpose({})
53+
54+
onMounted(() => {
55+
tableHeight.value = window.innerHeight - props.maxTableHeight
56+
window.onresize = () => {
57+
return (() => {
58+
tableHeight.value = window.innerHeight - props.maxTableHeight
59+
})()
60+
}
61+
})
62+
</script>
63+
64+
<style lang="scss" scoped></style>

ui/src/locales/lang/en-US/workflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,5 +536,6 @@ You are a master of problem optimization, adept at accurately inferring user int
536536
SystemPromptPlaceholder: 'System Prompt, can reference variables in the system, such as',
537537
UserPromptPlaceholder: 'User Prompt, can reference variables in the system, such as',
538538
ExecutionRecord: 'Execution Record',
539+
initiator: 'Initiator',
539540
debug: {},
540541
}

ui/src/locales/lang/zh-CN/workflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,5 +537,6 @@ export default {
537537
SystemPromptPlaceholder: '系统提示词,可以引用系统中的变量:如',
538538
UserPromptPlaceholder: '用户提示词,可以引用系统中的变量:如',
539539
ExecutionRecord: '执行记录',
540+
initiator: '发起人',
540541
debug: {},
541542
}

ui/src/locales/lang/zh-Hant/workflow.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,13 @@ export default {
469469
loopIndex: '下標',
470470
loopItem: '循環元素',
471471
},
472-
loopBodyNode: {label: '循環體', text: '循環體'},
472+
loopBodyNode: { label: '循環體', text: '循環體' },
473473
loopContinueNode: {
474474
label: 'Continue',
475475
text: '用於終止當前循環,執行下次循環',
476476
isContinue: 'Continue',
477477
},
478-
loopBreakNode: {label: 'Break', text: '終止當前循環,跳出循環體', isBreak: 'Break'},
478+
loopBreakNode: { label: 'Break', text: '終止當前循環,跳出循環體', isBreak: 'Break' },
479479
variableSplittingNode: {
480480
label: '變量拆分',
481481
text: '通過配置 JSON Path 表達式,對輸入的 JSON 格式變量進行解析和拆分',
@@ -520,5 +520,6 @@ export default {
520520
SystemPromptPlaceholder: '系統提示詞,可以引用系統中的變量:如',
521521
UserPromptPlaceholder: '用戶提示詞,可以引用系統中的變量:如',
522522
ExecutionRecord: '執行記錄',
523+
initiator: '發起人',
523524
debug: {},
524525
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<template>
2+
<el-drawer
3+
v-model="drawer"
4+
:title="$t('workflow.ExecutionRecord')"
5+
direction="rtl"
6+
size="800px"
7+
:before-close="close"
8+
>
9+
<div class="flex mb-16">
10+
<div class="flex-between complex-search">
11+
<el-select
12+
v-model="filter_type"
13+
class="complex-search__left"
14+
@change="changeFilterHandle"
15+
style="width: 120px"
16+
>
17+
<el-option :label="$t('workflow.initiator')" value="user_name" />
18+
</el-select>
19+
<!-- <el-select
20+
v-if="filter_type === 'status'"
21+
v-model="filter_status"
22+
@change="changeStatusHandle"
23+
style="width: 220px"
24+
clearable
25+
>
26+
<el-option
27+
v-for="item in statusOptions"
28+
:key="item.value"
29+
:label="item.label"
30+
:value="item.value"
31+
/>
32+
</el-select> -->
33+
<el-input
34+
v-model="query.user_name"
35+
@change="getList"
36+
:placeholder="$t('common.search')"
37+
prefix-icon="Search"
38+
style="width: 220px"
39+
clearable
40+
/>
41+
</div>
42+
</div>
43+
44+
<app-table-infinite-scroll
45+
:data="data"
46+
class="w-full"
47+
v-loading="loading"
48+
@changePage="changePage"
49+
:maxTableHeight="200"
50+
>
51+
<el-table-column prop="user_name" :label="$t('workflow.initiator')">
52+
<template #default="{ row }">
53+
{{ row.user_name }}
54+
</template>
55+
</el-table-column>
56+
<el-table-column prop="state" label="状态" width="180">
57+
<template #default="{ row }">
58+
{{ row.state }}
59+
</template>
60+
</el-table-column>
61+
<el-table-column prop="run_time" label="运行时间">
62+
<template #default="{ row }">
63+
{{ row.run_time }}
64+
</template>
65+
</el-table-column>
66+
<el-table-column label="操作">
67+
<template #default="{ row }">
68+
<span @click="toDetails(row)">执行详情</span>
69+
</template>
70+
</el-table-column>
71+
</app-table-infinite-scroll>
72+
</el-drawer>
73+
</template>
74+
<script setup lang="ts">
75+
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
76+
import AppTableInfiniteScroll from '@/components/app-table-infinite-scroll/index.vue'
77+
import { computed, ref, reactive } from 'vue'
78+
import { useRoute, useRouter } from 'vue-router'
79+
const drawer = ref<boolean>(false)
80+
const route = useRoute()
81+
const toDetails = (row: any) => {}
82+
83+
const apiType = computed(() => {
84+
if (route.path.includes('shared')) {
85+
return 'systemShare'
86+
} else if (route.path.includes('resource-management')) {
87+
return 'systemManage'
88+
} else {
89+
return 'workspace'
90+
}
91+
})
92+
const paginationConfig = reactive({
93+
current_page: 1,
94+
page_size: 50,
95+
total: 0,
96+
})
97+
const query = ref<any>({
98+
user_name: '',
99+
})
100+
const loading = ref(false)
101+
const filter_type = ref<string>('user_name')
102+
const active_knowledge_id = ref<string>('')
103+
const data = ref<Array<any>>([])
104+
const changeFilterHandle = () => {
105+
query.value = { user_name: '' }
106+
}
107+
const changePage = () => {
108+
paginationConfig.current_page += 1
109+
getList()
110+
}
111+
112+
const getList = () => {
113+
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
114+
.getWorkflowActionPage(active_knowledge_id.value, paginationConfig, query.value, loading)
115+
.then((ok: any) => {
116+
paginationConfig.total = ok.data?.total
117+
data.value = ok.data.records
118+
})
119+
}
120+
const open = (knowledge_id: string) => {
121+
drawer.value = true
122+
active_knowledge_id.value = knowledge_id
123+
getList()
124+
}
125+
const close = () => {
126+
drawer.value = false
127+
}
128+
defineExpose({ open, close })
129+
</script>
130+
<style lang="scss" scoped></style>

ui/src/views/knowledge-workflow/component/list-action/index.vue

Lines changed: 0 additions & 83 deletions
This file was deleted.

ui/src/views/knowledge-workflow/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</el-dropdown-item>
5555
<el-dropdown-item @click="openListAction">
5656
<AppIcon iconName="app-history-outlined" class="color-secondary"></AppIcon>
57-
执行记录
57+
{{ $t('workflow.ExecutionRecord') }}
5858
</el-dropdown-item>
5959
<el-dropdown-item @click="openHistory">
6060
<AppIcon iconName="app-history-outlined" class="color-secondary"></AppIcon>
@@ -129,7 +129,7 @@
129129
</div>
130130
</el-collapse-transition>
131131
<DebugVue ref="DebugRef"></DebugVue>
132-
<ListAction ref="ListActionRef"></ListAction>
132+
<ExecutionRecord ref="ListActionRef"></ExecutionRecord>
133133
<!-- 发布历史 -->
134134
<PublishHistory
135135
v-if="showHistory"
@@ -145,7 +145,7 @@ import { useRouter, useRoute } from 'vue-router'
145145
import type { Action } from 'element-plus'
146146
import Workflow from '@/workflow/index.vue'
147147
import DropdownMenu from '@/components/workflow-dropdown-menu/index.vue'
148-
import ListAction from '@/views/knowledge-workflow/component/list-action/index.vue'
148+
import ExecutionRecord from '@/views/knowledge-workflow/component/execution-record/ExecutionRecordDrawer.vue'
149149
import PublishHistory from '@/views/knowledge-workflow/component/PublishHistory.vue'
150150
import { isAppIcon, resetUrl } from '@/utils/common'
151151
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
@@ -194,7 +194,7 @@ const isDefaultTheme = computed(() => {
194194
return theme.isDefaultTheme()
195195
})
196196
const DebugRef = ref<InstanceType<typeof DebugVue>>()
197-
const ListActionRef = ref<InstanceType<typeof ListAction>>()
197+
const ListActionRef = ref<InstanceType<typeof ExecutionRecord>>()
198198
let interval: any
199199
const workflowRef = ref()
200200
const workflowMainRef = ref()

0 commit comments

Comments
 (0)