mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 08:26:03 +00:00
fix(operations): the job panel shows the outcome when its resource is gone
An owner who deleted their VM stayed on its page with "Delete VM queued" and a Cancel button for good: the delete takes the user's ownership, so the resource's job list answers 404, and outcomes were asked for only after a list answered. A 403 or 404 list now counts as an empty one, so each job is asked for by its id: while it runs (a delete goes on with the disks after the VM's record is gone) it stays shown with its Cancel button, and once it ends its page (the VM list) opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
f18287d3b8
commit
600c8d8566
2 changed files with 40 additions and 4 deletions
|
|
@ -361,3 +361,22 @@ console.log("ok");
|
|||
assert.ok(elt.innerHTML.includes('<span class="badge bg-primary">çalışıyor</span>')
|
||||
&& elt.innerHTML.includes(">İptal</button>"), "labels and texts of the page's language");
|
||||
}
|
||||
|
||||
// the resource is gone (an owner deleted the VM, which takes its ownership): the list answers 404,
|
||||
// the job's outcome is asked for by its id, and its page opens
|
||||
open = []; timers = [];
|
||||
window.backgroundJobRunning = false; window.opened = undefined;
|
||||
const elGone = { innerHTML: "", addEventListener() {} };
|
||||
jobPanel(elGone, urls, "tok", undefined, STATES, TEXT);
|
||||
advance(0);
|
||||
answer("/r", { ...empty, jobs: [{ ...running, id: "f", label: "Delete VM", state: "queued" }] });
|
||||
advance(3000);
|
||||
answer("/r", { status: 404 }, false);
|
||||
// its disks are still being deleted: the job stays shown, with its Cancel button
|
||||
answer("/j/f", { ...running, id: "f", label: "Delete VM", state: "running", cancellable: true });
|
||||
assert.ok(elGone.innerHTML.includes("Delete VM") && elGone.innerHTML.includes('data-cancel="f"'),
|
||||
"an active job whose resource is gone stays shown");
|
||||
advance(3000);
|
||||
answer("/r", { status: 404 }, false);
|
||||
answer("/j/f", { ...running, id: "f", label: "Delete VM", state: "succeeded", result: { open: "/instances/" } });
|
||||
assert.strictEqual(window.opened, "/instances/", "the outcome of a job whose resource is gone is shown");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue