diff options
Diffstat (limited to 'html/index.html')
-rw-r--r-- | html/index.html | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/html/index.html b/html/index.html index 944005c..89882b9 100644 --- a/html/index.html +++ b/html/index.html @@ -61,6 +61,22 @@ </div> <div id="users"> </div> + <div class="modal" id="power_request_modal" tabindex="-1" aria-labelledby="power_request_modal_header" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="power_request_modal_header">Forbidden</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body">Sorry, power management is turned off on this instance.</div> + <div class="modal-footer"> + <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button> + </div> + </div> + </div> + </div> </div> <footer class="mt-auto py-3 border-top bg-light text-center text-muted small"> <div class="container"> @@ -110,12 +126,29 @@ function get(url, success_callback) { $.get(url, success_callback).fail(dump_fail); } +function on_power_request_forbidden() { + $('#power_request_modal').modal(); +} + +function power_request(url) { + $.get(url).fail(function(data) { + switch (data.status) { + case 403: + on_power_request_forbidden(); + break; + default: + dump_fail(data); + break; + } + }); +} + function reboot() { - get('reboot'); + power_request('reboot'); } function shutdown() { - get('poweroff'); + power_request('poweroff'); } function set_hostname(data) { |