summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/templates/status.html
blob: c2fdab46a09d14407066ae9ee8bb92ee06710778 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<div>
	<form class="form-inline">
			<b>{{lang_location}}: {{locationName}}</b>
			<input type="hidden" name="do" value="rebootcontrol">
			<input type="hidden" name="location" value="{{locationId}}">
			<button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-arrow-left"></span> {{lang_back}}</button>
	</form>
</div>

<div data-tm-id="{{taskId}}" data-tm-log="error" data-tm-callback="updateStatus"></div>

<div>
	<table class="table table-hover stupidtable" id="dataTable">
		<thead>
			<tr>
				<th data-sort="string">{{lang_client}}</th>
				<th data-sort="ipv4">{{lang_ip}}</th>
				<th data-sort="string">
					{{lang_status}}
				</th>
			</tr>
		</thead>

		<tbody>
		{{#clients}}
			<tr>
				<td>{{machineuuid}}</td>
				<td>{{clientip}}</td>
				<td id="status-{{machineuuid}}"></td>
			</tr>
		{{/clients}}
		</tbody>
	</table>
</div>

<script type="application/javascript">
	statusStrings = {
		"CONNECTING" : "{{lang_connecting}}",
		"REBOOTING" : "{{lang_rebooting}}",
		"REBOOT_AT" : "{{lang_rebootAt}}",
		"ONLINE" : "{{lang_online}}",
		"ERROR" : "{{lang_error}}",
		"SHUTDOWN" : "{{lang_shutdown}}",
		"SHUTDOWN_AT" : "{{lang_shutdownAt}}",
		"AUTH_FAIL" : "{{lang_authFail}}"
	};

	function updateStatus(task) {
		if (!task || !task.data || !task.data.clientStatus)
			return;
		var clientStatus = task.data.clientStatus;
		for (var uuid in clientStatus) {
			if (clientStatus.hasOwnProperty(uuid)) {
				var shutdownTime = ' ';
				if (clientStatus[uuid] === 'SHUTDOWN_AT' || clientStatus[uuid] === 'REBOOT_AT') {
					shutdownTime += task.data.time;
				}
				$("#status-" + uuid).text(statusStrings[clientStatus[uuid]] + shutdownTime);
			}
		}
	}
</script>