1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 12:25:22 +02:00

feat(service): change update delay format to a time string in service… (#1470)

This commit is contained in:
Miguel A. C 2017-12-05 20:12:54 +01:00 committed by Anthony Lapenna
parent f3a23c7dd1
commit 728ef35cc1
5 changed files with 62 additions and 9 deletions

View file

@ -24,7 +24,7 @@ function ($q, $scope, $state, $timeout, Service, ServiceHelper, ConfigService, C
Parallelism: 1,
PlacementConstraints: [],
PlacementPreferences: [],
UpdateDelay: 0,
UpdateDelay: '0s',
UpdateOrder: 'stop-first',
FailureAction: 'pause',
Secrets: [],
@ -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 * 1000000000 || 0,
Delay: ServiceHelper.translateHumanDurationToNanos(input.UpdateDelay),
FailureAction: input.FailureAction,
Order: input.UpdateOrder
};

View file

@ -389,13 +389,16 @@
<!-- !parallelism-input -->
<!-- delay-input -->
<div class="form-group">
<label for="update-delay" class="col-sm-3 col-lg-1 control-label text-left">Delay</label>
<label for="update-delay" class="col-sm-3 col-lg-1 control-label text-left">
Delay
<portainer-tooltip position="bottom" message="Supported format examples: 1h, 5m, 10s, 1000ms, 15us, 60ns."></portainer-tooltip>
</label>
<div class="col-sm-4 col-lg-3">
<input type="number" class="form-control" ng-model="formValues.UpdateDelay" id="update-delay" placeholder="e.g. 10">
<input type="text" class="form-control" ng-model="formValues.UpdateDelay" id="update-delay" placeholder="e.g. 1m" ng-pattern="/^([0-9]+)(h|m|s|ms|us|ns)$/i">
</div>
<div class="col-sm-5">
<p class="small text-muted">
Amount of time between updates. Time in seconds.
Amount of time between updates expressed by a number followed by unit (ns|us|ms|s|m|h). Example: 1m.
</p>
</div>
</div>