Merge pull request #9588 from AlexSCorey/9456-9466-UserAndTeamsAccessAdd

Fixes a bug with ResourceAccess Add

SUMMARY
This addresses #9456 and #9466
The user can now properly add roles to a resource.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

UI

ADDITIONAL INFORMATION

Reviewed-by: Kersom <None>
Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-03-25 17:26:23 +00:00 committed by GitHub
commit fa3e55be91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,8 +54,9 @@ function AddResourceRole({ onSave, onClose, roles, i18n, resource, onError }) {
);
if (selectedIndex > -1) {
selectedRoleRows.splice(selectedIndex, 1);
setSelectedRoleRows(selectedRoleRows);
setSelectedRoleRows(
selectedRoleRows.filter((r, index) => index !== selectedIndex)
);
} else {
setSelectedRoleRows([...selectedRoleRows, role]);
}