1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-23 02:27:05 +00:00

Show uptime in system status page

This commit is contained in:
Jens Kreiensiek 2019-06-19 14:25:09 +02:00
parent c0f4d5479f
commit 7ff2e8899f
2 changed files with 17 additions and 0 deletions

View File

@ -442,6 +442,11 @@ def system_status():
pool.terminate() pool.terminate()
return json_response(output.items) 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') @app.route('/system/updates')
@authorized_personnel_only @authorized_personnel_only
def show_updates(): def show_updates():

View File

@ -39,6 +39,9 @@
<div class="row"> <div class="row">
<div class="col-md-push-9 col-md-3"> <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;"> <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> <button type="button" class="btn btn-danger" onclick="confirm_reboot(); return false;">Reboot Box</button>
<div>No reboot is necessary.</div> <div>No reboot is necessary.</div>
@ -77,6 +80,15 @@ function show_system_status() {
$('#system-privacy-setting p').toggle(r); $('#system-privacy-setting p').toggle(r);
}); });
api(
"/system/uptime",
"GET",
{ },
function(r) {
$('#system-uptime').text(r);
$('#system-uptime').show();
});
api( api(
"/system/reboot", "/system/reboot",
"GET", "GET",