Attempt to cover most repair cases

This commit is contained in:
Johannes Zellner
2019-09-23 15:01:44 +02:00
parent b742dc51fb
commit fe6baf8dba
3 changed files with 49 additions and 15 deletions

View File

@@ -761,23 +761,59 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
backupId: '',
// this prepares the repair dialog with whatever is required for repair action
show: function () {
$scope.repair.error = {};
$scope.repair.busy = false;
$scope.repair.optionalDomains = [];
$scope.repair.backupId = '';
$scope.repair.optionalDomains = $scope.app.alternateDomains;
$scope.repair.optionalDomains.forEach(function (d) {
d.enabled = true;
});
var app = $scope.app;
Client.getAppBackups($scope.app.id, function (error, backups) {
if (error) return Client.error(error);
console.log(app)
$scope.repair.backups = backups;
$scope.repair.backupId = '';
// old versions may not have this set
if (!app.error.task) {
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.PENDING_UPDATE) {
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.PENDING_DATA_DIR_MIGRATION) {
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.PENDING_UNINSTALL) {
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.PENDING_DEBUG) {
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.PENDING_RESIZE) {
// memory
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.ISTATE_PENDING_RECREATE_CONTAINER) {
// email, mailbox
$('#repairModal').modal('show');
} else if (app.error.task.installationState === ISTATES.PENDING_LOCATION_CHANGE || app.error.task.installationState === ISTATES.PENDING_INSTALL) {
$scope.repair.optionalDomains = $scope.app.alternateDomains;
$scope.repair.optionalDomains.forEach(function (d) {
d.enabled = true;
});
$('#repairModal').modal('show');
});
} else if (app.error.task.installationState === ISTATES.PENDING_RESTORE || app.error.task.installationState === ISTATES.PENDING_CLONE) {
$scope.repair.optionalDomains = $scope.app.alternateDomains;
$scope.repair.optionalDomains.forEach(function (d) {
d.enabled = true;
});
Client.getAppBackups($scope.app.id, function (error, backups) {
if (error) return Client.error(error);
$scope.repair.backups = backups;
$scope.repair.backupId = '';
$('#repairModal').modal('show');
});
} else {
// unhandled case last resort to simply call repair
$('#repairModal').modal('show');
}
},
submit: function () {