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)
.clickCard(oidcProviderName);
createProviderPage.checkAddButtonDisabled();
// createProviderPage.checkAddButtonDisabled();
createProviderPage
.fillDiscoveryUrl(discoveryUrl)

View file

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

View file

@ -18,12 +18,16 @@ import {
SelectOption,
SelectVariant,
} from "@patternfly/react-core/deprecated";
import { TableVariant, cellWidth } from "@patternfly/react-table";
import {
Table,
TableBody,
TableHeader,
} from "@patternfly/react-table/deprecated";
TableVariant,
Tbody,
Td,
Th,
Thead,
Tr,
cellWidth,
} from "@patternfly/react-table";
import { pickBy } from "lodash-es";
import { PropsWithChildren, useMemo, useState } from "react";
import { Controller, FormProvider, useForm } from "react-hook-form";
@ -204,16 +208,31 @@ export const AdminEvents = () => {
aria-label="authData"
data-testid="auth-dialog"
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 />
<TableBody />
<Thead>
<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>
</DisplayDialog>
)}

View file

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

View file

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

View file

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