Polish device registry identity displays

This commit is contained in:
Wira Basalamah
2026-06-08 16:09:24 +07:00
parent 67dc286c1a
commit 4bbe3f6807
4 changed files with 48 additions and 12 deletions

View File

@ -1062,9 +1062,21 @@ Changing SN affects config pull lookup and MQTT topic routing. Use the physical
button.addEventListener("click", (event) => {
event.stopPropagation();
const rowId = event.currentTarget.getAttribute("data-id");
const activeMenu = Array.from(tableBody.querySelectorAll("[data-device-menu]"))
.find((menu) => menu.getAttribute("data-device-menu") === rowId);
const shouldOpen = Boolean(activeMenu?.classList.contains("hidden"));
tableBody.querySelectorAll("[data-device-menu]").forEach((menu) => {
menu.classList.toggle("hidden", menu.getAttribute("data-device-menu") !== rowId || !menu.classList.contains("hidden"));
menu.classList.add("hidden", "top-12");
menu.classList.remove("bottom-12");
});
if (!activeMenu || !shouldOpen) {
return;
}
const buttonRect = event.currentTarget.getBoundingClientRect();
const availableBelow = window.innerHeight - buttonRect.bottom;
activeMenu.classList.toggle("top-12", availableBelow >= 190);
activeMenu.classList.toggle("bottom-12", availableBelow < 190);
activeMenu.classList.remove("hidden");
});
});