diff options
Diffstat (limited to 'modules-available/statistics/templates/clientlist.html')
-rw-r--r-- | modules-available/statistics/templates/clientlist.html | 304 |
1 files changed, 221 insertions, 83 deletions
diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html index 47be4dd0..fcb98774 100644 --- a/modules-available/statistics/templates/clientlist.html +++ b/modules-available/statistics/templates/clientlist.html @@ -1,46 +1,23 @@ +<div class="slx-right"> + {{{roomsvg}}} + {{#sidebar}} + <div class="infobox">{{.}}</div> + {{/sidebar}} +</div> + <h2>{{lang_clientList}} ({{rowCount}})</h2> +<button class="btn btn-default" type="button" data-toggle="modal" + data-target="#column-selector">{{lang_selectColumns}}</button> + +<div class="clearfix"></div> <form method="post" action="?do=statistics" id="list-form"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="redirect" value="?{{redirect}}"> -<table class="stupidtable table table-condensed table-striped"> +<table id="client-list" 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> + <tr id="thead"> <th data-sort="string"> <div class="checkbox checkbox-inline"> <input type="checkbox" id="toggle-all"> @@ -48,13 +25,15 @@ </div> {{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> + <th data-sort="ipv4" data-column="clientip">{{lang_address}}</th> + <th data-sort="int" data-column="nicspeed" class="text-right">{{lang_nicSpeed}}</th> + <th data-sort="int" data-column="lastseen" class="text-right">{{lang_lastSeen}}</th> + <th data-sort="string" data-column="kvmstate">{{lang_kvmSupport}}</th> + <th data-sort="int" data-column="gbram" class="text-right">{{lang_gbRam}}</th> + <th data-sort="int" data-column="hddgb" class="text-right">{{lang_tmpGb}}</th> + <th data-sort="int" data-column="persistentgb" class="text-right">{{lang_persistentPart}}</th> + <th data-sort="int" data-column="realcores">{{lang_cpuModel}}</th> + <th data-sort="string" data-column="location">{{lang_location}}</th> </tr> </thead> <tbody> @@ -98,31 +77,57 @@ {{/link_details}} <div class="small uuid">{{machineuuid}}</div> {{#rmmodule}} - <div class="small">{{lang_runMode}}: + <div class="small">{{lang_configuredRunMode}}: <a class="slx-bold" href="?do=runmode&module={{rmmodule}}">{{moduleName}}</a> / {{modeName}} </div> {{/rmmodule}} + {{#wrongRunMode}} + <div class="small text-danger"> + {{lang_clientInDifferentRunmode}}: {{currentrunmode}} + {{^currentrunmode}} + {{lang_bootedWithoutAnyRunmode}} + {{/currentrunmode}} + </div> + {{/wrongRunMode}} + {{#currentuser}} + <div class="small"> + {{lang_user}}: + <b>{{currentuser}}</b> + </div> + {{/currentuser}} </td> <td data-sort-value="{{clientip}}"> - <b><a href="?do=Statistics&show=list&filters=subnet={{subnet}}">{{subnet}}</a>{{lastoctet}}</b> + <b><a href="?do=statistics&show=list&filters=clientip={{subnet}}/24">{{subnet}}.</a>{{lastoctet}}</b> <div class="mac text-nowrap">{{macaddr}}</div> <div class="hidden ip">{{clientip}}</div> </td> + <td data-sort-value="{{nic-speed}}" class="text-right"> + {{nic-speed_s}} MBit/s + </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}} GiB</td> - <td data-sort-value="{{gbtmp}}" class="text-right {{hddclass}}"> + <td data-sort-value="{{mbram}}" class="text-right {{ramclass}}">{{gbram}} GiB</td> + <td data-sort-value="{{id44mb}}" class="text-right {{hddclass}}"> {{gbtmp}} 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> + {{^hddcount}}<div> <span class="glyphicon glyphicon-hdd red"></span> - </div>{{/nohdd}} + </div>{{/hddcount}} + {{#hddcount}}<div> + <span class="badge"> + <span class="glyphicon glyphicon-hdd"></span> + {{hddcount}} + </span> + </div>{{/hddcount}} + </td> + <td data-sort-value="{{id45mb}}" class="text-right"> + {{gbpersist}} GiB </td> <td data-sort-value="{{realcores}}">{{lang_realCores}}: {{realcores}}<div class="small">{{cpumodel}}</div></td> - <td data-sort-value="{{locationname}}">{{locationname}}</td> + <td data-sort-value="{{location.sort}}">{{location.name}}</td> </tr> {{/rows}} </tbody> @@ -132,8 +137,9 @@ <span class="glyphicon glyphicon-refresh"></span> {{lang_reset}} </button> - <span class="dropdown"> - <button class="btn btn-default dropdown-toggle btn-machine-action" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"> + <div class="btn-group dropup"> + <button class="btn btn-default dropdown-toggle btn-machine-action" type="button" id="dropdownMenu1" + data-toggle="dropdown" aria-haspopup="true"> <span class="glyphicon glyphicon-list"></span> {{lang_listDropdown}} <span class="caret"></span> @@ -155,42 +161,81 @@ data-target="#mac-list"> {{lang_uuid}} </a></li> + <hr style="margin: 0px"> + <li><a href="#" class="list-btn" data-what="hostname ip mac uuid" data-toggle="modal" + data-target="#mac-list"> + {{lang_fullInfo}} + </a></li> </ul> - </span> + </div> {{#rebootcontrol}} - {{#canShutdown}} - <button type="submit" name="action" value="shutdownmachines" class="btn btn-danger btn-machine-action" - data-confirm="{{lang_shutdownConfirm}}" data-title="{{lang_shutdown}}"> - <span class="glyphicon glyphicon-off"></span> - {{lang_shutdown}} - </button> - {{/canShutdown}} - {{#canReboot}} - <button type="submit" name="action" value="rebootmachines" class="btn btn-warning btn-machine-action" - data-confirm="#confirm-reboot"> - <span class="glyphicon glyphicon-repeat"></span> - {{lang_reboot}} + <div class="btn-group dropup"> + <button class="btn btn-default dropdown-toggle btn-machine-action" type="button" id="dropdownMenu2" + data-toggle="dropdown" aria-haspopup="true"> + <span class="glyphicon glyphicon-list"></span> + {{lang_remoteActions}} + <span class="caret"></span> </button> - {{/canReboot}} - {{#canWol}} - <button type="submit" name="action" value="wol" class="btn btn-primary btn-machine-action"> - <span class="glyphicon glyphicon-bell"></span> - {{lang_wakeOnLan}} - </button> - {{/canWol}} - {{#canExec}} - <button type="submit" name="action" value="prepare-exec" class="btn btn-primary btn-machine-action"> - <span class="glyphicon glyphicon-play"></span> - {{lang_remoteExec}} - </button> - {{/canExec}} + <div class="dropdown-menu" style="padding:0" aria-labelledby="dropdownMenu2"> + <div class="btn-group-vertical"> + {{#canShutdown}} + <button type="submit" name="action" value="shutdownmachines" class="btn btn-danger btn-machine-action" + data-confirm="{{lang_shutdownConfirm}}" data-title="{{lang_shutdown}}"> + <span class="glyphicon glyphicon-off"></span> + {{lang_shutdown}} + </button> + {{/canShutdown}} + {{#canReboot}} + <button type="submit" name="action" value="rebootmachines" class="btn btn-warning btn-machine-action" + data-confirm="#confirm-reboot"> + <span class="glyphicon glyphicon-repeat"></span> + {{lang_reboot}} + </button> + {{/canReboot}} + {{#canWol}} + <button type="submit" name="action" value="wol" class="btn btn-primary btn-machine-action"> + <span class="glyphicon glyphicon-bell"></span> + {{lang_wakeOnLan}} + </button> + {{/canWol}} + {{#canExec}} + <button type="submit" name="action" value="prepare-exec" class="btn btn-primary btn-machine-action"> + <span class="glyphicon glyphicon-play"></span> + {{lang_remoteExec}} + </button> + {{/canExec}} + {{#canBenchmark}} + <button type="submit" name="action" value="benchmark" class="btn btn-primary btn-machine-action"> + <span class="glyphicon glyphicon-dashboard"></span> + {{lang_remoteSpeedcheck}} + </button> + {{/canBenchmark}} + </div> + </div> + </div> {{/rebootcontrol}} {{#canDelete}} + <div class="btn-group dropup"> <button type="submit" name="action" value="delmachines" class="btn btn-danger btn-machine-action" data-confirm="{{lang_sureDeletePermanent}}"> <span class="glyphicon glyphicon-trash"></span> {{lang_delete}} </button> + <button type="button" class="btn btn-danger btn-machine-action dropdown-toggle" + data-toggle="dropdown" aria-haspopup="true"> + <span class="caret"></span> + <span class="sr-only">Toggle Dropdown</span> + </button> + <div class="dropdown-menu" style="padding:0"> + <div class="btn-group-vertical"> + <button type="submit" name="action" value="clear-machines" class="btn btn-danger btn-machine-action" + data-confirm="{{lang_sureClearIp}}"> + <span class="glyphicon glyphicon-refresh"></span> + {{lang_resetClearIp}} + </button> + </div> + </div> + </div> {{/canDelete}} </div> <div class="hidden" id="confirm-reboot"> @@ -217,8 +262,25 @@ </div> </div> +<div class="modal" id="column-selector" 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">×</button> + </div> + <div class="modal-body"></div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" + data-dismiss="modal">{{lang_close}}</button> + </div> + </div> + </div> +</div> + <script type="application/javascript"><!-- +var lookupTable = {}; + document.addEventListener("DOMContentLoaded", function () { var $buttons = $('.btn-machine-action'); var $fn = function () { @@ -226,6 +288,23 @@ document.addEventListener("DOMContentLoaded", function () { }; var $boxes = $('.machine-checkbox'); $boxes.change($fn); + + // Shift click selection for the checkboxes + var lastChecked = null; + $boxes.click(function(e) { + if (!lastChecked) { + lastChecked = this; + return; + } + if (e.shiftKey) { + $boxes = $('.machine-checkbox'); + const start = $boxes.index(this); + const end = $boxes.index(lastChecked); + $boxes.slice(Math.min(start, end), Math.max(start, end) + 1).prop('checked', lastChecked.checked); + } + lastChecked = this; + }); + $("button[type=reset]").click(function() { setTimeout($fn, 1); }); if (window && window.opera && window.opera.version && Number(window.opera.version()) < 13) { $(document).ready(function () { @@ -242,17 +321,76 @@ document.addEventListener("DOMContentLoaded", function () { $fn(); }); $('.list-btn').click(function() { - var what = $(this).data('what'); + var what = $(this).data('what').split(" "); var $el = $('#mac-list-content'); $el.empty(); var result = ''; - var num = $('.machine').has('input[type=checkbox]:checked').find('.' + what).each(function() { - var text = this.innerText; - if (what === 'mac') text = text.replace(/-/g, ':'); - result += text + "\n"; + var num = $('.machine').has('input[type=checkbox]:checked').each(function(index, element) { + what.forEach(function (w) { + $(element).find('.' + w).each(function() { + var text = this.innerText; + if (w === 'mac') text = text.replace(/-/g, ':'); + result += text + "\t"; + }); + }); + result += "\n"; }).length; $el.text(result).prop('rows', Math.min(24, Math.max(5, num))); }); + // Generate list for column selection + var $cs = $('#column-selector .modal-body'); + var $filters = $('<tr>'); + $('#client-list > thead').prepend($filters); + var idx = 0; + $cs.empty(); + $('#client-list > thead > tr#thead > th').each(function() { + idx++; + var $th = $(this); + var $td = $('<td>'); + $filters.append($td); + var column = $th.data('column'); + if (!column) + return; + $cs.append($('<div class="checkbox">') + .append($('<input id="shc-' + column + '" type="checkbox" onclick="toggleColumn(this, \'' + column + '\')" checked="checked">')) + .append($('<label for="shc-' + column + '">').text($th.text()))); + $td.append($('<button type="button" class="btn btn-default btn-xs" onclick="popupFilter(\'' + column + '\')">' + + '<span class="glyphicon glyphicon-filter"></span></button>')); + lookupTable[column] = idx; + }); + // Load previous visibility settings + var colConf; + if (window.localStorage && (colConf = window.localStorage.getItem('cl-col-conf'))) { + colConf = JSON.parse(colConf); + if (colConf) { + for (var k in colConf) { + if (k.substring(0, 4) === 'shc-' && colConf[k]) { + var $cb = $('#' + k); + if ($cb.prop('checked')) { + $cb.click(); + } + } + } + } + } }); +function toggleColumn(e, column) +{ + var $el = $(e); + if (!(column in lookupTable)) + return; + var idx = lookupTable[column]; + $('#client-list tr > td:nth-child(' + idx + '), #client-list tr > th:nth-child(' + idx + ')') + .css('display', $el.is(':checked') ? '' : 'none'); + var data = {}; + $('#column-selector .modal-body .checkbox input').each(function() { + var $el = $(this); + if (!$el.is(':checked')) { + data[$el[0].id] = 1; + } + }); + window.localStorage.setItem('cl-col-conf', JSON.stringify(data)); +} + //--></script> |