summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/templates/status-checkconnection.html
blob: e31d95eaa3b61fbba0d0e4913532f9c448f595e7 (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
<h3>{{lang_checkingJumpHost}}: {{host}}</h3>

<div class="clearfix"></div>
<div class="collapse alert alert-success" id="result-ok">
	<span class="glyphicon glyphicon-check"></span>
	{{lang_hostReachable}}
</div>
<div class="collapse alert alert-warning" id="result-error">
	<span class="glyphicon glyphicon-remove"></span>
	{{lang_hostNonZeroExit}}
</div>
<div class="collapse alert alert-danger" id="result-unreach">
	<span class="glyphicon glyphicon-remove"></span>
	{{lang_hostNotReachable}}
</div>

<div class="collapse" id="log-wrapper">
	<label for="log-output">{{lang_checkOutputLabel}}</label>
	<pre id="log-output"></pre>
</div>

<div data-tm-id="{{taskId}}" data-tm-log="error" data-tm-callback="updateStatus">{{lang_checkingJumpHost}}</div>
<script type="application/javascript">
	function updateStatus(task) {
		if (!task || !task.data || !task.data.result || !task.data.result['{{host}}'])
			return;
		var status = task.data.result['{{host}}'];
		var log = '';
		if (status.stderr) log += status.stderr + "\n";
		if (status.stdout) log += status.stdout + "\n";
		showErrorLog(log);
		if (task.statusCode === 'TASK_FINISHED' || task.statusCode === 'TASK_ERROR') {
			if (status.exitCode === 0) {
				$('#result-ok').show();
			} else if (status.exitCode > 0) {
				$('#result-error').show();
			} else {
				$('#result-unreach').show();
			}
		}
	}
	function showErrorLog(log) {
		if (!log) return;
		$('#log-output').text(log);
		$('#log-wrapper').show();
	}
</script>