diff options
author | Maxim Devaev <[email protected]> | 2024-05-12 03:43:57 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-05-12 03:43:57 +0300 |
commit | b9d425e7dc07e25b1c2c4e5aaba11404ed832ba9 (patch) | |
tree | c813ba5f2a34c7f55fb6b86eae7b6778bd6e9238 | |
parent | 5f44ac9f6331d747bbb992e35dca9ea92dcdfda9 (diff) |
pikvm/pikvm#1312: Option to close GPIO menu after click
-rw-r--r-- | kvmd/apps/kvmd/ugpio.py | 6 | ||||
-rw-r--r-- | web/share/js/kvm/gpio.js | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py index 74ed204f..872d5f6c 100644 --- a/kvmd/apps/kvmd/ugpio.py +++ b/kvmd/apps/kvmd/ugpio.py @@ -383,15 +383,19 @@ class UserGpio: def __make_item_output(self, parts: list[str]) -> dict: assert len(parts) >= 1 confirm = False + hide = False text = "Click" if len(parts) == 2: text = parts[1] elif len(parts) == 3: - confirm = (parts[1] == "confirm") + opts = parts[1].split(",") + confirm = ("confirm" in opts) + hide = ("hide" in opts) text = parts[2] return { "type": UserGpioModes.OUTPUT, "channel": parts[0], "confirm": confirm, + "hide": hide, "text": text, } diff --git a/web/share/js/kvm/gpio.js b/web/share/js/kvm/gpio.js index db259cee..4bee901a 100644 --- a/web/share/js/kvm/gpio.js +++ b/web/share/js/kvm/gpio.js @@ -150,7 +150,10 @@ export function Gpio(__recorder) { if (item.scheme.pulse.delay) { controls.push(` <td><button disabled id="gpio-button-${item.channel}" class="gpio-button" - data-channel="${item.channel}" data-confirm="${confirm}">${item.text}</button></td> + ${item.hide ? "data-force-hide-menu" : ""} + data-channel="${item.channel}" data-confirm="${confirm}"> + ${(item.hide ? "• " : "") + item.text} + </button></td> `); } return `<table><tr>${controls.join("<td> </td>")}</tr></table>`; |