mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-04 15:54:48 +01:00
Allow a server to be rebooted when a reboot is required
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<h2>System Status Checks</h2>
|
||||
|
||||
<div id="system-reboot-required" style="display: none">
|
||||
<button type="button" class="btn btn-danger" onclick="confirm_reboot(); return false;">Reboot required</button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#system-checks .heading td {
|
||||
font-weight: bold;
|
||||
@@ -34,7 +38,10 @@
|
||||
font-family: monospace;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
#system-reboot-required {
|
||||
max-width: 20em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#system-privacy-setting {
|
||||
float: right;
|
||||
max-width: 20em;
|
||||
@@ -47,7 +54,6 @@
|
||||
<p style="line-height: 125%"><small>(When enabled, status checks phone-home to check for a new release of Mail-in-a-Box.)</small></p>
|
||||
</div>
|
||||
|
||||
|
||||
<table id="system-checks" class="table" style="max-width: 60em">
|
||||
<thead>
|
||||
</thead>
|
||||
@@ -70,6 +76,14 @@ function show_system_status() {
|
||||
$('#system-privacy-setting p').toggle(r);
|
||||
});
|
||||
|
||||
api(
|
||||
"/system/reboot",
|
||||
"GET",
|
||||
{ },
|
||||
function(r) {
|
||||
$('#system-reboot-required').toggle(r);
|
||||
});
|
||||
|
||||
api(
|
||||
"/system/status",
|
||||
"POST",
|
||||
@@ -122,4 +136,20 @@ function enable_privacy(status) {
|
||||
});
|
||||
return false; // disable link
|
||||
}
|
||||
|
||||
function confirm_reboot() {
|
||||
show_modal_confirm(
|
||||
"Reboot server",
|
||||
$("<p>This will reboot your server, until the server is fully restarted your users will not be able to send and receive email. The reboot can't be cancelled</p>"),
|
||||
"Reboot now",
|
||||
function() {
|
||||
api(
|
||||
"/system/reboot",
|
||||
"POST",
|
||||
{ },
|
||||
function(r) {
|
||||
show_modal_error("Reboot", "Please refresh the page after a minute or so." + r);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user