Merge pull request #2845 from marshmalien/fix-org-ig-modal

Fix instance group modal selection

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2018-12-04 15:42:49 +00:00 committed by GitHub
commit f6b075843e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,8 +65,13 @@ export default ['templateUrl', '$window', function(templateUrl, $window) {
$('#instance-groups-modal-body').append($compile(html)($scope));
if ($scope.instanceGroups) {
$scope.instance_groups.map( (item) => {
isSelected(item);
$scope.instanceGroups = $scope.instanceGroups.map( (item) => {
item.isSelected = true;
if (!$scope.igTags) {
$scope.igTags = [];
}
$scope.igTags.push(item);
return item;
});
}
@ -82,22 +87,10 @@ export default ['templateUrl', '$window', function(templateUrl, $window) {
});
});
});
}
init();
function isSelected(item) {
if(_.find($scope.instanceGroups, {id: item.id})){
item.isSelected = true;
if (!$scope.igTags) {
$scope.igTags = [];
}
$scope.igTags.push(item);
}
return item;
}
$scope.$on("selectedOrDeselected", function(e, value) {
let item = value.value;
if (value.isSelected) {