Skip to content

Commit

Permalink
added table truncate on role description
Browse files Browse the repository at this point in the history
fixes: keycloak#32992
Signed-off-by: Erik Jan de Wit <[email protected]>
  • Loading branch information
edewit committed Oct 28, 2024
1 parent 964f6b9 commit 509e004
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class AssociatedRolesPage {

cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.parents("tr")
.within(() => {
cy.get("input").click();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/roleRepresentation";
import {
KeycloakDataTable,
ListEmptyState,
} from "@keycloak/keycloak-ui-shared";
import {
Button,
Dropdown,
Expand All @@ -9,14 +14,13 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import { FilterIcon } from "@patternfly/react-icons";
import { cellWidth, TableText } from "@patternfly/react-table";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useAdminClient } from "../../admin-client";
import { useAccess } from "../../context/access/Access";
import { translationFormatter } from "../../utils/translationFormatter";
import useLocaleSort from "../../utils/useLocaleSort";
import { ListEmptyState } from "@keycloak/keycloak-ui-shared";
import { KeycloakDataTable } from "@keycloak/keycloak-ui-shared";
import { ResourcesKey, Row, ServiceRole } from "./RoleMapping";
import { getAvailableRoles } from "./queries";
import { getAvailableClientRoles } from "./resource";
Expand All @@ -33,6 +37,15 @@ type AddRoleMappingModalProps = {

type FilterType = "roles" | "clients";

const RoleDescription = ({ role }: { role: RoleRepresentation }) => {
const { t } = useTranslation();
return (
<TableText wrapModifier="truncate">
{translationFormatter(t)(role.description) as string}
</TableText>
);
};

export const AddRoleMappingModal = ({
id,
name,
Expand Down Expand Up @@ -184,11 +197,12 @@ export const AddRoleMappingModal = ({
{
name: "name",
cellRenderer: ServiceRole,
transforms: [cellWidth(20)],
},
{
name: "role.description",
displayKey: "description",
cellFormatters: [translationFormatter(t)],
cellRenderer: RoleDescription,
},
]}
emptyState={
Expand Down

0 comments on commit 509e004

Please sign in to comment.