refactor init sequence

This commit is contained in:
Girish Ramakrishnan
2024-07-15 17:30:50 +02:00
parent 5b567ac941
commit 11dce549bd
6 changed files with 89 additions and 76 deletions

View File

@@ -1,6 +1,6 @@
'use strict';
/* global $, angular, SECRET_PLACEHOLDER, STORAGE_PROVIDERS, BACKUP_FORMATS, window, FileReader, document */
/* global $, angular, SECRET_PLACEHOLDER, STORAGE_PROVIDERS, BACKUP_FORMATS, window, FileReader, document, redirectIfNeeded */
/* global REGIONS_S3, REGIONS_WASABI, REGIONS_DIGITALOCEAN, REGIONS_EXOSCALE, REGIONS_SCALEWAY, REGIONS_LINODE, REGIONS_OVH, REGIONS_IONOS, REGIONS_UPCLOUD, REGIONS_VULTR, REGIONS_CONTABO */
// create main application module
@@ -296,7 +296,7 @@ app.controller('RestoreController', ['$scope', 'Client', function ($scope, Clien
$scope.busy = false;
$scope.error.generic = status.restore.errorMessage;
} else { // restore worked, redirect to admin page
window.location.href = '/';
window.location.href = 'https://' + status.adminFqdn + '/';
}
return;
}
@@ -355,14 +355,11 @@ app.controller('RestoreController', ['$scope', 'Client', function ($scope, Clien
Client.getProvisionStatus(function (error, status) {
if (error) return Client.initError(error, init);
if (redirectIfNeeded(status, 'restore')) return; // redirected to some other view...
if (status.restore.active) return waitForRestore();
if (status.restore.errorMessage) $scope.error.generic = status.restore.errorMessage;
if (status.activated) {
window.location.href = '/';
return;
}
if (status.restore.errorMessage) $scope.error.generic = status.restore.errorMessage; // any previous restore error
Client.getProvisionBlockDevices(function (error, result) {
if (error) {