Skip to content

Commit

Permalink
Bug 1652491: filter security group list based on provider
Browse files Browse the repository at this point in the history
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1652491

For setting the remote security group for security group
rules, the dropdown included *all* security groups, including
those for other providers. This commit filters the list
to only show security groups for the current provider.
  • Loading branch information
sseago committed Nov 29, 2018
1 parent 3b71ea1 commit 776cfb8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ManageIQ.angular.app.controller('securityGroupFormController', ['securityGroupFo
name: '',
description: '',
firewall_rules: [],
ems_id: ''
};
vm.ems = [];

Expand All @@ -30,26 +31,27 @@ ManageIQ.angular.app.controller('securityGroupFormController', ['securityGroupFo
} else {
miqService.sparkleOn();

$q.all([getSecurityGroup(securityGroupFormId), getSecurityGroups()])
$q.all([getSecurityGroup(securityGroupFormId)])
.then(function() {
vm.afterGet = true;
vm.modelCopy = _.cloneDeep(vm.securityGroupModel);
getSecurityGroups();
miqService.sparkleOff();
})
.catch(miqService.handleFailure);
}
};

function getSecurityGroup(id) {
return API.get('/api/security_groups/' + id + '?attributes=name,ext_management_system.name,description,cloud_tenant.name,firewall_rules')
return API.get('/api/security_groups/' + id + '?attributes=name,ext_management_system.name,description,cloud_tenant.name,firewall_rules,ems_id')
.then(function(data) {
Object.assign(vm.securityGroupModel, data);
vm.securityGroupModel.firewall_rules_delete = false;
});
}

function getSecurityGroups() {
return API.get('/api/security_groups/?expand=resources&attributes=ems_ref,id,name')
return API.get('/api/providers/' + vm.securityGroupModel.ems_id + '/security_groups/?expand=resources&attributes=ems_ref,id,name')
.then(function(data) {
vm.security_groups_list = data.resources;
});
Expand Down

0 comments on commit 776cfb8

Please sign in to comment.