mirror of https://github.com/portainer/portainer
fix(service-details): fix an issue with invalid service restart policy (#1415)
parent
e51246ee78
commit
13d8d38bf9
|
@ -243,7 +243,7 @@ function ($q, $scope, $state, $timeout, Service, ServiceHelper, ConfigService, C
|
|||
function prepareUpdateConfig(config, input) {
|
||||
config.UpdateConfig = {
|
||||
Parallelism: input.Parallelism || 0,
|
||||
Delay: input.UpdateDelay || 0,
|
||||
Delay: input.UpdateDelay * 1000000000 || 0,
|
||||
FailureAction: input.FailureAction,
|
||||
Order: input.UpdateOrder
|
||||
};
|
||||
|
|
|
@ -395,7 +395,7 @@
|
|||
</div>
|
||||
<div class="col-sm-5">
|
||||
<p class="small text-muted">
|
||||
Amount of time between updates.
|
||||
Amount of time between updates. Time in seconds.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<p class="small text-muted" style="margin-top: 10px;">
|
||||
The time window used to evaluate the restart policy (default value is 0, which is unbounded).
|
||||
The time window used to evaluate the restart policy (default value is 0, which is unbounded). Time in seconds.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<p class="small text-muted" style="margin-top: 10px;">
|
||||
Amount of time between updates.
|
||||
Amount of time between updates. Time in seconds.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -244,16 +244,16 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
|||
|
||||
config.UpdateConfig = {
|
||||
Parallelism: service.UpdateParallelism,
|
||||
Delay: service.UpdateDelay,
|
||||
Delay: service.UpdateDelay * 1000000000,
|
||||
FailureAction: service.UpdateFailureAction,
|
||||
Order: service.UpdateOrder
|
||||
};
|
||||
|
||||
config.TaskTemplate.RestartPolicy = {
|
||||
Condition: service.RestartCondition,
|
||||
Delay: service.RestartDelay,
|
||||
Delay: service.RestartDelay * 1000000000,
|
||||
MaxAttempts: service.RestartMaxAttempts,
|
||||
Window: service.RestartWindow
|
||||
Window: service.RestartWindow * 1000000000
|
||||
};
|
||||
|
||||
if (service.Ports) {
|
||||
|
@ -320,6 +320,12 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
|||
service.LimitMemoryBytes = service.LimitMemoryBytes / 1024 / 1024 || 0;
|
||||
service.ReservationMemoryBytes = service.ReservationMemoryBytes / 1024 / 1024 || 0;
|
||||
}
|
||||
|
||||
function transformDurations(service) {
|
||||
service.RestartDelay = service.RestartDelay / 1000000000 || 5;
|
||||
service.RestartWindow = service.RestartWindow / 1000000000 || 0;
|
||||
service.UpdateDelay = service.UpdateDelay / 1000000000 || 0;
|
||||
}
|
||||
|
||||
function initView() {
|
||||
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
||||
|
@ -333,6 +339,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
|||
|
||||
transformResources(service);
|
||||
translateServiceArrays(service);
|
||||
transformDurations(service);
|
||||
$scope.service = service;
|
||||
originalService = angular.copy(service);
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ function ServiceViewModel(data, runningTasks, allTasks, nodes) {
|
|||
}
|
||||
|
||||
if (data.Spec.TaskTemplate.RestartPolicy) {
|
||||
this.RestartCondition = data.Spec.TaskTemplate.RestartPolicy.Condition;
|
||||
this.RestartDelay = data.Spec.TaskTemplate.RestartPolicy.Delay;
|
||||
this.RestartMaxAttempts = data.Spec.TaskTemplate.RestartPolicy.MaxAttempts;
|
||||
this.RestartWindow = data.Spec.TaskTemplate.RestartPolicy.Window;
|
||||
this.RestartCondition = data.Spec.TaskTemplate.RestartPolicy.Condition || 'any';
|
||||
this.RestartDelay = data.Spec.TaskTemplate.RestartPolicy.Delay || 5000000000;
|
||||
this.RestartMaxAttempts = data.Spec.TaskTemplate.RestartPolicy.MaxAttempts || 0;
|
||||
this.RestartWindow = data.Spec.TaskTemplate.RestartPolicy.Window || 0;
|
||||
} else {
|
||||
this.RestartCondition = 'none';
|
||||
this.RestartDelay = 0;
|
||||
this.RestartCondition = 'any';
|
||||
this.RestartDelay = 5000000000;
|
||||
this.RestartMaxAttempts = 0;
|
||||
this.RestartWindow = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue