diff options
author | Devaev Maxim <[email protected]> | 2018-12-04 10:19:10 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-12-04 10:19:10 +0300 |
commit | 4f901d2f78d51b9613e8a88f612653fa65b1e2dc (patch) | |
tree | 6c85c61b7253613ceba91f18845258b1ca345617 /web/js/kvm/atx.js | |
parent | a57e5cdaa92d6843057321e3b470c396a9e593a8 (diff) |
web: process default states
Diffstat (limited to 'web/js/kvm/atx.js')
-rw-r--r-- | web/js/kvm/atx.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/web/js/kvm/atx.js b/web/js/kvm/atx.js index 6a641ac9..ed5f045e 100644 --- a/web/js/kvm/atx.js +++ b/web/js/kvm/atx.js @@ -15,17 +15,12 @@ function Atx() { /********************************************************************************/ self.setState = function(state) { - $("atx-power-led").className = (state.leds.power ? "led-green" : "led-gray"); - $("atx-hdd-led").className = (state.leds.hdd ? "led-red" : "led-gray"); + $("atx-power-led").className = ((state && state.leds.power) ? "led-green" : "led-gray"); + $("atx-hdd-led").className = ((state && state.leds.hdd) ? "led-red" : "led-gray"); - wm.switchDisabled($("atx-power-button"), state.busy); - wm.switchDisabled($("atx-power-button-long"), state.busy); - wm.switchDisabled($("atx-reset-button"), state.busy); - }; - - self.clearState = function() { - $("atx-power-led").className = "led-gray"; - $("atx-hdd-led").className = "led-gray"; + wm.switchDisabled($("atx-power-button"), (!state || state.busy)); + wm.switchDisabled($("atx-power-button-long"), (!state || state.busy)); + wm.switchDisabled($("atx-reset-button"), (!state || state.busy)); }; var __clickButton = function(button, confirm_msg) { |