blob: 80be25336b460bc13a9706cdbabf8972f98c1b39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
});
|