Skip to content

Commit

Permalink
HRMNY-15076 Hiding/Disabling Service Role for modification
Browse files Browse the repository at this point in the history
  • Loading branch information
santosh898 committed Apr 29, 2024
1 parent a974f59 commit f98bff6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export const AddRoleMappingModal = ({
params.search = search;
}

const roles = await getAvailableRoles(adminClient, type, { ...params, id });
const roles = (
await getAvailableRoles(adminClient, type, { ...params, id })
).filter((role) => role.role.name !== "service");
const sorted = localeSort(roles, compareRow);
return sorted.map((row) => {
return {
Expand Down
17 changes: 14 additions & 3 deletions js/apps/admin-ui/src/components/role-mapping/RoleMapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ export const RoleMapping = ({
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
try {
await Promise.all(deleteMapping(adminClient, type, id, selected));
await Promise.all(
deleteMapping(
adminClient,
type,
id,
selected.filter((row) => row.role.name !== "service")
)
);
addAlert(t("clients:clientScopeRemoveSuccess"), AlertVariant.success);
refresh();
} catch (error) {
Expand Down Expand Up @@ -179,7 +186,8 @@ export const RoleMapping = ({
searchPlaceholderKey="clients:searchByName"
ariaLabelKey="clients:clientScopeList"
isRowDisabled={(value) =>
(value.role as CompositeRole).isInherited || false
!!(value.role as CompositeRole).isInherited ||
value.role.name === "service"
}
toolbarItem={
<>
Expand Down Expand Up @@ -210,7 +218,10 @@ export const RoleMapping = ({
variant="link"
data-testid="unAssignRole"
onClick={toggleDeleteDialog}
isDisabled={selected.length === 0}
isDisabled={
selected.length === 0 ||
selected.some((row) => row.role.name === "service")
}
>
{t("common:unAssignRole")}
</Button>
Expand Down

0 comments on commit f98bff6

Please sign in to comment.