diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-11 11:38:20 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-11 11:38:20 +0200 |
commit | f834a30ed96334439631d58e10c45a19fbec843d (patch) | |
tree | 05df9c6c2099d89ef2718880d9031d61647afbe2 /html | |
parent | debian: 2.0-1 (diff) | |
parent | support disallowing power requests (diff) | |
download | linux-status-f834a30ed96334439631d58e10c45a19fbec843d.tar.gz linux-status-f834a30ed96334439631d58e10c45a19fbec843d.zip |
Merge tag 'v2.1' into debian
Diffstat (limited to '')
-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) { |