From 1da8eeb6246efe22d0121b58063e7b98a527980b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 28 Nov 2014 18:03:57 +0100 Subject: Wait for reboot to complete after restoring a configuration backup --- templates/backup/restore.html | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'templates/backup/restore.html') diff --git a/templates/backup/restore.html b/templates/backup/restore.html index 3e29dbdc..2e33beb3 100644 --- a/templates/backup/restore.html +++ b/templates/backup/restore.html @@ -12,6 +12,9 @@ + @@ -23,5 +26,33 @@ if (task.statusCode === 'TASK_ERROR') { $('#restorefailed').show('slow'); } + if (task.statusCode === 'TASK_ERROR' || task.statusCode === 'TASK_FINISHED') { + startRebootPoll(); + } + } + + function startRebootPoll() + { + $('#waiting').show(); + $('#waiting').prepend(''); + $('#dots').text('{{lang_waitReboot}}'); + slxDotInterval = setInterval(function() { $('#dots').text($('#dots').text() + '..'); }, 3000); + setTimeout('rebootPoll()', 10000); + } + + function rebootPoll() + { + if (slxDotInterval !== false) { + clearInterval(slxDotInterval); + slxDotInterval = false; + } + $('#dots').text($('#dots').text() + '..'); + slxTimeoutId = setTimeout('rebootPoll()', 3500); + $.ajax({url: "index.php?do=Main", timeout: 3000}).success(function(data, textStatus, jqXHR) { + if (textStatus !== "success" && textStatus !== "notmodified") + return; + clearTimeout(slxTimeoutId); + window.location.replace("index.php?do=Main&message[]=success%7Crestore-done"); + }); } -- cgit v1.2.3-55-g7522