diff options
author | Udo Walter | 2017-12-28 21:12:08 +0100 |
---|---|---|
committer | Udo Walter | 2017-12-28 21:12:08 +0100 |
commit | bf3ea5f9ffe8c0f34744b858dd0a294bbf091ddc (patch) | |
tree | f189e5299e5be14717c08b9f244100e0a7bc6a4f /modules-available/statistics/templates | |
parent | [eventlog] added permission to view the log (diff) | |
download | slx-admin-bf3ea5f9ffe8c0f34744b858dd0a294bbf091ddc.tar.gz slx-admin-bf3ea5f9ffe8c0f34744b858dd0a294bbf091ddc.tar.xz slx-admin-bf3ea5f9ffe8c0f34744b858dd0a294bbf091ddc.zip |
[statistics] added permissions to view client statistics, delete clients and edit notes of clients
Diffstat (limited to 'modules-available/statistics/templates')
3 files changed, 41 insertions, 11 deletions
diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html index 13e148fa..3d3e66a4 100644 --- a/modules-available/statistics/templates/clientlist.html +++ b/modules-available/statistics/templates/clientlist.html @@ -10,22 +10,22 @@ <td></td> <td></td> <td class="text-right"> - <button class="btn btn-default btn-xs" onclick="popupFilter('lastseen')"> + <button type="button" class="btn btn-default btn-xs" onclick="popupFilter('lastseen')"> <span id="btn_filter_lastseen" class="glyphicon glyphicon-filter"></span> </button> </td> <td> - <button class="btn btn-default btn-xs" onclick="popupFilter('kvmstate')"> + <button type="button" class="btn btn-default btn-xs" onclick="popupFilter('kvmstate')"> <span id="btn_filter_kvmstate" class="glyphicon glyphicon-filter"></span> </button> </td> <td class="text-right"> - <button class="btn btn-default btn-xs" onclick="popupFilter('gbram')"> + <button type="button" class="btn btn-default btn-xs" onclick="popupFilter('gbram')"> <span id="btn_filter_gbram" class="glyphicon glyphicon-filter"></span> </button> </td> <td class="text-right"> - <button class="btn btn-default btn-xs" onclick="popupFilter('hddgb')"> + <button type="button" class="btn btn-default btn-xs" onclick="popupFilter('hddgb')"> <span id="btn_filter_hddgb" class="glyphicon glyphicon-filter"></span> </button> </td> @@ -49,11 +49,15 @@ {{#rows}} <tr> <td data-sort-value="{{hostname}}" class="text-nowrap"> + {{#deleteAllowed}} <div class="checkbox checkbox-inline"> - <input type="checkbox" name="uuid[]" value="{{machineuuid}}"> + <input type="checkbox" name="uuid[]" value="{{machineuuid}}" class="deleteCheckboxes"> <label></label> </div> - {{#hasnotes}}<span class="glyphicon glyphicon-exclamation-sign pull-right"></span>{{/hasnotes}} + {{/deleteAllowed}} + {{#hasnotes}} + <span class="glyphicon glyphicon-exclamation-sign pull-right"></span> + {{/hasnotes}} {{#state_OFFLINE}} <span class="glyphicon glyphicon-off" title="{{lang_machineOff}}"></span> {{/state_OFFLINE}} @@ -91,10 +95,10 @@ </table> <div class="text-right buttonbar"> <button type="reset" class="btn btn-default"> - <span class="glyphicon glyphicon-remove"></span> + <span class="glyphicon glyphicon-refresh"></span> {{lang_reset}} </button> - <button type="button" class="btn btn-danger" onclick="$('#del-confirm').modal()"> + <button id="deleteButton" type="button" class="btn btn-danger" onclick="$('#del-confirm').modal()"> <span class="glyphicon glyphicon-trash"></span> {{lang_delete}} </button> @@ -122,6 +126,9 @@ </form> <script type="application/javascript"><!-- + +selectedMachineCounter = 0; + document.addEventListener("DOMContentLoaded", function () { ['gbram', 'hddgb', 'realcores', 'kvmstate', 'lastseen', 'clientip'].forEach(function (v) { var $sortBtn = $('#sortButton-' + v); @@ -138,6 +145,27 @@ document.addEventListener("DOMContentLoaded", function () { 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) { diff --git a/modules-available/statistics/templates/filterbox.html b/modules-available/statistics/templates/filterbox.html index 32464031..758bc287 100644 --- a/modules-available/statistics/templates/filterbox.html +++ b/modules-available/statistics/templates/filterbox.html @@ -176,10 +176,12 @@ document.addEventListener("DOMContentLoaded", function () { $('#argumentSelect').show(); columns[col]['values'].forEach(function (v) { var t = v; + var disabled = true; if (col === 'location' && slxLocations['L' + v]) { t = slxLocations['L' + v].pad + ' ' + slxLocations['L' + v].name; + disabled = slxLocations['L' + v].disabled; } - $('#argumentSelect').append($('<option>', { value: v, text: t })); + $('#argumentSelect').append($('<option>', { value: v, text: t, disabled: disabled })); }); } else { $('#argumentInput').datepicker('remove'); diff --git a/modules-available/statistics/templates/machine-notes.html b/modules-available/statistics/templates/machine-notes.html index 22ed96e9..66e44da4 100644 --- a/modules-available/statistics/templates/machine-notes.html +++ b/modules-available/statistics/templates/machine-notes.html @@ -8,9 +8,9 @@ <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="action" value="setnotes"> <input type="hidden" name="uuid" value="{{machineuuid}}"> - <textarea name="content" class="form-control" cols="101" rows="10">{{notes}}</textarea> + <textarea name="content" class="form-control" cols="101" rows="10" {{^notesAllowed}}disabled{{/notesAllowed}}>{{notes}}</textarea> <br/> - <button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button> + <button type="submit" class="btn btn-primary pull-right" {{^notesAllowed}}disabled{{/notesAllowed}}><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button> </form> </div> </div> |