Handle memory limit errors

This commit is contained in:
Johannes Zellner
2020-10-21 13:27:31 +02:00
parent bd96073429
commit e54c8bbf99
2 changed files with 9 additions and 1 deletions

View File

@@ -754,7 +754,10 @@
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<div class="col-md-8">
<span ng-show="resources.error.memoryLimit" class="text-danger">Unable to set memory limit, try less.</span>
</div>
<div class="col-md-4 text-right">
<button class="btn btn-outline btn-primary pull-right" ng-click="resources.submitMemoryLimit()" ng-disabled="resources.memoryLimit === resources.currentMemoryLimit || resourcesForm.$invalid || resources.busy || app.error || app.taskId" tooltip-enable="app.error || app.taskId" uib-tooltip="{{ app.error ? 'App is in error state' : 'App is busy' }}">
<i class="fa fa-circle-notch fa-spin" ng-show="resources.busy"></i> Resize
</button>

View File

@@ -501,6 +501,11 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
var memoryLimit = $scope.resources.memoryLimit === $scope.resources.memoryTicks[0] ? 0 : $scope.resources.memoryLimit;
Client.configureApp($scope.app.id, 'memory_limit', { memoryLimit: memoryLimit }, function (error) {
if (error && error.statusCode === 400) {
$scope.resources.busy = false;
$scope.resources.error.memoryLimit = true;
return;
}
if (error) return Client.error(error);
$scope.resources.currentMemoryLimit = $scope.resources.memoryLimit;