Fix instance group modal selection

This commit is contained in:
Marliana Lara 2018-11-29 16:57:52 -05:00
parent abc74fc9b8
commit 4723773354
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE

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) {