Add location and domain selector to repair dialog
This commit is contained in:
@@ -111,9 +111,28 @@
|
||||
<h4 class="modal-title">Repair {{ app.fqdn }}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<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">
|
||||
<p>The app task <b>{{ app.error.task | installationStateLabel:user }}</b> failed. Repair will attempt to retry.</p>
|
||||
<p class="text-danger">{{ app.error.message }}</p>
|
||||
<div class="form-group" ng-show="repair.location && repair.domain">
|
||||
<label class="control-label">Location</label>
|
||||
<div class="input-group form-inline">
|
||||
<input type="text" class="form-control" ng-model="repair.location" name="location" placeholder="{{ 'Leave empty to use bare domain' }}" autofocus>
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<span>{{ (!repair.location ? '' : (repair.domain.config.hyphenatedSubdomains ? '-' : '.')) + repair.domain.domain }}</span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
<li ng-repeat="domain in domains">
|
||||
<a href="" ng-click="repair.domain = domain">{{ domain.domain }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="repair.alternateDomains.length">
|
||||
<p ng-repeat="alternateDomain in repair.alternateDomains">
|
||||
<label class="control-label"><input type="checkbox" ng-model="alternateDomain.enabled"> {{ alternateDomain.subdomain }}.{{ alternateDomain.domain }}</label>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -764,7 +764,9 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
busy: false,
|
||||
error: {},
|
||||
|
||||
optionalDomains: [],
|
||||
location: null,
|
||||
domain: null,
|
||||
alternateDomains: [],
|
||||
backups: [],
|
||||
|
||||
backupId: '',
|
||||
@@ -773,41 +775,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
show: function () {
|
||||
$scope.repair.error = {};
|
||||
$scope.repair.busy = false;
|
||||
$scope.repair.optionalDomains = [];
|
||||
$scope.repair.location = null;
|
||||
$scope.repair.domain = null;
|
||||
$scope.repair.alternateDomains = [];
|
||||
$scope.repair.backupId = '';
|
||||
|
||||
var app = $scope.app;
|
||||
|
||||
// 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.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) {
|
||||
if (app.error.domain) {
|
||||
$scope.repair.location = app.location;
|
||||
$scope.repair.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
|
||||
$scope.repair.alternateDomains = $scope.app.alternateDomains;
|
||||
$scope.repair.alternateDomains.forEach(function (d) {
|
||||
d.enabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (app.error.backupId) {
|
||||
Client.getAppBackups($scope.app.id, function (error, backups) {
|
||||
if (error) return Client.error(error);
|
||||
|
||||
@@ -816,19 +800,28 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
|
||||
$('#repairModal').modal('show');
|
||||
});
|
||||
} else {
|
||||
// unhandled case last resort to simply call repair
|
||||
$('#repairModal').modal('show');
|
||||
return;
|
||||
}
|
||||
|
||||
$('#repairModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.repair.error = {};
|
||||
$scope.repair.busy = true;
|
||||
|
||||
// TODO pass disabled domain info or backupId
|
||||
var data = {};
|
||||
if ($scope.app.error.domain) {
|
||||
data.location = $scope.repair.location;
|
||||
data.domain = $scope.repair.domain.domain;
|
||||
data.alternateDomains = $scope.repair.alternateDomains.filter(function (a) { return a.enabled; });
|
||||
}
|
||||
|
||||
Client.repairApp($scope.app.id, {}, function (error) {
|
||||
if ($scope.app.error.backupId) {
|
||||
data.backupId = $scope.repair.backupId;
|
||||
}
|
||||
|
||||
Client.repairApp($scope.app.id, data, function (error) {
|
||||
if (error) return Client.error(error);
|
||||
|
||||
$scope.repair.busy = false;
|
||||
|
||||
Reference in New Issue
Block a user