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

feat(tags): smaller tag badges, three on the VM list

Tag badges are smaller than other badges everywhere, and the VM list
shows a VM's first three tags and "…" for the others: it names them in
its tooltip and shows them when pressed, by mouse or keyboard. A VM with
many tags no longer widens the name column and the table with it; the
tag list still filters by any of them.
This commit is contained in:
catborise 2026-11-18 23:28:12 +03:00
parent b74e798e70
commit 7810fb39fe
11 changed files with 56 additions and 8 deletions

View file

@ -308,3 +308,12 @@ fieldset:not(:has(input[value="set"]:checked)) > .console-new-password {
#tag-filter {
max-width: 15rem;
}
/* a VM's or host's tags: smaller than other badges, so a row with several stays narrow */
.tag-badge {
font-size: 0.65rem;
font-weight: 500;
}
.tag-badge svg {
width: 0.85em;
height: 0.85em;
}

View file

@ -6,7 +6,8 @@
// buttons and menus. With a state list, the row's [data-state] must
// be the chosen state too; with a tag list (#tag-filter), the chosen tag
// one of the row's data-tags (names split by spaces), or "-" none of them.
// A tag's badge ([data-tag-filter]) chooses it in the list. In a grouped list a search for a group's host
// A tag's badge ([data-tag-filter]) chooses it in the list; a row's "…"
// ([data-show-tags]) shows its other tags. In a grouped list a search for a group's host
// shows all of its rows, and its header row (data-group-header) shows while
// any of its rows does. A page's #no-match shows while no row does. The
// search is remembered for a day, per page, unless its box has data-forget.
@ -129,6 +130,13 @@ if (typeof module !== "undefined") {
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;