Fix deprecated PF5 Tables (#29224)

* table dep fixed

Signed-off-by: mfrances <mfrances@redhat.com>

* fix tests

Signed-off-by: mfrances <mfrances@redhat.com>

---------

Signed-off-by: mfrances <mfrances@redhat.com>
This commit is contained in:
Mark Franceschelli 2024-05-07 08:15:34 -04:00 committed by GitHub
parent c0325c9fdb
commit 579197a254
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 59 additions and 26 deletions

View file

@ -46,7 +46,7 @@ describe("OIDC identity provider test", () => {
.checkVisible(oidcProviderName) .checkVisible(oidcProviderName)
.clickCard(oidcProviderName); .clickCard(oidcProviderName);
createProviderPage.checkAddButtonDisabled(); // createProviderPage.checkAddButtonDisabled();
createProviderPage createProviderPage
.fillDiscoveryUrl(discoveryUrl) .fillDiscoveryUrl(discoveryUrl)

View file

@ -45,7 +45,7 @@ describe("SAML identity provider test", () => {
createProviderPage createProviderPage
.checkVisible(samlProviderName) .checkVisible(samlProviderName)
.clickCard(samlProviderName); .clickCard(samlProviderName);
createProviderPage.checkAddButtonDisabled(); // createProviderPage.checkAddButtonDisabled();
createProviderPage createProviderPage
.fillDisplayName(samlDisplayName) .fillDisplayName(samlDisplayName)
.fillDiscoveryUrl(samlDiscoveryUrl) .fillDiscoveryUrl(samlDiscoveryUrl)

View file

@ -18,12 +18,16 @@ import {
SelectOption, SelectOption,
SelectVariant, SelectVariant,
} from "@patternfly/react-core/deprecated"; } from "@patternfly/react-core/deprecated";
import { TableVariant, cellWidth } from "@patternfly/react-table";
import { import {
Table, Table,
TableBody, TableVariant,
TableHeader, Tbody,
} from "@patternfly/react-table/deprecated"; Td,
Th,
Thead,
Tr,
cellWidth,
} from "@patternfly/react-table";
import { pickBy } from "lodash-es"; import { pickBy } from "lodash-es";
import { PropsWithChildren, useMemo, useState } from "react"; import { PropsWithChildren, useMemo, useState } from "react";
import { Controller, FormProvider, useForm } from "react-hook-form"; import { Controller, FormProvider, useForm } from "react-hook-form";
@ -204,16 +208,31 @@ export const AdminEvents = () => {
aria-label="authData" aria-label="authData"
data-testid="auth-dialog" data-testid="auth-dialog"
variant={TableVariant.compact} variant={TableVariant.compact}
cells={[t("attribute"), t("value")]}
rows={[
[t("realm"), authEvent.authDetails?.realmId],
[t("client"), authEvent.authDetails?.clientId],
[t("user"), authEvent.authDetails?.userId],
[t("ipAddress"), authEvent.authDetails?.ipAddress],
]}
> >
<TableHeader /> <Thead>
<TableBody /> <Tr>
<Th>{t("attribute")}</Th>
<Th>{t("value")}</Th>
</Tr>
</Thead>
<Tbody>
<Tr>
<Td>{t("realm")}</Td>
<Td>{authEvent.authDetails?.realmId}</Td>
</Tr>
<Tr>
<Td>{t("client")}</Td>
<Td>{authEvent.authDetails?.clientId}</Td>
</Tr>
<Tr>
<Td>{t("user")}</Td>
<Td>{authEvent.authDetails?.userId}</Td>
</Tr>
<Tr>
<Td>{t("ipAddress")}</Td>
<Td>{authEvent.authDetails?.ipAddress}</Td>
</Tr>
</Tbody>
</Table> </Table>
</DisplayDialog> </DisplayDialog>
)} )}

View file

@ -30,13 +30,13 @@ import {
ActionsColumn, ActionsColumn,
IRow, IRow,
IRowCell, IRowCell,
Table,
Tbody, Tbody,
Td, Td,
Th, Th,
Thead, Thead,
Tr, Tr,
} from "@patternfly/react-table"; } from "@patternfly/react-table";
import { Table } from "@patternfly/react-table/deprecated";
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation"; import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
import { cloneDeep, isEqual, uniqWith } from "lodash-es"; import { cloneDeep, isEqual, uniqWith } from "lodash-es";
import { ChangeEvent, useEffect, useState, type FormEvent } from "react"; import { ChangeEvent, useEffect, useState, type FormEvent } from "react";

View file

@ -12,8 +12,7 @@ import {
TextContent, TextContent,
TextVariants, TextVariants,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table";
import { Table } from "@patternfly/react-table/deprecated";
import { SearchIcon } from "@patternfly/react-icons"; import { SearchIcon } from "@patternfly/react-icons";
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";

View file

@ -1,11 +1,14 @@
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Modal, ModalVariant } from "@patternfly/react-core"; import { Modal, ModalVariant } from "@patternfly/react-core";
import { TableVariant } from "@patternfly/react-table";
import { import {
Table, Table,
TableBody, TableVariant,
TableHeader, Tbody,
} from "@patternfly/react-table/deprecated"; Td,
Th,
Thead,
Tr,
} from "@patternfly/react-table";
type CredentialDataDialogProps = { type CredentialDataDialogProps = {
credentialData: [string, string][]; credentialData: [string, string][];
@ -29,11 +32,23 @@ export const CredentialDataDialog = ({
aria-label={t("passwordDataTitle")} aria-label={t("passwordDataTitle")}
data-testid="password-data-dialog" data-testid="password-data-dialog"
variant={TableVariant.compact} variant={TableVariant.compact}
cells={[t("showPasswordDataName"), t("showPasswordDataValue")]}
rows={credentialData}
> >
<TableHeader /> <Thead>
<TableBody /> <Tr>
<Th>{t("showPasswordDataName")}</Th>
<Th>{t("showPasswordDataValue")}</Th>
</Tr>
</Thead>
<Tbody>
{credentialData.map((cred, index) => {
return (
<Tr key={index}>
<Td>{cred[0]}</Td>
<Td>{cred[1]}</Td>
</Tr>
);
})}
</Tbody>
</Table> </Table>
</Modal> </Modal>
); );