diff options
author | Devaev Maxim <[email protected]> | 2020-09-10 18:26:43 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-10 18:26:43 +0300 |
commit | bae65c35ee9db3dfd478fb60ce20cdf6d3a2e57b (patch) | |
tree | 2133203e4fea515f82213cb33310f306573ab3ad /web/share/js/kvm/gpio.js | |
parent | 92ba157b6758d26d21c512c6ad166f86d8b5f00d (diff) |
led colors
Diffstat (limited to 'web/share/js/kvm/gpio.js')
-rw-r--r-- | web/share/js/kvm/gpio.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/web/share/js/kvm/gpio.js b/web/share/js/kvm/gpio.js index cbbe219b..a412d579 100644 --- a/web/share/js/kvm/gpio.js +++ b/web/share/js/kvm/gpio.js @@ -109,7 +109,10 @@ export function Gpio() { if (item.type === "label") { return item.text; } else if (item.type === "input") { - return `<img id="gpio-led-${item.channel}" class="gpio-led inline-lamp-big led-gray" src="/share/svg/led-circle.svg" />`; + return ` + <img id="gpio-led-${item.channel}" class="gpio-led inline-lamp-big led-gray" + src="/share/svg/led-circle.svg" data-color="${item.color}" /> + `; } else if (item.type === "output") { let controls = []; if (item.scheme["switch"]) { @@ -135,12 +138,13 @@ export function Gpio() { }; var __setLedState = function(el, state) { + let color = el.getAttribute("data-color"); if (state) { - el.classList.add("led-green"); + el.classList.add(`led-${color}`); el.classList.remove("led-gray"); } else { el.classList.add("led-gray"); - el.classList.remove("led-green"); + el.classList.remove(`led-${color}`); } }; |