1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(ui): a block or a job's cancel asks first; every delete and save says it is done

- Block in the Users list asks first: the user is signed out and their
  API tokens are deleted, which unblocking does not bring back. Block
  and Unblock then say what they did.
- Cancel on a job's page and in the job panel asks first, naming the
  job; the button says Cancel the job, apart from the dialog's Cancel.
- Deleting a user or a group, removing a host from the panel or an
  owner from a VM, and deleting an interface, a network filter or a
  secret say so, as the other deletes do.
- Renaming a tag and saving a VM's title and description say so.
This commit is contained in:
catborise 2026-11-21 20:47:26 +03:00
parent 00a44f7621
commit e79817e7db
22 changed files with 247 additions and 39 deletions

View file

@ -1,6 +1,7 @@
// Reloads the page while it shows an active job, so the page follows the job to its end.
setInterval(function () {
if (!document.hidden && !document.querySelector("form :focus")) {
// not while a form is filled in or a dialog asks (a job's Cancel)
if (!document.hidden && !document.querySelector("form :focus, .modal.show")) {
window.location.reload();
}
}, 5000);

View file

@ -67,7 +67,7 @@ function jobPanel(element, urls, csrfToken, initialIds, states, text) {
function jobHtml(job) {
var cancel = job.cancellable ? '<button type="button" class="btn btn-sm btn-outline-danger" data-cancel="'
+ esc(job.id) + '"' + (cancelling[job.id] ? " disabled" : "") + ">" + esc(text.cancel) + "</button>" : "";
+ esc(job.id) + '" data-label="' + esc(job.label) + '"' + (cancelling[job.id] ? " disabled" : "") + ">" + esc(text.cancel) + "</button>" : "";
// an uncertain job keeps its claims, so it stays in the list with its error
return alertHtml(job.state, header(job.label, job.state, job.phase, cancel) + errorHtml(job) + bar(job));
}
@ -190,7 +190,12 @@ function jobPanel(element, urls, csrfToken, initialIds, states, text) {
if (t.dataset.refresh) { window.location.reload(); }
if (t.dataset.dismiss) { dismissed[t.dataset.dismiss] = true; delete outcomes[t.dataset.dismiss]; render(); }
if (t.dataset.dismissError) { notice = ""; render(); }
if (t.dataset.cancel && !cancelling[t.dataset.cancel]) { cancel(t.dataset.cancel); }
// asked first (confirm_dialog.js); the list may be drawn again meanwhile
if (t.dataset.cancel && !cancelling[t.dataset.cancel]) {
var id = t.dataset.cancel;
confirmAction(text.cancel, text.cancel_confirm.replace("%(job)s", t.dataset.label), true,
function () { if (!cancelling[id]) { cancel(id); } }, t);
}
});
function cancel(id) {