diff options
author | Simon Rettberg | 2023-03-02 16:07:01 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-03-02 16:07:01 +0100 |
commit | d7f11c6543bfff777df7bd533e1d04ff8a48b81c (patch) | |
tree | 0c6b4a7eafc482d75ef19b407b22578691e2a7da /modules-available/backup/templates/restore.html | |
parent | [backup] Add UI for monthly automatic backup + password support (diff) | |
download | slx-admin-d7f11c6543bfff777df7bd533e1d04ff8a48b81c.tar.gz slx-admin-d7f11c6543bfff777df7bd533e1d04ff8a48b81c.tar.xz slx-admin-d7f11c6543bfff777df7bd533e1d04ff8a48b81c.zip |
[backup] Check supplied backup file before trying to apply
This saves us from aborting midway and doing a reboot
Diffstat (limited to 'modules-available/backup/templates/restore.html')
-rw-r--r-- | modules-available/backup/templates/restore.html | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules-available/backup/templates/restore.html b/modules-available/backup/templates/restore.html index c9c19d2b..3e57a3ee 100644 --- a/modules-available/backup/templates/restore.html +++ b/modules-available/backup/templates/restore.html @@ -20,6 +20,7 @@ <script type="text/javascript"> var slxDotInterval = false; + var restoreSuccess = false; function restoreCb(task) { if (!task || !task.statusCode) @@ -28,6 +29,7 @@ $('#restorefailed').show('slow'); } if (task.statusCode === 'TASK_ERROR' || task.statusCode === 'TASK_FINISHED') { + restoreSuccess = (task.statusCode === 'TASK_FINISHED'); startRebootPoll(); } } @@ -48,14 +50,18 @@ } $('#dots').text($('#dots').text() + '..'); slxTimeoutId = setTimeout(rebootPoll, 3500); - $.ajax({url: "index.php?do=Main", timeout: 3000}).success(function(data, textStatus, jqXHR) { + $.ajax({url: "?do=main", timeout: 3000}).success(function(data, textStatus, jqXHR) { if (textStatus !== "success" && textStatus !== "notmodified") return; if (data.indexOf('Status: DB running') === -1) return; clearTimeout(slxTimeoutId); setTimeout(function() { - window.location.replace("index.php?do=Main&message[]=success%7Cbackup.restore-done"); + if (restoreSuccess) { + window.location.replace("?do=main&message[]=success%7Cbackup.restore-done"); + } else { + window.location.replace("?do=main"); + } }, 3500); }); } |