mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 09:26:03 +00:00
fix(computes): the Bulk Migrate page keeps its list and button together
The page showed memory as MiB counts ("16768 MiB"), the destination and
the shut-off switch apart from the list, and a Migrate button below the
whole list that did not say how many VMs it would migrate. Now the list
is one card: "host -> destination" (a choice when there are several) and
the shut-off switch in its header, sizes as on the Computes and Balance
pages, and a footer that stays in sight below a long list with the
number at once and a "Migrate the chosen VMs" button that counts the
ticked VMs and is off while none is.
This commit is contained in:
parent
54487052e5
commit
cf288a54cf
8 changed files with 120 additions and 90 deletions
|
|
@ -1,11 +1,20 @@
|
|||
// The Bulk Migrate page: another destination reloads the list; the header
|
||||
// box ticks or unticks every VM that can migrate, "Also migrate the
|
||||
// shut-off VMs" the shut-off ones.
|
||||
// shut-off VMs" the shut-off ones. The Migrate button counts the ticked
|
||||
// VMs and is off while none is.
|
||||
function tick(selector, checked) {
|
||||
document.querySelectorAll(selector).forEach(function (box) {
|
||||
box.checked = checked;
|
||||
});
|
||||
}
|
||||
function count() {
|
||||
const ticked = document.querySelectorAll("input[name=instance]:checked").length;
|
||||
const button = document.getElementById("bulk-migrate-submit");
|
||||
if (button) {
|
||||
button.disabled = ticked === 0;
|
||||
document.getElementById("bulk-migrate-count").textContent = ticked;
|
||||
}
|
||||
}
|
||||
document.getElementById("bulk-migrate-target")?.addEventListener("change", function (event) {
|
||||
event.target.form.submit();
|
||||
});
|
||||
|
|
@ -15,3 +24,5 @@ document.getElementById("bulk-migrate-all")?.addEventListener("change", function
|
|||
document.getElementById("bulk-migrate-shut-off")?.addEventListener("change", function (event) {
|
||||
tick("input[data-shut-off]:not(:disabled)", event.target.checked);
|
||||
});
|
||||
document.addEventListener("change", count);
|
||||
count();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue