summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/clientscript.js
diff options
context:
space:
mode:
authorSimon Rettberg2019-12-07 13:52:54 +0100
committerSimon Rettberg2019-12-07 13:52:54 +0100
commit3e45ec44d22f03ca6642e08f695c6d7274cecfaf (patch)
treea71b2ec81895b198757d8ec7272548b42ee074b8 /modules-available/rebootcontrol/clientscript.js
parent[apis/cron] Simple logging function for debugging (diff)
downloadslx-admin-3e45ec44d22f03ca6642e08f695c6d7274cecfaf.tar.gz
slx-admin-3e45ec44d22f03ca6642e08f695c6d7274cecfaf.tar.xz
slx-admin-3e45ec44d22f03ca6642e08f695c6d7274cecfaf.zip
[statistics/rebootcontrol] Add WOL button to statistics module
* Overhauled task display in rebootcontrol module * Can only add subnets by CIDR now instead of start and end
Diffstat (limited to 'modules-available/rebootcontrol/clientscript.js')
-rw-r--r--modules-available/rebootcontrol/clientscript.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/clientscript.js b/modules-available/rebootcontrol/clientscript.js
new file mode 100644
index 00000000..80be2533
--- /dev/null
+++ b/modules-available/rebootcontrol/clientscript.js
@@ -0,0 +1,27 @@
+var stillActive = true;
+document.addEventListener('DOMContentLoaded', function() {
+ var clients = [];
+ $('.machineuuid').each(function() { clients.push($(this).data('uuid')); });
+ if (clients.length === 0)
+ return;
+ function updateClientStatus() {
+ if (!stillActive) return;
+ stillActive = false;
+ setTimeout(updateClientStatus, 5000);
+ $.ajax({
+ url: "?do=rebootcontrol",
+ method: "POST",
+ dataType: 'json',
+ data: { token: TOKEN, action: "clientstatus", clients: clients }
+ }).done(function(data) {
+ console.log(data);
+ if (!data)
+ return;
+ for (var e in data) {
+ $('#status-' + e).prop('class', 'glyphicon ' + data[e]);
+ if (!stillActive) $('#spinner-' + e).remove();
+ }
+ });
+ }
+ setTimeout(updateClientStatus, 1000);
+}); \ No newline at end of file