diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-01 11:06:20 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-01 11:07:30 -0500 |
commit | e226c360099cd3f412d9780f35e685f6461ec4b0 (patch) | |
tree | 100429b00519b3e0ba8fbeb3cf697a78360a5115 /src/usr/local/www/reboot.php | |
parent | de90f855b61ee6c9b98e2060624b550a14bd6c57 (diff) | |
download | pfsense-e226c360099cd3f412d9780f35e685f6461ec4b0.zip pfsense-e226c360099cd3f412d9780f35e685f6461ec4b0.tar.gz |
Improved reboot countdown display as suggested here: https://github.com/pfsense/pfsense/pull/2105/files but with improved timing and messages.
Diffstat (limited to 'src/usr/local/www/reboot.php')
-rwxr-xr-x | src/usr/local/www/reboot.php | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/usr/local/www/reboot.php b/src/usr/local/www/reboot.php index 916565b..77642fb 100755 --- a/src/usr/local/www/reboot.php +++ b/src/usr/local/www/reboot.php @@ -70,7 +70,8 @@ require("guiconfig.inc"); require("functions.inc"); require("captiveportal.inc"); -$guitimeout = 120; // Seconds to wait before reloading the page after reboot +$guitimeout = 90; // Seconds to wait before reloading the page after reboot +$guiretry = 20; // Seconds to try again if $guitimeout was not long enough $pgtitle = array(gettext("Diagnostics"),gettext("Reboot System")); include("head.inc"); @@ -93,14 +94,36 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { <script type="text/javascript"> //<![CDATA[ events.push(function(){ - function startCountdown(time) { + + var timeoutmsg = '<h4>Rebooting<br />Page will automatically reload in '; + var time = 0; + + function checkonline() { + $.ajax({ + url : "/index.php", // or other resource + type : "HEAD" + }) + .done(function() { + window.location="/index.php"; + }); + } + + function startCountdown() { setInterval(function(){ - $('#countdown').html('<h4>Rebooting<br />Page will automatically reload in ' + time + ' seconds.</h4>'); - time-- != 0 || (window.location="/index.php"); - },1000); + if(time > 0) { + $('#countdown').html(timeoutmsg + time + ' seconds.</h4>'); + time--; + } else { + time = "<?=$guiretry?>"; + timeoutmsg = '<h4>Not yet ready<br />Retrying in another '; + checkonline(); + } + }, 1000); } - startCountdown("<?=$guitimeout?>"); + time = "<?=$guitimeout?>"; + startCountdown(); + }); //]]> </script> |