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) {
|
function prepareUpdateConfig(config, input) {
|
||||||
config.UpdateConfig = {
|
config.UpdateConfig = {
|
||||||
Parallelism: input.Parallelism || 0,
|
Parallelism: input.Parallelism || 0,
|
||||||
Delay: input.UpdateDelay || 0,
|
Delay: input.UpdateDelay * 1000000000 || 0,
|
||||||
FailureAction: input.FailureAction,
|
FailureAction: input.FailureAction,
|
||||||
Order: input.UpdateOrder
|
Order: input.UpdateOrder
|
||||||
};
|
};
|
||||||
|
|
|
@ -395,7 +395,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<p class="small text-muted">
|
<p class="small text-muted">
|
||||||
Amount of time between updates.
|
Amount of time between updates. Time in seconds.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p class="small text-muted" style="margin-top: 10px;">
|
<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>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p class="small text-muted" style="margin-top: 10px;">
|
<p class="small text-muted" style="margin-top: 10px;">
|
||||||
Amount of time between updates.
|
Amount of time between updates. Time in seconds.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -244,16 +244,16 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
||||||
|
|
||||||
config.UpdateConfig = {
|
config.UpdateConfig = {
|
||||||
Parallelism: service.UpdateParallelism,
|
Parallelism: service.UpdateParallelism,
|
||||||
Delay: service.UpdateDelay,
|
Delay: service.UpdateDelay * 1000000000,
|
||||||
FailureAction: service.UpdateFailureAction,
|
FailureAction: service.UpdateFailureAction,
|
||||||
Order: service.UpdateOrder
|
Order: service.UpdateOrder
|
||||||
};
|
};
|
||||||
|
|
||||||
config.TaskTemplate.RestartPolicy = {
|
config.TaskTemplate.RestartPolicy = {
|
||||||
Condition: service.RestartCondition,
|
Condition: service.RestartCondition,
|
||||||
Delay: service.RestartDelay,
|
Delay: service.RestartDelay * 1000000000,
|
||||||
MaxAttempts: service.RestartMaxAttempts,
|
MaxAttempts: service.RestartMaxAttempts,
|
||||||
Window: service.RestartWindow
|
Window: service.RestartWindow * 1000000000
|
||||||
};
|
};
|
||||||
|
|
||||||
if (service.Ports) {
|
if (service.Ports) {
|
||||||
|
@ -321,6 +321,12 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
||||||
service.ReservationMemoryBytes = service.ReservationMemoryBytes / 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() {
|
function initView() {
|
||||||
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
var apiVersion = $scope.applicationState.endpoint.apiVersion;
|
||||||
ServiceService.service($transition$.params().id)
|
ServiceService.service($transition$.params().id)
|
||||||
|
@ -333,6 +339,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
|
||||||
|
|
||||||
transformResources(service);
|
transformResources(service);
|
||||||
translateServiceArrays(service);
|
translateServiceArrays(service);
|
||||||
|
transformDurations(service);
|
||||||
$scope.service = service;
|
$scope.service = service;
|
||||||
originalService = angular.copy(service);
|
originalService = angular.copy(service);
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ function ServiceViewModel(data, runningTasks, allTasks, nodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.Spec.TaskTemplate.RestartPolicy) {
|
if (data.Spec.TaskTemplate.RestartPolicy) {
|
||||||
this.RestartCondition = data.Spec.TaskTemplate.RestartPolicy.Condition;
|
this.RestartCondition = data.Spec.TaskTemplate.RestartPolicy.Condition || 'any';
|
||||||
this.RestartDelay = data.Spec.TaskTemplate.RestartPolicy.Delay;
|
this.RestartDelay = data.Spec.TaskTemplate.RestartPolicy.Delay || 5000000000;
|
||||||
this.RestartMaxAttempts = data.Spec.TaskTemplate.RestartPolicy.MaxAttempts;
|
this.RestartMaxAttempts = data.Spec.TaskTemplate.RestartPolicy.MaxAttempts || 0;
|
||||||
this.RestartWindow = data.Spec.TaskTemplate.RestartPolicy.Window;
|
this.RestartWindow = data.Spec.TaskTemplate.RestartPolicy.Window || 0;
|
||||||
} else {
|
} else {
|
||||||
this.RestartCondition = 'none';
|
this.RestartCondition = 'any';
|
||||||
this.RestartDelay = 0;
|
this.RestartDelay = 5000000000;
|
||||||
this.RestartMaxAttempts = 0;
|
this.RestartMaxAttempts = 0;
|
||||||
this.RestartWindow = 0;
|
this.RestartWindow = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue