mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 10:31:54 +08:00
minor partial state fixes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user