diff options
author | Maxim Devaev <[email protected]> | 2024-11-04 18:06:16 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-11-04 18:06:16 +0200 |
commit | 7ef2e16b51eab24897cc6447c826a5a1c2b8efed (patch) | |
tree | 1dafb2521cfa1e91a213f823b98873fc47000e74 /web/share/js/kvm/atx.js | |
parent | d93639ba8dcd003f82221f4ed99159755f2213c3 (diff) |
minor partial state fixes
Diffstat (limited to 'web/share/js/kvm/atx.js')
-rw-r--r-- | web/share/js/kvm/atx.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/web/share/js/kvm/atx.js b/web/share/js/kvm/atx.js index 4d9764ea..796a4eeb 100644 --- a/web/share/js/kvm/atx.js +++ b/web/share/js/kvm/atx.js @@ -53,30 +53,33 @@ export function Atx(__recorder) { __state = {"leds": {}}; } if (state.enabled !== undefined) { - tools.feature.setEnabled($("atx-dropdown"), state.enabled); __state.enabled = state.enabled; + tools.feature.setEnabled($("atx-dropdown"), __state.enabled); } if (__state.enabled !== undefined) { if (state.busy !== undefined) { - __updateButtons(!state.busy); __state.busy = state.busy; + __updateButtons(!__state.busy); } if (state.leds !== undefined) { __state.leds = state.leds; } if (state.busy !== undefined || state.leds !== undefined) { - let busy = __state.busy; - let leds = __state.leds; - $("atx-power-led").className = (busy ? "led-yellow" : (leds.power ? "led-green" : "led-gray")); - $("atx-hdd-led").className = (leds.hdd ? "led-red" : "led-gray"); + __updateLeds(__state.leds.power, __state.leds.hdd, __state.busy); } } } else { __state = null; + __updateLeds(false, false, false); __updateButtons(false); } }; + var __updateLeds = function(power, hdd, busy) { + $("atx-power-led").className = (busy ? "led-yellow" : (power ? "led-green" : "led-gray")); + $("atx-hdd-led").className = (hdd ? "led-red" : "led-gray"); + }; + var __updateButtons = function(enabled) { for (let id of ["atx-power-button", "atx-power-button-long", "atx-reset-button"]) { tools.el.setEnabled($(id), enabled); |