mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix: the host comparison reads afresh, skips silent hosts and unread listings; bulk form limit
Audit and review (Codex, agy) of the host comparison and the bulk tag: - a read of what a host's VMs need was used again for 5 minutes without a new one, so a network added to fix a line was still reported: each load reads again, the last read standing in only when the new one is late; - a host that stopped answering kept what it said before, and was reported both as not answering and as a destination lacking things: only hosts that answer are compared; - one listing of a host that could not be read (its secrets, say) dropped the whole host: each listing is read on its own and only those read compared; - the kept reads no longer keep whole VM definitions (plain strings); - choosing more VMs than the bulk form takes made Django refuse the form: past 500 the buttons are off and the count says so; the tag view refuses them as the power view does.
This commit is contained in:
parent
5c169ca504
commit
1c3993133e
11 changed files with 605 additions and 443 deletions
|
|
@ -13,8 +13,9 @@
|
|||
function update() {
|
||||
var boxes = onScreen();
|
||||
var chosen = boxes.filter(function (box) { return box.checked; }).length;
|
||||
form.querySelectorAll("button[name='action']").forEach(function (button) { button.disabled = chosen === 0; });
|
||||
count.textContent = chosen ? count.dataset.text.replace("%(count)s", chosen) : "";
|
||||
var tooMany = chosen > Number(count.dataset.max); // the server takes at most that many
|
||||
form.querySelectorAll("button[name='action']").forEach(function (button) { button.disabled = chosen === 0 || tooMany; });
|
||||
count.textContent = chosen ? (tooMany ? count.dataset.tooMany : count.dataset.text).replace("%(count)s", chosen) : "";
|
||||
shown.disabled = boxes.length === 0;
|
||||
shown.checked = boxes.length > 0 && chosen === boxes.length;
|
||||
shown.indeterminate = chosen > 0 && chosen < boxes.length;
|
||||
|
|
@ -48,12 +49,17 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
form.addEventListener("submit", function () {
|
||||
form.addEventListener("submit", function (event) {
|
||||
document.querySelectorAll("input[name='vm'][form='bulk-power']:checked").forEach(function (box) {
|
||||
if (!box.getClientRects().length) {
|
||||
box.checked = false; // hidden: not sent
|
||||
}
|
||||
});
|
||||
// counted again: rows may have come on screen since the buttons were last set
|
||||
if (document.querySelectorAll("input[name='vm'][form='bulk-power']:checked").length > Number(count.dataset.max)) {
|
||||
event.preventDefault();
|
||||
update();
|
||||
}
|
||||
});
|
||||
update();
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue