Use schedule checkbox for biz-state; add compare job delete action.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-17 19:11:50 +08:00
parent 108c9da00f
commit e9b8042ca7
5 changed files with 109 additions and 60 deletions

View file

@ -9,6 +9,7 @@ import {
bizCompareCreateJob,
bizCompareCreateMapping,
bizCompareCreateTemplate,
bizCompareDeleteJob,
bizCompareDeleteTemplate,
bizCompareGetRun,
bizCompareListJobs,
@ -471,6 +472,21 @@ export function BizComparePage() {
}
};
const removeJob = async (id: string) => {
if (!window.confirm(t("bizCompare.confirmDeleteJob"))) return;
setBusy(true);
try {
await bizCompareDeleteJob(id);
if (jobId === id) closeJob();
showOk(t("bizCompare.jobDeleted"));
await refresh();
} catch (e) {
showError(formatErr(e));
} finally {
setBusy(false);
}
};
const parseMapRows = () => {
const rows: { before_if: string; after_if: string }[] = [];
for (const line of mapText.split(/\r?\n/)) {
@ -945,6 +961,14 @@ export function BizComparePage() {
<Button size="sm" variant="primary" onPress={() => void openJob(j.id)}>
{t("bizCompare.detail")}
</Button>
<Button
size="sm"
variant="danger"
isDisabled={busy}
onPress={() => void removeJob(j.id)}
>
{t("bizCompare.delete")}
</Button>
</div>
</td>
</tr>
@ -1409,6 +1433,11 @@ export function BizComparePage() {
<Button size="sm" variant="ghost" onPress={closeJob}>
{t("bizState.cancel")}
</Button>
{jobId ? (
<Button size="sm" variant="danger" isDisabled={busy} onPress={() => void removeJob(jobId)}>
{t("bizCompare.delete")}
</Button>
) : null}
</Modal.Footer>
</AppModalShell>
</section>