diff --git a/sundynix-desktop/frontend/src/shell/ApprovalBar.tsx b/sundynix-desktop/frontend/src/shell/ApprovalBar.tsx
index 7d62eb0..8a3e8a8 100644
--- a/sundynix-desktop/frontend/src/shell/ApprovalBar.tsx
+++ b/sundynix-desktop/frontend/src/shell/ApprovalBar.tsx
@@ -13,12 +13,14 @@ export function ApprovalBar({ run }: { run: RunState }) {
? pendingApproval(run.exec) ?? { node: "", title: run.detail || "人工审批", summary: "" }
: null;
if (!approval || !run.taskId) return null;
- return ;
+ // key=taskId:换任务时重新挂载,重置 submitted 等本地状态,避免上一个审批的「已提交」残留。
+ return ;
}
function Bar({ taskId, node, title, summary }: { taskId: string; node: string; title: string; summary: string }) {
const [note, setNote] = useState("");
const [busy, setBusy] = useState<"approve" | "reject" | null>(null);
+ const [submitted, setSubmitted] = useState(false); // 决定已发出;正常情况下任务续跑后本条随 waiting 解除自动消失
const [err, setErr] = useState("");
const decide = async (approved: boolean) => {
@@ -26,8 +28,10 @@ function Bar({ taskId, node, title, summary }: { taskId: string; node: string; t
setErr("");
try {
await approveTask(taskId, approved, { node, note });
+ setSubmitted(true); // 关键:成功后置「已提交」而非停在 spinner —— 否则任务若恢复不了会永远卡「提交中…」
} catch (e) {
setErr((e as Error).message);
+ } finally {
setBusy(null);
}
};
@@ -38,25 +42,29 @@ function Bar({ taskId, node, title, summary }: { taskId: string; node: string; t
人工审批
{title}
- 等待决定
+ {submitted ? "已提交决定" : "等待决定"}
{summary &&
{summary}}
-
- setNote(e.target.value)}
- placeholder="备注(可选,拒绝原因等)"
- className="min-w-0 flex-1 rounded border border-line bg-ink-950/60 px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:border-amber-500/50 focus:outline-none"
- />
-
-
-
+ {submitted ? (
+ 决定已发出,等待任务续跑…(若长时间无响应,该任务可能已失效)
+ ) : (
+
+ setNote(e.target.value)}
+ placeholder="备注(可选,拒绝原因等)"
+ className="min-w-0 flex-1 rounded border border-line bg-ink-950/60 px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:border-amber-500/50 focus:outline-none"
+ />
+
+
+
+ )}
{err && 提交失败:{err}
}
);