feat: 拆解页面持久展示后台执行状态
This commit is contained in:
1 parent
3b7ef23774
commit
2baea6ccf7
1 file changed
+22
-4
@@ -15,6 +15,8 @@ import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../work
|
||||
import { getOperation, runOperation } from '../workflows/operations'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import HistoryPanel from '../workflows/HistoryPanel.vue'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import SubjectList from './components/SubjectList.vue'
|
||||
import StoryboardList from './components/StoryboardList.vue'
|
||||
import { errorMessage } from '../../lib/http'
|
||||
@@ -44,7 +46,9 @@ const plans = computed(() => result.value?.storyboardPlans ?? [])
|
||||
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
|
||||
const summary = computed(() => snapshot.value?.taskSummary)
|
||||
const validation = computed(() => result.value?.storyboardShotValidation ?? snapshot.value?.storyboardShotValidation)
|
||||
const operation = computed(() => getOperation(project.value!.id))
|
||||
const projectId = computed(() => project.value?.id ?? '')
|
||||
const operation = computed(() => getOperation(projectId.value))
|
||||
const backgroundExecution = useWorkflowExecution(projectId, 'breakdown')
|
||||
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
||||
const execution = computed(() => snapshot.value?.workflowExecution)
|
||||
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
|
||||
@@ -62,6 +66,7 @@ const canStart = computed(
|
||||
!!preview.value &&
|
||||
configValid.value &&
|
||||
!operation.value.pending &&
|
||||
!backgroundExecution.active.value &&
|
||||
!error.value &&
|
||||
(!records.value.length || taskStopped.value)
|
||||
)
|
||||
@@ -120,9 +125,13 @@ async function run(action: BreakdownAction) {
|
||||
'resume-storyboard': '正在修复分镜绑定'
|
||||
}
|
||||
const id = project.value.id
|
||||
await runOperation(id, labels[action], () =>
|
||||
breakdownApi.run(id, action, action === 'start' ? input.value : undefined)
|
||||
)
|
||||
await runOperation(id, labels[action], async () => {
|
||||
const result = await breakdownApi.run(id, action, action === 'start' ? input.value : undefined)
|
||||
if (action === 'start' && 'executionId' in result) {
|
||||
await backgroundExecution.track(result.executionId)
|
||||
}
|
||||
return result
|
||||
})
|
||||
await refresh()
|
||||
}
|
||||
|
||||
@@ -282,6 +291,15 @@ const rules = {
|
||||
后端尚无明确的完成或失败记录。为避免重复执行,已禁用整条重新拆解;如进程已中断,请先核实后台,再选择对应恢复操作。
|
||||
</p>
|
||||
</section>
|
||||
<WorkflowExecutionPanel
|
||||
v-if="backgroundExecution.executionId.value"
|
||||
title="剧本拆解后台任务"
|
||||
:execution="backgroundExecution.query.data.value"
|
||||
:loading="backgroundExecution.query.loading.value"
|
||||
:error="backgroundExecution.query.error.value"
|
||||
@refresh="backgroundExecution.query.refresh"
|
||||
@dismiss="backgroundExecution.dismiss"
|
||||
/>
|
||||
<section v-if="snapshot" class="mt-5">
|
||||
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-sm font-medium">
|
||||
|
||||
Reference in new issue
Block a user