diff --git a/app/components/createService/createServiceController.js b/app/components/createService/createServiceController.js
index 061b4c6c5..8497463ab 100644
--- a/app/components/createService/createServiceController.js
+++ b/app/components/createService/createServiceController.js
@@ -18,7 +18,10 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Messages) {
Volumes: [],
Network: '',
ExtraNetworks: [],
- Ports: []
+ Ports: [],
+ Parallelism: 1,
+ UpdateDelay: 0,
+ FailureAction: 'pause'
};
$scope.addPortBinding = function() {
@@ -168,6 +171,14 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Messages) {
config.Networks = _.uniqWith(networks, _.isEqual);
}
+ function prepareUpdateConfig(config, input) {
+ config.UpdateConfig = {
+ Parallelism: input.Parallelism || 0,
+ Delay: input.UpdateDelay || 0,
+ FailureAction: input.FailureAction
+ };
+ }
+
function prepareConfiguration() {
var input = $scope.formValues;
var config = {
@@ -188,6 +199,7 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Messages) {
prepareLabelsConfig(config, input);
prepareVolumes(config, input);
prepareNetworks(config, input);
+ prepareUpdateConfig(config, input);
return config;
}
diff --git a/app/components/createService/createservice.html b/app/components/createService/createservice.html
index 6b9e02ed2..b3e6544ec 100644
--- a/app/components/createService/createservice.html
+++ b/app/components/createService/createservice.html
@@ -102,6 +102,7 @@
Volumes
Network
Labels
+ Update config
@@ -324,7 +325,55 @@
+
+
+
diff --git a/app/components/service/service.html b/app/components/service/service.html
index 194f06228..596ee3c73 100644
--- a/app/components/service/service.html
+++ b/app/components/service/service.html
@@ -168,6 +168,52 @@
+
+ Update Parallelism |
+
+
+ {{ service.UpdateParallelism }}
+ Change
+
+
+
+
+
+
+ |
+
+
+ Update Delay |
+
+
+ {{ service.UpdateDelay }}
+ Change
+
+
+
+
+
+
+ |
+
+
+ Update Failure Action |
+
+
+ |
+
diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js
index ca45c97b6..e33db7dab 100644
--- a/app/components/service/serviceController.js
+++ b/app/components/service/serviceController.js
@@ -60,6 +60,18 @@ function ($scope, $stateParams, $state, Service, ServiceHelper, Task, Node, Mess
service.hasChanges = service.hasChanges || removedElement !== null;
};
+ $scope.changeParallelism = function changeParallelism(service) {
+ updateServiceAttribute(service, 'UpdateParallelism', service.newServiceUpdateParallelism);
+ service.EditParallelism = false;
+ };
+ $scope.changeUpdateDelay = function changeUpdateDelay(service) {
+ updateServiceAttribute(service, 'UpdateDelay', service.newServiceUpdateDelay);
+ service.EditDelay = false;
+ };
+ $scope.changeUpdateFailureAction = function changeUpdateFailureAction(service) {
+ updateServiceAttribute(service, 'UpdateFailureAction', service.newServiceUpdateFailureAction);
+ };
+
$scope.cancelChanges = function changeServiceImage(service) {
Object.keys(previousServiceValues).forEach(function(attribute) {
service[attribute] = previousServiceValues[attribute]; // reset service values
@@ -86,6 +98,12 @@ function ($scope, $stateParams, $state, Service, ServiceHelper, Task, Node, Mess
config.Mode.Replicated.Replicas = service.Replicas;
}
+ config.UpdateConfig = {
+ Parallelism: service.newServiceUpdateParallelism,
+ Delay: service.newServiceUpdateDelay,
+ FailureAction: service.newServiceUpdateFailureAction
+ };
+
Service.update({ id: service.Id, version: service.Version }, config, function (data) {
$('#loadServicesSpinner').hide();
Messages.send("Service successfully updated", "Service updated");
@@ -121,6 +139,10 @@ function ($scope, $stateParams, $state, Service, ServiceHelper, Task, Node, Mess
service.newServiceName = service.Name;
service.newServiceImage = service.Image;
service.newServiceReplicas = service.Replicas;
+ service.newServiceUpdateParallelism = service.UpdateParallelism;
+ service.newServiceUpdateDelay = service.UpdateDelay;
+ service.newServiceUpdateFailureAction = service.UpdateFailureAction;
+
service.EnvironmentVariables = translateEnvironmentVariables(service.Env);
service.ServiceLabels = translateLabelsToServiceLabels(service.Labels);
service.ServiceContainerLabels = translateLabelsToServiceLabels(service.ContainerLabels);
diff --git a/app/shared/viewmodel.js b/app/shared/viewmodel.js
index 64f823670..c7296a6e7 100644
--- a/app/shared/viewmodel.js
+++ b/app/shared/viewmodel.js
@@ -45,6 +45,16 @@ function ServiceViewModel(data) {
if (data.Endpoint.Ports) {
this.Ports = data.Endpoint.Ports;
}
+ if (data.Spec.UpdateConfig) {
+ this.UpdateParallelism = (typeof data.Spec.UpdateConfig.Parallelism !== undefined) ? data.Spec.UpdateConfig.Parallelism || 0 : 1;
+ this.UpdateDelay = data.Spec.UpdateConfig.Delay || 0;
+ this.UpdateFailureAction = data.Spec.UpdateConfig.FailureAction || 'pause';
+ } else {
+ this.UpdateParallelism = 1;
+ this.UpdateDelay = 0;
+ this.UpdateFailureAction = 'pause';
+ }
+
this.Checked = false;
this.Scale = false;
this.EditName = false;