Skip to content

Commit

Permalink
pikvm/pikvm#1312: Option to close GPIO menu after click
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevaev committed May 12, 2024
1 parent 5f44ac9 commit b9d425e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion kvmd/apps/kvmd/ugpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,19 @@ def __make_item_input(self, parts: list[str]) -> dict:
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,
}
5 changes: 4 additions & 1 deletion web/share/js/kvm/gpio.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "&bull; " : "") + item.text}
</button></td>
`);
}
return `<table><tr>${controls.join("<td>&nbsp;&nbsp;&nbsp;</td>")}</tr></table>`;
Expand Down

0 comments on commit b9d425e

Please sign in to comment.