summaryrefslogtreecommitdiff
path: root/web/js/kvm/atx.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/kvm/atx.js')
-rw-r--r--web/js/kvm/atx.js19
1 files changed, 8 insertions, 11 deletions
diff --git a/web/js/kvm/atx.js b/web/js/kvm/atx.js
index e4f591d5..12dfaa44 100644
--- a/web/js/kvm/atx.js
+++ b/web/js/kvm/atx.js
@@ -7,17 +7,20 @@ function Atx() {
$("atx-power-led").title = "Power Led";
$("atx-hdd-led").title = "Disk Activity Led";
- tools.setOnClick($("atx-power-button"), () => __clickButton("power", null, "Are you sure to click the power button?"));
- tools.setOnClick($("atx-power-button-long"), () => __clickButton("power_long", 15000, "Are you sure to perform the long press of the power button?"));
- tools.setOnClick($("atx-reset-button"), () => __clickButton("reset", null, "Are you sure to reboot the server?"));
+ tools.setOnClick($("atx-power-button"), () => __clickButton("power", "Are you sure to click the power button?"));
+ tools.setOnClick($("atx-power-button-long"), () => __clickButton("power_long", "Are you sure to perform the long press of the power button?", 15000));
+ tools.setOnClick($("atx-reset-button"), () => __clickButton("reset", "Are you sure to reboot the server?"));
};
/********************************************************************************/
self.setState = function(state) {
- __setButtonsBusy(state.busy);
$("atx-power-led").className = (state.leds.power ? "led-green" : "led-gray");
$("atx-hdd-led").className = (state.leds.hdd ? "led-red" : "led-gray");
+
+ $("atx-power-button").disabled = state.busy;
+ $("atx-power-button-long").disabled = state.busy;
+ $("atx-reset-button").disabled = state.busy;
};
self.clearState = function() {
@@ -25,7 +28,7 @@ function Atx() {
$("atx-hdd-led").className = "led-gray";
};
- var __clickButton = function(button, timeout, confirm_msg) {
+ var __clickButton = function(button, confirm_msg, timeout=null) {
ui.confirm(confirm_msg).then(function(ok) {
if (ok) {
var http = tools.makeRequest("POST", "/kvmd/atx/click?button=" + button, function() {
@@ -41,11 +44,5 @@ function Atx() {
});
};
- var __setButtonsBusy = function(busy) {
- $("atx-power-button").disabled = busy;
- $("atx-power-button-long").disabled = busy;
- $("atx-reset-button").disabled = busy;
- };
-
__init__();
}