fix(service-details): avoid sending unmodified service reservation, limits and update config (#1625)

pull/1884/head
Miguel A. C 7 years ago committed by Anthony Lapenna
parent 74c92c4da8
commit b2b1c86067

@ -254,6 +254,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
config.TaskTemplate.Placement.Constraints = ServiceHelper.translateKeyValueToPlacementConstraints(service.ServiceConstraints); config.TaskTemplate.Placement.Constraints = ServiceHelper.translateKeyValueToPlacementConstraints(service.ServiceConstraints);
config.TaskTemplate.Placement.Preferences = ServiceHelper.translateKeyValueToPlacementPreferences(service.ServicePreferences); config.TaskTemplate.Placement.Preferences = ServiceHelper.translateKeyValueToPlacementPreferences(service.ServicePreferences);
if ($scope.hasChanges(service, ['LimitNanoCPUs', 'LimitMemoryBytes', 'ReservationNanoCPUs', 'ReservationMemoryBytes'])) {
// Round memory values to 0.125 and convert MB to B // Round memory values to 0.125 and convert MB to B
var memoryLimit = (Math.round(service.LimitMemoryBytes * 8) / 8).toFixed(3); var memoryLimit = (Math.round(service.LimitMemoryBytes * 8) / 8).toFixed(3);
memoryLimit *= 1024 * 1024; memoryLimit *= 1024 * 1024;
@ -269,13 +270,16 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
MemoryBytes: memoryReservation MemoryBytes: memoryReservation
} }
}; };
}
if($scope.hasChanges(service, ['UpdateFailureAction', 'UpdateDelay', 'UpdateParallelism', 'UpdateOrder'])) {
config.UpdateConfig = { config.UpdateConfig = {
Parallelism: service.UpdateParallelism, Parallelism: service.UpdateParallelism,
Delay: ServiceHelper.translateHumanDurationToNanos(service.UpdateDelay) || 0, Delay: ServiceHelper.translateHumanDurationToNanos(service.UpdateDelay) || 0,
FailureAction: service.UpdateFailureAction, FailureAction: service.UpdateFailureAction,
Order: service.UpdateOrder Order: service.UpdateOrder
}; };
}
if ($scope.hasChanges(service, ['RestartCondition', 'RestartDelay', 'RestartMaxAttempts', 'RestartWindow'])){ if ($scope.hasChanges(service, ['RestartCondition', 'RestartDelay', 'RestartMaxAttempts', 'RestartWindow'])){
config.TaskTemplate.RestartPolicy = { config.TaskTemplate.RestartPolicy = {

Loading…
Cancel
Save