diff options
author | Simon Rettberg | 2017-11-03 13:23:47 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-03 13:23:47 +0100 |
commit | 3ef00090daeae283e739ed147dc397681f04db77 (patch) | |
tree | 7b960e810a83709c4347375b5a1eaf05cef8dc50 /modules-available/dnbd3/templates/page-serverlist.html | |
parent | [rebootcontrol] Move reboot function to helper class (diff) | |
download | slx-admin-3ef00090daeae283e739ed147dc397681f04db77.tar.gz slx-admin-3ef00090daeae283e739ed147dc397681f04db77.tar.xz slx-admin-3ef00090daeae283e739ed147dc397681f04db77.zip |
[dnbd3] Add reboot button for managed proxies
Diffstat (limited to 'modules-available/dnbd3/templates/page-serverlist.html')
-rw-r--r-- | modules-available/dnbd3/templates/page-serverlist.html | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/modules-available/dnbd3/templates/page-serverlist.html b/modules-available/dnbd3/templates/page-serverlist.html index 2d2ef803..1a4d8255 100644 --- a/modules-available/dnbd3/templates/page-serverlist.html +++ b/modules-available/dnbd3/templates/page-serverlist.html @@ -126,13 +126,20 @@ </td> <td class="text-right"> {{#machineuuid}} + {{#rebootcontrol}} + <button class="btn btn-warning btn-xs reboot-btn" type="button" data-id="{{serverid}}" + data-toggle="modal" data-target="#server-reboot-modal" title="{{lang_reboot}}"> + <span class="glyphicon glyphicon-repeat"></span> + </button> + {{/rebootcontrol}} <button class="btn btn-default btn-xs edit-btn" type="button" data-id="{{serverid}}" - data-toggle="modal" data-target="#server-edit-modal"> + data-toggle="modal" data-target="#server-edit-modal" title="{{lang_settings}}"> <span class="glyphicon glyphicon-cog"></span> </button> {{/machineuuid}} {{^self}} - <button class="btn btn-danger btn-xs" name="server" value="{{serverid}}" onclick="return confirm('{{lang_wantToDelete}}')"> + <button class="btn btn-danger btn-xs" name="server" value="{{serverid}}" + onclick="return confirm('{{lang_wantToDelete}}')" title="{{lang_delete}}"> <span class="glyphicon glyphicon-trash"></span> </button> {{/self}} @@ -226,6 +233,28 @@ </div> </div> +<div id="server-reboot-modal" class="modal fade" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title"><b>{{lang_rebootProxyHeading}}</b></h4> + </div> + <div class="modal-body"> + <p>{{lang_rebootServerText}}</p> + <p id="reboot-status"></p> + </div> + <div class="modal-footer text-right"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_close}}</button> + <button id="btn-exec-reboot" type="button" class="btn btn-primary"> + <span class="glyphicon glyphicon-repeat"></span> + {{lang_reboot}} + </button> + </div> + </div> + </div> +</div> + <div id="add-modal" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> @@ -331,6 +360,41 @@ document.addEventListener('DOMContentLoaded', function () { var id = $(this).data('id'); $('#server-edit-body').text('loading').load('?do=dnbd3&action=editserver&server=' + id); }); + + var rebootServerId = 0; + $('.reboot-btn').click(function() { + rebootServerId = $(this).data('id'); + $('#btn-exec-reboot').prop('disabled', false); + $('#reboot-status').empty(); + }); + $('#btn-exec-reboot').click(function() { + $(this).prop('disabled', true); + var $t = $('#reboot-status'); + if (rebootServerId === 0) { + $t.text('No ID!?'); + return; + } + $t.html('<span class="glyphicon glyphicon-refresh slx-rotation"></span>'); + var sid = rebootServerId; + var query = function() { + $.ajax({ + "data": {"token": TOKEN, "action": "reboot", "server": sid}, + "method": "POST", + "dataType": "text", + "url": "?do=dnbd3" + }).done(function (data) { + $t.text(data); + if (data.indexOf('REBOOTING') !== -1 || data.indexOf('CONNECTING') !== -1) { + setTimeout(query, 5000); + $t.append($('<span class="glyphicon glyphicon-refresh slx-rotation"></span>')); + } + }).fail(function () { + $.text('Failed'); + }); + }; + query(); + rebootServerId = 0; + }); }); //--></script>
\ No newline at end of file |