Fix usage of webadminStatus
This commit is contained in:
@@ -136,13 +136,12 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
// WARNING if anything about the routing is changed here test these use-cases:
|
||||
//
|
||||
// 1. Caas
|
||||
// 2. selfhosted with --domain argument
|
||||
// 3. selfhosted restore
|
||||
// 4. local development with gulp develop
|
||||
|
||||
if (!status.activated) {
|
||||
console.log('Not activated yet, redirecting', status);
|
||||
if (status.webadminStatus.restore.active || status.webadminStatus.restore.error) {
|
||||
if (status.restore.active || status.restore.errorMessage) {
|
||||
window.location.href = '/restore.html';
|
||||
} else {
|
||||
window.location.href = status.adminFqdn ? '/setup.html' : '/setupdns.html';
|
||||
|
||||
@@ -195,10 +195,10 @@ app.controller('RestoreController', ['$scope', '$http', 'Client', function ($sco
|
||||
$scope.busy = true;
|
||||
|
||||
Client.getStatus(function (error, status) {
|
||||
if (!error && !status.webadminStatus.restore.active) { // restore finished
|
||||
if (status.webadminStatus.restore.error) {
|
||||
if (!error && !status.restore.active) { // restore finished
|
||||
if (status.restore.errorMessage) {
|
||||
$scope.busy = false;
|
||||
$scope.error.generic = status.webadminStatus.restore.error;
|
||||
$scope.error.generic = status.restore.errorMessage;
|
||||
} else { // restore worked, redirect to admin page
|
||||
window.location.href = '/';
|
||||
}
|
||||
@@ -233,9 +233,9 @@ app.controller('RestoreController', ['$scope', '$http', 'Client', function ($sco
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.webadminStatus.restore.active) return waitForRestore();
|
||||
if (status.restore.active) return waitForRestore();
|
||||
|
||||
if (status.webadminStatus.restore.error) $scope.error.generic = status.webadminStatus.restore.error;
|
||||
if (status.restore.errorMessage) $scope.error.generic = status.restore.errorMessage;
|
||||
|
||||
if (status.activated) {
|
||||
window.location.href = '/';
|
||||
|
||||
@@ -192,10 +192,14 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
$scope.state = 'waitingForDnsSetup';
|
||||
|
||||
Client.getStatus(function (error, status) {
|
||||
// webadminStatus.dns is intentionally not tested. it can be false if dns creds are invalid
|
||||
// runConfigurationChecks() in main.js will pick the .dns and show a notification
|
||||
if (!error && status.adminFqdn && status.webadminStatus.tls) {
|
||||
window.location.href = 'https://' + status.adminFqdn + '/setup.html';
|
||||
if (!error && !status.setup.active) {
|
||||
if (!status.adminFqdn || status.setup.errorMessage) { // setup reset or errored. start over
|
||||
$scope.error = status.setup.errorMessage;
|
||||
$scope.status = 'initialized';
|
||||
} else { // proceed to activation
|
||||
window.location.href = 'https://' + status.adminFqdn + '/setup.html';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(waitForDnsSetup, 5000);
|
||||
|
||||
Reference in New Issue
Block a user