1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 23:09:41 +02:00

feat(stack): Add the ability to scale services in stack-details (#1776)

This commit is contained in:
Rahul Ruikar 2018-04-04 19:45:35 +10:00 committed by Anthony Lapenna
parent 1cfbec557c
commit dca1976252
4 changed files with 27 additions and 0 deletions

View file

@ -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();
}]);