/* eslint-disable */ // @ts-nocheck import { SelectControl, FileUploadControl } from "../../../shared/keycloak-ui-shared"; import { Button, ButtonVariant, Form, Modal, ModalVariant, Text, TextContent, } from "../../../shared/@patternfly/react-core"; import { FormProvider, useForm, useWatch } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; import { StoreSettings } from "./StoreSettings"; type ImportKeyDialogProps = { toggleDialog: () => void; save: (importFile: ImportFile) => void; title?: string; description?: string; }; export type ImportFile = { keystoreFormat: string; keyAlias: string; storePassword: string; file: File | string; }; export const ImportKeyDialog = ({ save, toggleDialog, title = "generateKeys", description = "generateKeysDescription", }: ImportKeyDialogProps) => { const { t } = useTranslation(); const form = useForm(); const { control, handleSubmit } = form; const baseFormats = useServerInfo().cryptoInfo?.supportedKeystoreTypes ?? []; const formats = baseFormats.concat([ "Certificate PEM", "Public Key PEM", "JSON Web Key Set", ]); const format = useWatch({ control, name: "keystoreFormat", defaultValue: formats[0], }); return ( { await handleSubmit((importFile) => { save(importFile); toggleDialog(); })(); }} > {t("import")} , , ]} > {t(description)}
{baseFormats.includes(format) && }
); };