diff --git a/app/components/createService/createServiceController.js b/app/components/createService/createServiceController.js index 324e8c481..09ff3805a 100644 --- a/app/components/createService/createServiceController.js +++ b/app/components/createService/createServiceController.js @@ -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 }; diff --git a/app/components/createService/createservice.html b/app/components/createService/createservice.html index 3a159fda4..196e97506 100644 --- a/app/components/createService/createservice.html +++ b/app/components/createService/createservice.html @@ -395,7 +395,7 @@

- Amount of time between updates. + Amount of time between updates. Time in seconds.

diff --git a/app/components/service/includes/restart.html b/app/components/service/includes/restart.html index e25b0e0dc..1e5293bda 100644 --- a/app/components/service/includes/restart.html +++ b/app/components/service/includes/restart.html @@ -51,7 +51,7 @@

- 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.

diff --git a/app/components/service/includes/updateconfig.html b/app/components/service/includes/updateconfig.html index 469b715d2..92b6ff34b 100644 --- a/app/components/service/includes/updateconfig.html +++ b/app/components/service/includes/updateconfig.html @@ -23,7 +23,7 @@

- Amount of time between updates. + Amount of time between updates. Time in seconds.

diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js index 7a90b15ac..761c7f708 100644 --- a/app/components/service/serviceController.js +++ b/app/components/service/serviceController.js @@ -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); diff --git a/app/models/docker/service.js b/app/models/docker/service.js index c83779243..c04c7611d 100644 --- a/app/models/docker/service.js +++ b/app/models/docker/service.js @@ -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; }