Auto redirect if available before countdown on state change
This commit is contained in:
@@ -35,8 +35,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="javascriptIncludes()">
|
<%def name="javascriptIncludes()">
|
||||||
<script>
|
<script>
|
||||||
// Use p.countdown as container, pass redirect, duration, and optional message
|
// Use p.countdown as container, pass redirect, duration, and optional message
|
||||||
$(".countdown").countdown(reloadPage, ${timer}, "");
|
$(".countdown").countdown(reloadPage, ${timer}, "");
|
||||||
$('#state-change-modal').modal({
|
$('#state-change-modal').modal({
|
||||||
@@ -49,5 +50,35 @@
|
|||||||
function reloadPage() {
|
function reloadPage() {
|
||||||
window.location.href = "${new_http_root}index";
|
window.location.href = "${new_http_root}index";
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
|
// Redirect to home page if page is available.
|
||||||
|
var checkOnline = setInterval(checkPageOffline, 1000);
|
||||||
|
|
||||||
|
function checkPageOffline() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'HEAD',
|
||||||
|
url: 'index',
|
||||||
|
timeout: 1000,
|
||||||
|
error: function () {
|
||||||
|
% if signal != 'shutdown':
|
||||||
|
clearInterval(checkOnline);
|
||||||
|
setInterval(checkPageOnline, 1000);
|
||||||
|
% else:
|
||||||
|
reloadPage();
|
||||||
|
% endif
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function checkPageOnline() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'HEAD',
|
||||||
|
url: 'index',
|
||||||
|
timeout: 1000,
|
||||||
|
success: function () {
|
||||||
|
reloadPage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</%def>
|
</%def>
|
||||||
|
@@ -3324,7 +3324,7 @@ class WebInterface(object):
|
|||||||
else:
|
else:
|
||||||
new_http_root = '/'
|
new_http_root = '/'
|
||||||
|
|
||||||
return serve_template(templatename="shutdown.html", title=title,
|
return serve_template(templatename="shutdown.html", signal=signal, title=title,
|
||||||
new_http_root=new_http_root, message=message, timer=timer, quote=quote)
|
new_http_root=new_http_root, message=message, timer=timer, quote=quote)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
Reference in New Issue
Block a user