From 8ae3abf29e60188ac8793fd4a2f91158fab0e061 Mon Sep 17 00:00:00 2001 From: "Miguel A. C" <30386061+doncicuto@users.noreply.github.com> Date: Tue, 23 Jan 2018 10:06:58 +0100 Subject: [PATCH] fix(service-details): avoid sending unmodified restart policy settings when updating a service (#1576) --- app/components/service/serviceController.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js index e39b4a76f..f77910791 100644 --- a/app/components/service/serviceController.js +++ b/app/components/service/serviceController.js @@ -277,12 +277,14 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll, Order: service.UpdateOrder }; - config.TaskTemplate.RestartPolicy = { - Condition: service.RestartCondition, - Delay: ServiceHelper.translateHumanDurationToNanos(service.RestartDelay) || 5000000000, - MaxAttempts: service.RestartMaxAttempts, - Window: ServiceHelper.translateHumanDurationToNanos(service.RestartWindow) || 0 - }; + if ($scope.hasChanges(service, ['RestartCondition', 'RestartDelay', 'RestartMaxAttempts', 'RestartWindow'])){ + config.TaskTemplate.RestartPolicy = { + Condition: service.RestartCondition, + Delay: ServiceHelper.translateHumanDurationToNanos(service.RestartDelay) || 5000000000, + MaxAttempts: service.RestartMaxAttempts, + Window: ServiceHelper.translateHumanDurationToNanos(service.RestartWindow) || 0 + }; + } config.TaskTemplate.LogDriver = null; if (service.LogDriverName) {