summaryrefslogblamecommitdiffstats
path: root/modules-available/rebootcontrol/templates/status-reboot.html
blob: 7b46cab4b372f6735ce1cad847697e386cc956cf (plain) (tree)
1
2
3
4
5
6




                                      
 









                                                                   
 












                                                                                                                         
 
                                                                                   
 














                                                                   
                                 

                                                          

                                                               
                                                    










                                                                                                 



                         
<h3>{{action}}</h3>
{{#locations}}
<div class="loc">{{name}}</div>
{{/locations}}
<div class="clearfix slx-space"></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>{{hostname}}{{^hostname}}{{machineuuid}}{{/hostname}}</td>
			<td>{{clientip}}</td>
			<td>
				<span id="status-{{machineuuid}}" class="machineuuid" data-uuid="{{machineuuid}}"></span>
				<span id="text-{{machineuuid}}"></span>
			</td>
		</tr>
	{{/clients}}
	</tbody>
</table>

<div data-tm-id="{{id}}" data-tm-log="error" data-tm-callback="updateStatus"></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;
		stillActive = 25;
		var clientStatus = task.data.clientStatus;
		for (var uuid in clientStatus) {
			if (!clientStatus.hasOwnProperty(uuid))
				continue;
			var $s = $("#text-" + uuid);
			var status = clientStatus[uuid];
			if ($s.data('state') === status)
				continue;
			$s.data('state', status);
			var text = statusStrings[status];
			if (status === 'SHUTDOWN_AT' || status === 'REBOOT_AT') {
				text += ' ' + task.data.time;
			}
			$s.text(text);
			if (status === 'CONNECTING' || status === 'REBOOTING') {
				$s.append('<span class="glyphicon glyphicon-hourglass"></span>');
			}
		}
	}
</script>