diff options
author | Devaev Maxim <[email protected]> | 2018-09-26 02:57:24 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-09-26 02:57:24 +0300 |
commit | 81a5311349564a1016c4af2bf18ae872b650e85b (patch) | |
tree | d01fd027948494e22ae2c14334b98c1515e5e8a4 /kvmd/web/js/atx.js | |
parent | f3946f102fc167efdc53c73412b2c0d6ac6c72c5 (diff) |
moved kvmd to the root
Diffstat (limited to 'kvmd/web/js/atx.js')
-rw-r--r-- | kvmd/web/js/atx.js | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/kvmd/web/js/atx.js b/kvmd/web/js/atx.js deleted file mode 100644 index f4b4811a..00000000 --- a/kvmd/web/js/atx.js +++ /dev/null @@ -1,63 +0,0 @@ -function Atx() { - var self = this; - - /********************************************************************************/ - - var __init__ = function() { - $("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?")); - }; - - /********************************************************************************/ - - self.loadInitialState = function() { - var http = tools.makeRequest("GET", "/kvmd/atx", function() { - if (http.readyState === 4) { - if (http.status === 200) { - __setButtonsBusy(JSON.parse(http.responseText).result.busy); - } else { - setTimeout(self.loadInitialState, 1000); - } - } - }); - }; - - self.setState = function(state) { - __setButtonsBusy(state.busy); - $("atx-power-led").className = (state.leds.power ? "led-on" : "led-off"); - $("atx-hdd-led").className = (state.leds.hdd ? "led-hdd-busy" : "led-off"); - }; - - self.clearState = function() { - $("atx-power-led").className = "led-off"; - $("atx-hdd-led").className = "led-off"; - }; - - var __clickButton = function(button, timeout, confirm_msg) { - ui.confirm(confirm_msg).then(function(ok) { - if (ok) { - var http = tools.makeRequest("POST", "/kvmd/atx/click?button=" + button, function() { - if (http.readyState === 4) { - if (http.status === 409) { - ui.error("Performing another ATX operation for other client.<br>Please try again later"); - } else if (http.status !== 200) { - ui.error("Click error:<br>", http.responseText); - } - } - }, timeout); - } - }); - }; - - var __setButtonsBusy = function(busy) { - $("atx-power-button").disabled = busy; - $("atx-power-button-long").disabled = busy; - $("atx-reset-button").disabled = busy; - }; - - __init__(); -} |