diff --git a/app/docker/views/stacks/edit/stack.html b/app/docker/views/stacks/edit/stack.html index 8779e380a..9ec0404ad 100644 --- a/app/docker/views/stacks/edit/stack.html +++ b/app/docker/views/stacks/edit/stack.html @@ -27,6 +27,7 @@ nodes="nodes" public-url="state.publicURL" show-text-filter="true" + scale-action="scaleAction" > diff --git a/app/docker/views/stacks/edit/stackController.js b/app/docker/views/stacks/edit/stackController.js index 04bbe0c36..4c84d4db1 100644 --- a/app/docker/views/stacks/edit/stackController.js +++ b/app/docker/views/stacks/edit/stackController.js @@ -84,5 +84,20 @@ function ($q, $scope, $state, $transition$, StackService, NodeService, ServiceSe $scope.stackFileContent = cm.getValue(); }; + $scope.scaleAction = function scaleService(service) { + var config = ServiceHelper.serviceToConfig(service.Model); + config.Mode.Replicated.Replicas = service.Replicas; + ServiceService.update(service, config) + .then(function success(data) { + Notifications.success('Service successfully scaled', 'New replica count: ' + service.Replicas); + $state.reload(); + }) + .catch(function error(err) { + Notifications.error('Failure', err, 'Unable to scale service'); + service.Scale = false; + service.Replicas = service.ReplicaCount; + }); + }; + initView(); }]); diff --git a/app/portainer/components/datatables/stack-services-datatable/stackServicesDatatable.html b/app/portainer/components/datatables/stack-services-datatable/stackServicesDatatable.html index a5bcf30dc..651f2aeb9 100644 --- a/app/portainer/components/datatables/stack-services-datatable/stackServicesDatatable.html +++ b/app/portainer/components/datatables/stack-services-datatable/stackServicesDatatable.html @@ -63,6 +63,16 @@
{{ item.Tasks | runningtaskscount }}
/ {{ item.Mode === 'replicated' ? item.Replicas : ($ctrl.nodes | availablenodecount) }}
+
+
+ Scale
+
+
+
+
+
+
+