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

feat(service-creation): add placement constraints (#837)

This commit is contained in:
Glowbal 2017-05-04 08:57:08 +02:00 committed by Anthony Lapenna
parent 7c6c9284f2
commit 43e1f25f89
5 changed files with 71 additions and 19 deletions

View file

@ -12,6 +12,18 @@ angular.module('portainer.helpers')
Networks: service.Spec.Networks,
EndpointSpec: service.Spec.EndpointSpec
};
}
},
translateKeyValueToPlacementConstraints: function(keyValueConstraints) {
if (keyValueConstraints) {
var constraints = [];
keyValueConstraints.forEach(function(keyValueConstraint) {
if (keyValueConstraint.key && keyValueConstraint.key !== '' && keyValueConstraint.value && keyValueConstraint.value !== '') {
constraints.push(keyValueConstraint.key + keyValueConstraint.operator + keyValueConstraint.value);
}
});
return constraints;
}
return [];
}
};
}]);