From a15eb11d81a5ea7f58f7bb037cad64cfab1305de Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 29 Apr 2022 09:03:39 +0200 Subject: [PATCH] Removed unused column fixes: #1758 --- public/resources/en/users.json | 1 + src/components/role-mapping/RoleMapping.tsx | 46 +++++++++------------ src/user/UserRoleMapping.tsx | 2 +- 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/public/resources/en/users.json b/public/resources/en/users.json index 11a7a22d06..8d1e2b40ff 100644 --- a/public/resources/en/users.json +++ b/public/resources/en/users.json @@ -96,6 +96,7 @@ "deleteGrantsSuccess": "Grants successfully revoked.", "deleteGrantsError": "Error deleting grants.", "roleMapping": "Role mapping", + "roleMappingUpdatedSuccess": "User role mapping successfully updated", "noRoles": "No roles for this user", "noRolesInstructions": "You haven't assigned any roles to this user. Assign a role to get started.", "unlockAllUsers": "Unlock all users", diff --git a/src/components/role-mapping/RoleMapping.tsx b/src/components/role-mapping/RoleMapping.tsx index b85916e227..260611c24d 100644 --- a/src/components/role-mapping/RoleMapping.tsx +++ b/src/components/role-mapping/RoleMapping.tsx @@ -8,6 +8,7 @@ import { Checkbox, ToolbarItem, } from "@patternfly/react-core"; +import { cellWidth } from "@patternfly/react-table"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/roleRepresentation"; @@ -40,27 +41,24 @@ export const mapRoles = ( assignedRoles: Row[], effectiveRoles: Row[], hide: boolean -) => { - return [ - ...(hide - ? assignedRoles.map((row) => ({ - ...row, - role: { - ...row.role, - isInherited: false, - }, - })) - : effectiveRoles.map((row) => ({ - ...row, - role: { - ...row.role, - isInherited: - assignedRoles.find((r) => r.role.id === row.role.id) === - undefined, - }, - }))), - ]; -}; +) => [ + ...(hide + ? assignedRoles.map((row) => ({ + ...row, + role: { + ...row.role, + isInherited: false, + }, + })) + : effectiveRoles.map((row) => ({ + ...row, + role: { + ...row.role, + isInherited: + assignedRoles.find((r) => r.role.id === row.role.id) === undefined, + }, + }))), +]; export const ServiceRole = ({ role, client }: Row) => ( <> @@ -287,13 +285,9 @@ export const RoleMapping = ({ { name: "role.name", displayKey: t("common:name"), + transforms: [cellWidth(30)], cellRenderer: ServiceRole, }, - { - name: "role.parent.name", - displayKey: t("common:inherentFrom"), - cellFormatters: [emptyFormatter()], - }, { name: "role.description", displayKey: t("common:description"), diff --git a/src/user/UserRoleMapping.tsx b/src/user/UserRoleMapping.tsx index 4b126822dd..dfd1caf9f2 100644 --- a/src/user/UserRoleMapping.tsx +++ b/src/user/UserRoleMapping.tsx @@ -17,7 +17,7 @@ type UserRoleMappingProps = { }; export const UserRoleMapping = ({ id, name }: UserRoleMappingProps) => { - const { t } = useTranslation("clients"); + const { t } = useTranslation("users"); const adminClient = useAdminClient(); const { addAlert, addError } = useAlerts();