开发失败任务重试权限闭环
新增失败证书任务重试接口、事务处理、权限校验、审计记录及前端重试入口,并补充后端测试。
This commit is contained in:
1 parent
35c9d7760c
commit
35260bcc4b
8 files changed
+350
-6
No files matched your search
@@ -848,6 +848,21 @@ export function useDashboard() {
|
||||
error.value = err.message || "取消任务失败";
|
||||
}
|
||||
}
|
||||
async function retryTask(item) {
|
||||
if (!window.confirm("确定重新执行这项失败的证书任务吗?")) return;
|
||||
error.value = "";
|
||||
notice.value = "";
|
||||
try {
|
||||
const response = await fetchAdmin(`/api/v1/tasks/${item.id}/retry`, { method: "POST" });
|
||||
const result = await response.json().catch(() => ({}));
|
||||
if (!response.ok) throw new Error(result.error || "重试任务失败");
|
||||
notice.value = "证书任务已重新执行";
|
||||
await loadData();
|
||||
} catch (err) {
|
||||
error.value = err.message || "重试任务失败";
|
||||
}
|
||||
}
|
||||
|
||||
async function runRenewalNow() {
|
||||
error.value = "";
|
||||
notice.value = "";
|
||||
@@ -1313,6 +1328,7 @@ export function useDashboard() {
|
||||
validateDomain,
|
||||
deployDomain,
|
||||
cancelTask,
|
||||
retryTask,
|
||||
openTaskDetails,
|
||||
closeTaskDetails,
|
||||
showTaskDetails,
|
||||
|
||||
@@ -6,7 +6,7 @@ const props = defineProps({ state: { type: Object, required: true } });
|
||||
const emit = defineEmits(["navigate"]);
|
||||
const {
|
||||
loading, error, auditLogs, taskTypeLabel, taskStatusLabels,
|
||||
statusClass, displayLabel, auditActionLabel, openTaskDetails, cancelTask,
|
||||
statusClass, displayLabel, auditActionLabel, openTaskDetails, cancelTask, retryTask,
|
||||
} = props.state;
|
||||
const { detailView, summary, visibleTasks, taskDomain } = useRuntimeOverview(props.state);
|
||||
</script>
|
||||
@@ -96,6 +96,11 @@ const { detailView, summary, visibleTasks, taskDomain } = useRuntimeOverview(pro
|
||||
type="button"
|
||||
@click="cancelTask(item)"
|
||||
>取消任务</button>
|
||||
<button
|
||||
v-if="item.task_type === 'certificate_issue' && (item.status === 'failed' || item.status === 'cancelled')"
|
||||
type="button"
|
||||
@click="retryTask(item)"
|
||||
>重试任务</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in new issue
Block a user