added table truncate on role description (#34289)

fixes: #32992

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-10-30 13:28:04 +01:00 committed by GitHub
parent 7152a8b0f3
commit fd2338c4fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 8 deletions

View file

@ -74,7 +74,7 @@ export default class RoleMappingTab {
selectRow(name: string, modal = false) {
cy.get(modal ? ".pf-v5-c-modal-box " : "" + this.#namesColumn)
.contains(name)
.parent()
.parents("tr")
.within(() => {
cy.get("input").click();
});

View file

@ -21,7 +21,7 @@ export default class AssociatedRolesPage {
cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.parents("tr")
.within(() => {
cy.get("input").click();
});
@ -49,7 +49,7 @@ export default class AssociatedRolesPage {
cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.parents("tr")
.within(() => {
cy.get("input").click();
});
@ -67,7 +67,7 @@ export default class AssociatedRolesPage {
cy.get(this.#addRoleTable)
.contains(roleName)
.parent()
.parents("tr")
.within(() => {
cy.get("input").click();
});

View file

@ -40,7 +40,7 @@ export default class UserRegistration {
selectRow(name: string) {
cy.get(this.#namesColumn)
.contains(name)
.parent()
.parents("tr")
.within(() => {
cy.get("input").click();
});

View file

@ -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,
@ -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";
@ -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,
@ -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={