mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
feat: 添加重置任务功能
This commit is contained in:
@@ -133,6 +133,28 @@ async function handleRun(item: Workflow, from_begin: boolean) {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置任务
|
||||||
|
async function handleReset(item: Workflow) {
|
||||||
|
const isConfirmed = await createConfirm({
|
||||||
|
title: '确认',
|
||||||
|
content: `是否确认重置任务 ${item.name} ?`,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!isConfirmed) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: string } = await api.post(`workflow/${item.id}/reset`)
|
||||||
|
if (result.success) {
|
||||||
|
$toast.success('重置任务成功!')
|
||||||
|
emit('refresh')
|
||||||
|
} else {
|
||||||
|
$toast.error(`重置任务失败:${result.message}`)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 计算状态颜色
|
// 计算状态颜色
|
||||||
const resolveStatusVariant = (status: string | undefined) => {
|
const resolveStatusVariant = (status: string | undefined) => {
|
||||||
if (status === 'S') return { color: 'success', text: '成功' }
|
if (status === 'S') return { color: 'success', text: '成功' }
|
||||||
@@ -196,13 +218,13 @@ const resolveProgress = (item: Workflow) => {
|
|||||||
<VListItem
|
<VListItem
|
||||||
v-if="workflow.current_action"
|
v-if="workflow.current_action"
|
||||||
variant="plain"
|
variant="plain"
|
||||||
base-color="warning"
|
base-color="info"
|
||||||
@click="handleRun(workflow, true)"
|
@click="handleRun(workflow, true)"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon icon="mdi-replay" />
|
<VIcon icon="mdi-replay" />
|
||||||
</template>
|
</template>
|
||||||
<VListItemTitle>重新开始</VListItemTitle>
|
<VListItemTitle>重新执行</VListItemTitle>
|
||||||
</VListItem>
|
</VListItem>
|
||||||
<VListItem v-else variant="plain" base-color="info" @click="handleRun(workflow, true)">
|
<VListItem v-else variant="plain" base-color="info" @click="handleRun(workflow, true)">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
@@ -210,6 +232,12 @@ const resolveProgress = (item: Workflow) => {
|
|||||||
</template>
|
</template>
|
||||||
<VListItemTitle>立即执行</VListItemTitle>
|
<VListItemTitle>立即执行</VListItemTitle>
|
||||||
</VListItem>
|
</VListItem>
|
||||||
|
<VListItem variant="plain" base-color="warning" @click="handleReset(workflow)">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-restore-alert" />
|
||||||
|
</template>
|
||||||
|
<VListItemTitle>重置任务</VListItemTitle>
|
||||||
|
</VListItem>
|
||||||
<VListItem variant="plain" base-color="error" @click="handleDelete(workflow)">
|
<VListItem variant="plain" base-color="error" @click="handleDelete(workflow)">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon icon="mdi-delete" />
|
<VIcon icon="mdi-delete" />
|
||||||
|
|||||||
Reference in New Issue
Block a user