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
+3 -5
View File
@@ -111,15 +111,13 @@
<h4 class="modal-title">Repair {{ app.fqdn }}</h4>
</div>
<div class="modal-body">
<p>TBD info about error and potential solution</p>
<!-- show this if alternate domains may need to be disabled -->
<div>
<p>The app task {{ app.error.task.installationState }} {{ app.error.crashed ? 'crashed' : '' }}{{ app.error.stopped ? 'stopped' : '' }} . Repair will attempt to retry.</p>
<div ng-show="repair.optionalDomains.length">
<p ng-repeat="alternateDomain in repair.optionalDomains">
<label class="control-label"><input type="checkbox" ng-model="alternateDomain.enabled"> {{ alternateDomain.subdomain }}.{{ alternateDomain.domain }}</label>
</p>
</div>
<!-- show this for restore -->
<div>
<div ng-show="repair.backups.length">
<label class="control-label">Restore from Backup:</label>
<select class="form-control" ng-model="repair.backupId">
<option ng-repeat="backup in repair.backups" value="{{ backup.id }}">{{ backup.creationTime | prettyDate }} - v{{ backup.version }}</option>
+45 -9
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 () {