Polish device registry identity displays
This commit is contained in:
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user