Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement(kms): migrate algorithm select compositions to v3 (#8454)
Andrew Huang2486c0b5d1a0
diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsxindex 34786b8b51..f49423e41a 100644--- a/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsx+++ b/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsx@@ -1,4 +1,4 @@-import { useId } from "react";+import { useId, useState } from "react";import { Controller, useForm } from "react-hook-form";import { faCheckCircle, faFileSignature, faInfoCircle } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";@@ -6,20 +6,18 @@ import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import {- FormControl,- Modal,- ModalClose,- ModalContent,- Select,- SelectItem-} from "@app/components/v2";+import { Modal, ModalClose, ModalContent } from "@app/components/v2";import {Button,Field,FieldError,FieldLabel,IconButton,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,TextArea,Toggle,Tooltip,@@ -49,6 +47,7 @@ type FormProps = Pick<Props, "cmek">;const SignForm = ({ cmek }: FormProps) => {const cmekSign = useCmekSign();const fieldId = useId();+ const [portalContainer, setPortalContainer] = useState<HTMLFormElement | null>(null);const {handleSubmit,@@ -86,7 +85,7 @@ const SignForm = ({ cmek }: FormProps) => {const allowedSigningAlgorithms = getAllowedSigningAlgorithms(cmek);return (- <form onSubmit={handleSubmit(handleSignData)}>+ <form ref={setPortalContainer} onSubmit={handleSubmit(handleSignData)}>{signature ? (<Field className="mb-4"><FieldLabel htmlFor={`${fieldId}-signature`}>Data Signature</FieldLabel>@@ -111,15 +110,34 @@ const SignForm = ({ cmek }: FormProps) => {control={control}name="signingAlgorithm"render={({ field: { onChange, value } }) => (- <FormControl label="Signing Algorithm">- <Select onValueChange={onChange} value={value} className="w-full">- {allowedSigningAlgorithms.map((a) => (- <SelectItem key={a} value={a}>- {a.replaceAll("_", " ")}- </SelectItem>- ))}+ <Field className="mb-4" data-invalid={Boolean(errors.signingAlgorithm)}>+ <FieldLabel htmlFor={`${fieldId}-signing-algorithm`}>+ Signing Algorithm+ </FieldLabel>+ <Select onValueChange={onChange} value={value}>+ <SelectTrigger+ id={`${fieldId}-signing-algorithm`}+ className="w-full"+ isError={Boolean(errors.signingAlgorithm)}+ aria-describedby={+ errors.signingAlgorithm ? `${fieldId}-signing-algorithm-error` : undefined+ }+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent portalContainer={portalContainer} position="popper">+ {allowedSigningAlgorithms.map((a) => (+ <SelectItem key={a} value={a}>+ {a.replaceAll("_", " ")}+ </SelectItem>+ ))}+ </SelectContent></Select>- </FormControl>+ <FieldError+ id={`${fieldId}-signing-algorithm-error`}+ errors={[errors.signingAlgorithm]}+ />+ </Field>)}/>diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsxindex 887fc4d75f..c190f1db0a 100644--- a/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx+++ b/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx@@ -1,4 +1,4 @@-import { useId } from "react";+import { useId, useState } from "react";import { Controller, useForm } from "react-hook-form";import { faFileSignature, faInfoCircle } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";@@ -8,14 +8,7 @@ import { z } from "zod";import { createNotification } from "@app/components/notifications";import { decodeBase64 } from "@app/components/utilities/cryptography/crypto";-import {- FormControl,- Modal,- ModalClose,- ModalContent,- Select,- SelectItem-} from "@app/components/v2";+import { Modal, ModalClose, ModalContent } from "@app/components/v2";import {Badge,Button,@@ -23,6 +16,11 @@ import {FieldError,FieldLabel,IconButton,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,TextArea,Toggle,Tooltip,@@ -63,6 +61,7 @@ type FormProps = Pick<Props, "cmek">;const VerifyForm = ({ cmek }: FormProps) => {const cmekVerify = useCmekVerify();const fieldId = useId();+ const [portalContainer, setPortalContainer] = useState<HTMLFormElement | null>(null);const {handleSubmit,@@ -105,7 +104,7 @@ const VerifyForm = ({ cmek }: FormProps) => {const allowedSigningAlgorithms = getAllowedSigningAlgorithms(cmek);return (- <form onSubmit={handleSubmit(handleVerifyData)}>+ <form ref={setPortalContainer} onSubmit={handleSubmit(handleVerifyData)}>{signatureValid !== undefined ? (<div className="mb-6 flex flex-col gap-2"><div className="flex items-center justify-between space-x-2">@@ -185,15 +184,34 @@ const VerifyForm = ({ cmek }: FormProps) => {control={control}name="signingAlgorithm"render={({ field: { onChange, value } }) => (- <FormControl label="Signing Algorithm">- <Select onValueChange={onChange} value={value} className="w-full">- {allowedSigningAlgorithms.map((a) => (- <SelectItem key={a} value={a}>- {a.replaceAll("_", " ")}- </SelectItem>- ))}+ <Field className="mb-4" data-invalid={Boolean(errors.signingAlgorithm)}>+ <FieldLabel htmlFor={`${fieldId}-signing-algorithm`}>+ Signing Algorithm+ </FieldLabel>+ <Select onValueChange={onChange} value={value}>+ <SelectTrigger+ id={`${fieldId}-signing-algorithm`}+ className="w-full"+ isError={Boolean(errors.signingAlgorithm)}+ aria-describedby={+ errors.signingAlgorithm ? `${fieldId}-signing-algorithm-error` : undefined+ }+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent portalContainer={portalContainer} position="popper">+ {allowedSigningAlgorithms.map((a) => (+ <SelectItem key={a} value={a}>+ {a.replaceAll("_", " ")}+ </SelectItem>+ ))}+ </SelectContent></Select>- </FormControl>+ <FieldError+ id={`${fieldId}-signing-algorithm-error`}+ errors={[errors.signingAlgorithm]}+ />+ </Field>)}/>