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

fix(tags): third audit: host form and tag delete, hosts list badges

- A host's form saves the host and its tags in one transaction under the
  ownership lock: a tag the Tags page deletes meanwhile is made again,
  instead of a 500 after the host's other changes were saved.
- The hosts list shows three tags and "…" for the others, as the VM list.
- "…" shows the other tags on any page, the tag filter or not.
This commit is contained in:
catborise 2026-11-18 23:50:43 +03:00
parent 7810fb39fe
commit 6cdaa2affd
4 changed files with 46 additions and 22 deletions

View file

@ -129,22 +129,23 @@ if (typeof module !== "undefined") {
keep(tags.value, key + "_tag");
filterTable(document);
});
document.addEventListener("click", function (event) {
var more = event.target.closest("[data-show-tags]");
if (more) {
more.hidden = true;
more.nextElementSibling.hidden = false;
more.nextElementSibling.querySelector("button").focus(); // the focus is not lost with the button
return;
}
var badge = event.target.closest("[data-tag-filter]");
if (badge) {
tags.value = badge.dataset.tagFilter;
keep(tags.value, key + "_tag");
filterTable(document);
}
});
}
document.addEventListener("click", function (event) {
var more = event.target.closest("[data-show-tags]");
if (more) {
more.hidden = true;
more.nextElementSibling.hidden = false;
// the focus is not lost with the button: the first tag shown takes it
more.nextElementSibling.querySelector("button, [tabindex]")?.focus();
return;
}
var badge = event.target.closest("[data-tag-filter]");
if (badge && tags) {
tags.value = badge.dataset.tagFilter;
keep(tags.value, key + "_tag");
filterTable(document);
}
});
var pills = document.getElementById("state-pills");
function chooseState(pill) {
states.value = pill.dataset.pillState;