summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/templates/status-wol.html
blob: 5a53a6f8f8af1c40a9c25243770a8ea7e69008be (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
63
64
65
66
67
68
69
70
71
72
73
74
{{#locations}}
<div class="loc">{{name}}</div>
{{/locations}}
<div class="clearfix slx-space"></div>

{{#tasks}}
<div data-tm-id="{{.}}" data-tm-callback="wolCallback" data-tm-log="messages" data-tm-log-fail-only="true">{{lang_aWolJob}}</div>
{{/tasks}}
{{^tasks}}
<div class="alert alert-warning">
	<span class="glyphicon glyphicon-exclamation-sign"></span>
	{{lang_noTasksForJob}}
</div>
{{/tasks}}

<pre>{{log}}</pre>

<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>{{hostname}}{{^hostname}}{{machineuuid}}{{^machineuuid}}{{clientip}}{{/machineuuid}}{{/hostname}}</td>
		<td>{{clientip}}</td>
		{{#machineuuid}}
		<td>
			<span id="status-{{machineuuid}}" class="machineuuid" data-uuid="{{machineuuid}}"></span>
			<span id="spinner-{{machineuuid}}" class="glyphicon glyphicon-refresh slx-rotation"></span>
		</td>
		{{/machineuuid}}
		{{^machineuuid}}
		<td></td>
		{{/machineuuid}}
	</tr>
	{{/clients}}
	</tbody>
</table>

<a class="text-muted" href="#debug-out" data-toggle="collapse">Debug</a>
<pre id="debug-out" class="collapse"></pre>

<script><!--
function wolCallback(task) {
	if (task.statusCode === 'TASK_WAITING' || task.statusCode === 'TASK_PROCESSING') {
		stillActive = 25;
	} else if (task.data && task.data.result) {
		var $do = $('#debug-out');
		var txt = $do.text();
		var res = task.data.result;
		for (var k in res) {
			if (res.hasOwnProperty(k)) {
				txt += k + ":\n";
				if (res[k].stdout && res[k].stdout.trimEnd && res[k].stdout.trimEnd()) {
					txt += res[k].stdout.trimEnd() + "\n";
				}
				if (res[k].stderr && res[k].stderr.trimEnd && res[k].stderr.trimEnd()) {
					txt += res[k].stderr.trimEnd() + "\n";
				}
				txt += "Exit " + res[k].exitCode + "\n\n";
			}
		}
		$do.text(txt);
	}
}
//--></script>