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

feat(bulk migrate): choose the VMs by tag

The Bulk Migrate page gets a "Choose by tag" list of its VMs' tags:
choosing one ticks the VMs with it that can migrate and unticks the
others, as a choice to review before Migrate; spread over the hosts, the
list is placed again as for any other tick. The job still gets the VMs
ticked, never the tag.
This commit is contained in:
catborise 2026-11-18 21:20:19 +03:00
parent f4051213fb
commit a492031d12
9 changed files with 83 additions and 42 deletions

View file

@ -1,6 +1,7 @@
// 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. Spread over the hosts, a change reloads
// shut-off VMs" the shut-off ones, a tag chosen those with it (data-tags)
// and no others. Spread over the hosts, a change reloads
// the list too: where each VM goes depends on the others. The Migrate
// button counts the ticked VMs and is off while none is.
const choose = document.getElementById("bulk-migrate-choose");
@ -32,6 +33,14 @@ document.getElementById("bulk-migrate-all")?.addEventListener("change", function
document.getElementById("bulk-migrate-shut-off")?.addEventListener("change", function (event) {
tick(".bulk-migrate-vm[data-shut-off]:not(:disabled)", event.target.checked);
});
document.getElementById("bulk-migrate-tag")?.addEventListener("change", function (event) {
const tag = event.target.value;
if (tag) {
document.querySelectorAll(".bulk-migrate-vm:not(:disabled)").forEach(function (box) {
box.checked = (box.dataset.tags || "").split(" ").includes(tag);
});
}
});
document.addEventListener("change", function (event) {
if (spreading && event.target.id !== "bulk-migrate-parallel" && event.target.id !== "bulk-migrate-target") {
choose.submit();