This commit is contained in:
JensonK 2024-04-04 06:46:12 +08:00 committed by GitHub
commit ae32d674c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -574,6 +574,11 @@ def system_status():
pool.join()
return json_response(output.items)
@app.route('/system/uptime')
@authorized_personnel_only
def show_uptime():
return utils.shell("check_output", ["/usr/bin/uptime", "--pretty"])
@app.route('/system/updates')
@authorized_personnel_only
def show_updates():

View File

@ -39,6 +39,9 @@
<div class="row">
<div class="col-md-push-9 col-md-3">
<div id="system-uptime" style="display: none; margin-bottom: 1em;">
</div>
<div id="system-reboot-required" style="display: none; margin-bottom: 1em;">
<button type="button" class="btn btn-danger" onclick="confirm_reboot(); return false;">Reboot Box</button>
<div>No reboot is necessary.</div>
@ -83,6 +86,15 @@ function show_system_status() {
$('#system-privacy-setting p').toggle(r);
});
api(
"/system/uptime",
"GET",
{ },
function(r) {
$('#system-uptime').text(r);
$('#system-uptime').show();
});
api(
"/system/reboot",
"GET",