From a85fe2626a2a4f5e54e10be46660baaf8699e63e Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Wed, 19 May 2021 09:35:37 -0400 Subject: [PATCH] Delete KeysTab.tsx --- src/realm-settings/KeysTab.tsx | 260 --------------------------------- 1 file changed, 260 deletions(-) delete mode 100644 src/realm-settings/KeysTab.tsx diff --git a/src/realm-settings/KeysTab.tsx b/src/realm-settings/KeysTab.tsx deleted file mode 100644 index cf06fb670a..0000000000 --- a/src/realm-settings/KeysTab.tsx +++ /dev/null @@ -1,260 +0,0 @@ -import React, { useState } from "react"; -import { useHistory, useRouteMatch } from "react-router-dom"; -import { useTranslation } from "react-i18next"; -import { Button, ButtonVariant, PageSection } from "@patternfly/react-core"; -import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; -import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; -import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; -import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; -import { emptyFormatter } from "../util"; -import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; - -import "./RealmSettingsSection.css"; -import { cellWidth } from "@patternfly/react-table"; - -type KeyData = KeyMetadataRepresentation & { - provider?: string; -}; - -type KeysTabInnerProps = { - keys: KeyData[]; -}; - -export const KeysTabInner = ({ keys }: KeysTabInnerProps) => { - const { t } = useTranslation("roles"); - const history = useHistory(); - const { url } = useRouteMatch(); - const [key, setKey] = useState(0); - const refresh = () => setKey(new Date().getTime()); - - const [publicKey, setPublicKey] = useState(""); - const [certificate, setCertificate] = useState(""); - - const loader = async () => { -<<<<<<< HEAD -<<<<<<< HEAD - return keys; - }; - - React.useEffect(() => { - refresh(); - }, [keys]); - - const [togglePublicKeyDialog, PublicKeyDialog] = useConfirmDialog({ - titleKey: t("realm-settings:publicKeys").slice(0, -1), - messageKey: publicKey, - continueButtonLabel: "common:close", - continueButtonVariant: ButtonVariant.primary, - noCancelButton: true, - onConfirm: async () => {}, - }); - - const [toggleCertificateDialog, CertificateDialog] = useConfirmDialog({ - titleKey: t("realm-settings:certificate"), - messageKey: certificate, - continueButtonLabel: "common:close", - continueButtonVariant: ButtonVariant.primary, - noCancelButton: true, - onConfirm: async () => {}, - }); -======= - - const keysMetaData = allKeys; - - console.log("keyz", allKeys); - - return keysMetaData.map((key) => { - key.provider = realmComponents.find( - (component) => component.id === key.providerId - )?.name!; - }); - }; - - // let f = - // keys.map((key) => { - // key.provider = realmComponents.find( - // (component) => component.id === key.providerId - // )?.name!; - // }); - - // console.log(typeof f) - - // keys.forEach((item) => { - // if (item.name === "ecdsa-generated" ) - // console.log(item.config!.ecdsaEllipticCurveKey[0].slice(-3)) - // } - // ) - // keys.config!.ecdsaEllipticCurveKey.slice(-2) - - const toggleModal = () => setOpen(!open); ->>>>>>> keys -======= - return keys; - }; - - React.useEffect(() => { - refresh(); - }, [keys]); - - const [togglePublicKeyDialog, PublicKeyDialog] = useConfirmDialog({ - titleKey: t("realm-settings:publicKeys").slice(0, -1), - messageKey: publicKey, - continueButtonLabel: "common:close", - continueButtonVariant: ButtonVariant.primary, - noCancelButton: true, - onConfirm: async () => {}, - }); - - const [toggleCertificateDialog, CertificateDialog] = useConfirmDialog({ - titleKey: t("realm-settings:certificate"), - messageKey: certificate, - continueButtonLabel: "common:close", - continueButtonVariant: ButtonVariant.primary, - noCancelButton: true, - onConfirm: async () => {}, - }); ->>>>>>> adds keys table to realm settings - - const goToCreate = () => history.push(`${url}/add-role`); - - const ProviderRenderer = ({ provider }: KeyData) => { - return <>{provider}; - }; - -<<<<<<< HEAD -<<<<<<< HEAD - const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => { - if (provider === "ecdsa-generated") { -======= -}; - - const ButtonRenderer = ({ name }: ComponentRepresentation) => { - if (name === "ecdsa-generated") { ->>>>>>> keys -======= - const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => { - if (provider === "ecdsa-generated") { ->>>>>>> adds keys table to realm settings - return ( - <> - - - ); -<<<<<<< HEAD - } - if (provider === "rsa-generated" || provider === "fallback-RS256") { -======= - } else if (provider === "rsa-generated" || provider === "fallback-RS256") { ->>>>>>> adds keys table to realm settings - return ( - <> - - - - ); - } - }; - - return ( - <> - - - - - } - /> - - - ); -}; - -type KeysProps = { - keys: KeyMetadataRepresentation[]; - realmComponents: ComponentRepresentation[]; -}; - -export const KeysTab = ({ keys, realmComponents, ...props }: KeysProps) => { - return ( - { - const provider = realmComponents.find( - (component: ComponentRepresentation) => - component.id === key.providerId - ); - return { ...key, provider: provider?.providerId }; - })} - {...props} - /> - ); -};