diff --git a/ui/core/app/components/form/role/add-principals/index.js b/ui/core/app/components/form/role/add-principals/index.js index de1a8a5de..84ba22428 100644 --- a/ui/core/app/components/form/role/add-principals/index.js +++ b/ui/core/app/components/form/role/add-principals/index.js @@ -15,14 +15,12 @@ export default class FormRoleAddPrincipalsIndexComponent extends Component { /** * Checks for unassigned principals. * True if there are users or groups not yet added to this role. - * @param {RoleModel} role - * @param {[UserModel]} users - * @param {[GroupModel]} groups + * @param {[UserModel, GroupModel]} filteredPrincipals * @type {boolean} */ - @computed('args.{model,users,groups}') + @computed('filteredPrincipals') get hasAvailablePrincipals() { - return this.args.model.principals.length != (this.args.users.length + this.args.groups.length); + return this.filteredPrincipals.length > 0; } /** @@ -32,11 +30,11 @@ export default class FormRoleAddPrincipalsIndexComponent extends Component { @computed('args.{model,users,groups}') get filteredPrincipals() { // Retrieve principal IDs assigned to current role - const currentPrincipalIDs = this.args.model.principals.map((principal) => principal.principal_id); + const currentPrincipalIDs = this.args.model.principals.map(principal => principal.principal_id); // Retrieve principal IDs not assigned to current role const unassignedUsers = this.args.users.filter(({ id }) => !currentPrincipalIDs.includes(id)); const unassignedGroups = this.args.groups.filter(({ id }) => !currentPrincipalIDs.includes(id)); - return unassignedUsers.concat(unassignedGroups); + return [...unassignedUsers, ...unassignedGroups]; } // =actions diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index f88517210..07f55d080 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -226,14 +226,6 @@ module('Acceptance | roles', function (hooks) { assert.expect(0); }); - test('select and save principals to add', async function (assert) { - assert.expect(0); - }); - - test('select and cancel principals to add', async function (assert) { - assert.expect(0); - }); - test('grants can be updated and saved or canceled', async function (assert) { assert.expect(0); });