summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-10 18:26:43 +0300
committerDevaev Maxim <[email protected]>2020-09-10 18:26:43 +0300
commitbae65c35ee9db3dfd478fb60ce20cdf6d3a2e57b (patch)
tree2133203e4fea515f82213cb33310f306573ab3ad /web
parent92ba157b6758d26d21c512c6ad166f86d8b5f00d (diff)
led colors
Diffstat (limited to 'web')
-rw-r--r--web/share/js/kvm/gpio.js10
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}`);
}
};