Add a restart button in recovery section

This commit is contained in:
Girish Ramakrishnan
2019-12-20 11:18:48 -08:00
parent 3f3ec9ef9a
commit adc078a5cb
5 changed files with 47 additions and 38 deletions

View File

@@ -129,7 +129,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success" ng-click="repair.submit()" ng-disabled="repair.busy"><i class="fa fa-circle-notch fa-spin" ng-show="repair.busy"></i> Repair</button>
<button type="button" class="btn btn-success" ng-click="repair.submit()" ng-disabled="repair.retryBusy"><i class="fa fa-circle-notch fa-spin" ng-show="repair.retryBusy"></i> Repair</button>
</div>
</div>
</div>
@@ -731,7 +731,7 @@
<div class="col-md-12">
<label class="control-label">Console Access</label>
<p>This will open a console connection to the app. The terminal is sandboxed and only provides access to this app container's filesystem.</p>
<a class="btn btn-primary pull-right" ng-href="{{ '/terminal.html?id=' + app.id }}" target="_blank">Terminal</a>
<a class="btn btn-primary pull-right" ng-href="{{ '/terminal.html?id=' + app.id }}" ng-disabled="app.health !== 'healthy'" tooltip-enable="app.health !== 'healthy'" uib-tooltip="App is not running. If app is constantly restarting, Repair it first." target="_blank">Terminal</a>
<a class="btn btn-primary pull-right" ng-href="{{ '/logs.html?appId=' + app.id }}" target="_blank">Logs</a>
</div>
</div>
@@ -754,19 +754,25 @@
<div class="row">
<div class="col-md-12">
<label class="control-label">Crash Recovery</label>
<p>If the app is constantly restarting because of a broken plugin or misconfiguration, place the app in recovery mode.
<p>
If the app is not responding, try restarting the app. If the app is constantly restarting because of a broken plugin or misconfiguration,
place the app in recovery mode in order to access the console.
Use the following <a target="_blank" ng-href="{{ config.webServerOrigin }}/documentation/troubleshooting/#unresponsive-app">instructions</a>
to get the app running again.
</p>
<button class="btn btn-primary pull-right" ng-click="repair.pauseAppBegin()" ng-show="!app.debugMode" ng-disabled="repair.pauseBusy || app.error">Enable Recovery Mode</button>
<button class="btn btn-primary pull-right" ng-click="repair.pauseAppDone()" ng-show="app.debugMode" ng-disabled="repair.pauseBusy || app.error">Disable Recovery Mode</button>
<button class="btn btn-primary pull-right" ng-click="repair.restartApp()" ng-disabled="repair.restartBusy || app.error">
<i ng-show="repair.restartBusy" class="fa fa-circle-notch fa-spin"></i>
Restart App
</button>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-12">
<label class="control-label">Task Error</label>
<p>If a task (configuration, update, restore, backup) resulted in the app ending up in an error state, you can retry the operation.</p>
<p>If a configuration, update, restore or backup action resulted in an error, you can retry the task.</p>
<p ng-show="app.error">An error occurred during the <b>{{ app.error.installationState | taskName }}</b> operation: <span class="text-danger"><b>{{ app.error.reason + ': ' + app.error.message }}</b></span></p>
<button class="btn btn-primary pull-right" ng-click="repair.confirm()" ng-disabled="app.taskId">Retry {{ app.error.installationState | taskName }}</button>

View File

@@ -801,7 +801,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
};
$scope.repair = {
busy: false,
retryBusy: false,
error: {},
location: null,
@@ -816,7 +816,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
// this prepares the repair dialog with whatever is required for repair action
confirm: function () {
$scope.repair.error = {};
$scope.repair.busy = false;
$scope.repair.retryBusy = false;
$scope.repair.location = null;
$scope.repair.domain = null;
$scope.repair.alternateDomains = [];
@@ -856,7 +856,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
submit: function () {
$scope.repair.error = {};
$scope.repair.busy = true;
$scope.repair.retryBusy = true;
var errorState = ($scope.app.error && $scope.app.error.installationState) || ISTATES.PENDING_CONFIGURE;
var data = {};
@@ -892,6 +892,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
case ISTATES.PENDING_START:
case ISTATES.PENDING_STOP:
case ISTATES.PENDING_RESTART:
case ISTATES.PENDING_RESIZE:
case ISTATES.PENDING_DEBUG:
case ISTATES.PENDING_RECREATE_CONTAINER:
@@ -906,7 +907,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
repairFunc(function (error) {
if (error) return Client.error(error);
$scope.repair.busy = false;
$scope.repair.retryBusy = false;
$('#repairModal').modal('hide');
});
},
@@ -918,6 +919,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
},
restartBusy: false,
restartApp: function () {
$scope.repair.restartBusy = true;
Client.restartApp($scope.app.id, function (error) {
if (error) return console.error(error);
refreshApp($scope.app.id, function () {
waitForAppTask(function (error) {
if (error) return Client.error(error);
$scope.repair.restartBusy = false;
});
});
});
},
pauseBusy: false,
pauseAppBegin: function () {