summaryrefslogblamecommitdiffstats
path: root/modules-available/statistics/templates/clientlist.html
blob: 18a5d10a8cf1386dc43abda1dc604db13ae32cfc (plain) (tree)
1
2
3
4
5
6
7

                                           


                                                           
 
                                                               




                                               
                                                                                                                       
                                                                                        
                                         

                             
                                                                                                                       
                                                                                        


                                               
                                                                                                                    
                                                                                        
                                         

                                               
                                                                                                                    
                                                                                        


                                         
                                                                                                                        
                                                                                        

                                         




                                                                                                                       








                                                                                     
                                                                     





                                                                               



                                                                                                                                          


                                                                                                     
                                          
                                                                                                         

                                          
                                                                                                               

                                           
                                                                                                                   



                                                                                                           






                                                                                  
                                                                        




                                                                                                                                        

                                                                                                                                                                                      
                                                                                                               



                                                                                                                 

                                                                                                                                          
                                                      
                                                            




                                                                                                                                       
                                                                                    


                         
        

                                                             
                                                                         

                                      
                                                                                                                   
























                                                                                                                                   

                                          


                           










                                                                                                  




                                              




















                                                                           






















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

<form method="post" action="?do=statistics">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="redirect" value="?{{redirect}}">

<table class="stupidtable table table-condensed table-striped">
	<thead>
		<tr>
			<td></td>
			<td></td>
			<td class="text-right">
				<button type="button" class="btn btn-default btn-xs" onclick="popupFilter('lastseen')">
					<span class="glyphicon glyphicon-filter"></span>
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-default btn-xs" onclick="popupFilter('kvmstate')">
					<span class="glyphicon glyphicon-filter"></span>
				</button>
			</td>
			<td class="text-right">
				<button type="button" class="btn btn-default btn-xs" onclick="popupFilter('gbram')">
					<span class="glyphicon glyphicon-filter"></span>
				</button>
			</td>
			<td class="text-right">
				<button type="button" class="btn btn-default btn-xs" onclick="popupFilter('hddgb')">
					<span class="glyphicon glyphicon-filter"></span>
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-default btn-xs" onclick="popupFilter('realcores')">
					<span class="glyphicon glyphicon-filter"></span>
				</button>
			</td>
			<td>
				<button type="button" class="btn btn-default btn-xs" onclick="popupFilter('location')">
					<span class="glyphicon glyphicon-filter"></span>
				</button>
			</td>
		</tr>
		<tr>
			<th data-sort="string">{{lang_machine}}</th>
			<th data-sort="ipv4">{{lang_address}}</th>
			<th data-sort="int" class="text-right">{{lang_lastSeen}}</th>
			<th data-sort="string">{{lang_kvmSupport}}</th>
			<th data-sort="int" class="text-right">{{lang_gbRam}}</th>
			<th data-sort="int" class="text-right">{{lang_tmpGb}}</th>
			<th data-sort="int">{{lang_cpuModel}}</th>
			<th data-sort="string">{{lang_location}}</th>
		</tr>
	</thead>
	<tbody>
		{{#rows}}
		<tr>
			<td data-sort-value="{{hostname}}" class="text-nowrap">
			<div class="checkbox checkbox-inline">
				<input type="checkbox" name="uuid[]" value="{{machineuuid}}" class="deleteCheckboxes" {{delete_disabled}}>
				<label></label>
			</div>
			{{#hasnotes}}
				<span class="glyphicon glyphicon-exclamation-sign pull-right"></span>
			{{/hasnotes}}
			{{#state_OFFLINE}}
				<span class="glyphicon glyphicon-off" title="{{lang_machineOff}}"></span>
			{{/state_OFFLINE}}
			{{#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}}
			{{#state_STANDBY}}
			<span class="glyphicon glyphicon-off green" title="{{lang_machineStandby}}"></span>
			{{/state_STANDBY}}
				{{#link_details}}
				<a href="?do=Statistics&amp;uuid={{machineuuid}}">
				{{/link_details}}
					<b>{{hostname}}</b>
				{{#link_details}}
				</a>
				{{/link_details}}
				<div class="small">{{machineuuid}}</div>
			{{#rmmodule}}
				<div class="small">{{lang_runMode}}:
					<a class="slx-bold" href="?do=runmode&amp;module={{rmmodule}}">{{moduleName}}</a> / {{modeName}}
				</div>
			{{/rmmodule}}
			</td>
			<td data-sort-value="{{clientip}}"><b><a href="?do=Statistics&amp;show=list&amp;filters=subnet={{subnet}}">{{subnet}}</a>{{lastoctet}}</b><br>{{macaddr}}</td>
			<td data-sort-value="{{lastseen_int}}" class="text-right text-nowrap">{{lastseen}}</td>
			<td class="{{kvmclass}}">{{kvmstate}}</td>
			<td data-sort-value="{{gbram}}" class="text-right {{ramclass}}">{{gbram}}&thinsp;GiB</td>
			<td data-sort-value="{{gbtmp}}" class="text-right {{hddclass}}">
				{{gbtmp}}&thinsp;GiB
				{{#badsectors}}<div><span data-toggle="tooltip" title="{{lang_reallocatedSectors}}" data-placement="left">
					<span class="glyphicon glyphicon-exclamation-sign"></span>
					{{badsectors}}
				</span></div>{{/badsectors}}
				{{#nohdd}}<div>
					<span class="glyphicon glyphicon-hdd red"></span>
				</div>{{/nohdd}}
			</td>
			<td data-sort-value="{{realcores}}">{{lang_realCores}}: {{realcores}}<div class="small">{{cpumodel}}</div></td>
			<td data-sort-value="{{locationname}}">{{locationname}}</td>
		</tr>
		{{/rows}}
	</tbody>
</table>
	<div class="text-right buttonbar">
		<button type="reset" class="btn btn-default">
			<span class="glyphicon glyphicon-refresh"></span>
			{{lang_reset}}
		</button>
		<button id="deleteButton" type="button" class="btn btn-danger" onclick="$('#del-confirm').modal()">
			<span class="glyphicon glyphicon-trash"></span>
			{{lang_delete}}
		</button>
	</div>
	<div class="modal fade" id="del-confirm" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">&times;</button>
					<b>{{lang_delete}}</b>
				</div>
				<div class="modal-body">
					{{lang_sureDeletePermanent}}
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
					<button type="submit" class="btn btn-danger"  name="action" value="delmachines">
						<span class="glyphicon glyphicon-trash"></span>
						{{lang_delete}}
					</button>
				</div>
			</div>
		</div>
	</div>
</form>

<script type="application/javascript"><!--

selectedMachineCounter = 0;

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 + '\');');
	});

	$('[data-toggle="tooltip"]').tooltip({
		container: 'body',
		trigger : 'hover'
	});

	$("#deleteButton").prop("disabled", true);
	$(".deleteCheckboxes").change(function() {
		if ($(this).is(':checked')) {
			selectedMachineCounter++;
			if (selectedMachineCounter === 1) {
				$("#deleteButton").prop("disabled", false);
			}
		} else {
			selectedMachineCounter--;
			if (selectedMachineCounter === 0) {
				$("#deleteButton").prop("disabled", true);
			}
		}
	});

	$("button[type=reset]").click(function() {
		selectedMachineCounter = 0;
		$("#deleteButton").prop("disabled", true);
	});

});

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>