Display restore errors

Part of cloudron/box#505
This commit is contained in:
Girish Ramakrishnan
2018-07-29 20:33:21 -07:00
parent 9108b665a8
commit eb74aaff3b
2 changed files with 14 additions and 4 deletions

View File

@@ -138,7 +138,11 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
if (!status.activated) {
console.log('Not activated yet, redirecting', status);
window.location.href = status.adminFqdn ? '/setup.html' : '/setupdns.html';
if (status.webadminStatus.restore.active || status.webadminStatus.restore.error) {
window.location.href = '/restore.html';
} else {
window.location.href = status.adminFqdn ? '/setup.html' : '/setupdns.html';
}
return;
}

View File

@@ -193,8 +193,14 @@ app.controller('RestoreController', ['$scope', '$http', 'Client', function ($sco
$scope.busy = true;
Client.getStatus(function (error, status) {
if (!error && !status.webadminStatus.restoring) {
window.location.href = '/';
if (!error && !status.webadminStatus.restore.active) { // restore finished
if (status.webadminStatus.restore.error) {
$scope.busy = false;
$scope.error.generic = status.webadminStatus.restore.error;
} else { // restore worked, redirect to admin page
window.location.href = '/';
}
return;
}
setTimeout(waitForRestore, 5000);
@@ -225,7 +231,7 @@ app.controller('RestoreController', ['$scope', '$http', 'Client', function ($sco
return;
}
if (status.restoring) return waitForRestore();
if (status.webadminStatus.restore.active) return waitForRestore();
if (status.activated) {
window.location.href = '/';