summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/templates/clientlist.html
blob: 73148eb8ca64bef67e8fdfaa348c16e2c643a483 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129



<h1>{{lang_clientList}} ({{rowCount}})</h1>

<table class="table table-condensed table-striped">
	<tr>
		<th>{{lang_machine}}</th>
		<th>{{lang_address}}
			<div class="btn-group pull-right">
				<button class="btn btn-default btn-xs" id="sortButton-clientip"></button>
			</div>

		</th>
		<th class="text-right">{{lang_lastSeen}}
			<div class="btn-group pull-right">
				<button class="btn btn-default btn-xs" id="sortButton-lastseen"></button>
				<button class="btn btn-default btn-xs" onclick="popupFilter('lastseen')">
					<span id="btn_filter_lastseen" class="glyphicon glyphicon-filter"></span>
				</button>
			</div>
		</th>
		<th>
			{{lang_kvmSupport}}
			<div class="btn-group pull-right">
			<button class="btn btn-default btn-xs" id="sortButton-kvmstate"></button>
			<button class="btn btn-default btn-xs" onclick="popupFilter('kvmstate')">
				<span id="btn_filter_kvmstate" class="glyphicon glyphicon-filter"></span>
			</button>
			</div>
		</th>
		<th class="text-right">
			{{lang_gbRam}}
			<div class="btn-group pull-right">
				<button class="btn btn-default btn-xs" id="sortButton-gbram"></button>
				<button class="btn btn-default btn-xs" onclick="popupFilter('gbram')">
					<span id="btn_filter_gbram" class="glyphicon glyphicon-filter"></span>
				</button>
			</div>
		</th>
		<th class="text-right">
			{{lang_tmpGb}}
			<div class="btn-group pull-right">
			<button class="btn btn-default btn-xs" id="sortButton-hddgb"></button>
			<button class="btn btn-default btn-xs" onclick="popupFilter('hddgb')">
				<span id="btn_filter_hddgb" class="glyphicon glyphicon-filter"></span>
			</button>
			</div>
		</th>
		<th>{{lang_cpuModel}}
			<div class="btn-group pull-right">
			<button class="btn btn-default btn-xs" id="sortButton-realcores"></button>
			<button class="btn btn-default btn-xs" onclick="popupFilter('realcores')">
				<span id="btn_filter_cpu" class="glyphicon glyphicon-filter"></span>
			</button>
			</div>
		</th>
	</tr>
	{{#rows}}
	<tr>
		<td class="text-nowrap">
			{{#hasnotes}}<span class="glyphicon glyphicon-exclamation-sign pull-right"></span>{{/hasnotes}}
			{{#state_off}}
			<span class="glyphicon glyphicon-off" title="{{lang_machineOff}}"></span>
			{{/state_off}}
			{{#state_idle}}
			<span class="glyphicon glyphicon-ok green" title="{{lang_machineIdle}}"></span>
			{{/state_idle}}
			{{#state_occupied}}
			<span class="glyphicon glyphicon-user red" title="{{lang_machineOccupied}}"></span>
			{{/state_occupied}}
			<a href="?do=Statistics&amp;uuid={{machineuuid}}"><b>{{hostname}}</b></a>
			<div class="small">{{machineuuid}}</div>
		</td>
		<td><b><a href="?do=Statistics&amp;show=list&amp;filters=subnet={{subnet}}">{{subnet}}</a>{{lastoctet}}</b><br>{{macaddr}}</td>
		<td class="text-right">{{lastseen}}</td>
		<td class="{{kvmclass}}">{{kvmstate}}</td>
		<td class="text-right {{ramclass}}">{{gbram}}&thinsp;GiB</td>
		<td class="text-right {{hddclass}}">
			{{gbtmp}}&thinsp;GiB
			{{#badsectors}}<div>
				<span class="glyphicon glyphicon-exclamation-sign"></span>
				{{badsectors}}
			</div>{{/badsectors}}
			{{#nohdd}}<div>
				<span class="glyphicon glyphicon-hdd red"></span>
			</div>{{/nohdd}}
		</td>
		<td>{{lang_realCores}}: {{realcores}}<div class="small">{{cpumodel}}</div></td>
	</tr>
	{{/rows}}
</table>

<script type="application/javascript"><!--
document.addEventListener("DOMContentLoaded", function () {
	['gbram', 'hddgb', 'realcores', 'kvmstate', 'lastseen', 'clientip'].forEach(function (v) {
		var $sortBtn = $('#sortButton-' + v);
		var order = 'up'; /* default */
		if ($('#sortColumn').val() == v) {
			$sortBtn.addClass('btn-success');
			order = $('#sortDirection').val() == 'ASC' ? 'up' : 'down';
		}
		$sortBtn.html('<span class="glyphicon glyphicon-arrow-' + order + '"></span>');
		$sortBtn.attr('onclick', 'toggleButton(\'' + v + '\');');
	});
});

function toggleButton(v) {
	var $sortBtn = $('#sortButton-' + v);
	var $col = $('#sortColumn');
	var $dir = $('#sortDirection');
	if ($col.val() == v) {
		/* toggle direction */
		var newDir = $dir.val() == 'ASC' ? 'DESC' : 'ASC';
		$dir.val(newDir);
		/* update button */
		var order =  newDir == 'ASC' ? 'up' : 'down';
		$sortBtn.html('<span class="glyphicon glyphicon-arrow-' + order + '"></span>');
	} else {
		/* remove "btn-success" from current sorting */
		$('#sortButton-'+v).removeClass('btn-success');
		$sortBtn.addClass('btn-success');
		$col.val(v);
		$dir = 'ASC';
	}
	$queryForm.submit();
}

//--></script>