import { Controller, useFormContext } from "react-hook-form"; import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas"; import { FormControl, Input } from "@app/components/v2"; import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2"; import { SecretsMappingTable } from "./SecretsMappingTable"; export const SqlCredentialsRotationSecretsMappingFields = () => { const { control, watch } = useFormContext< TSecretRotationV2Form & { type: SecretRotation.PostgresCredentials; // all sql rotations share these fields } >(); const type = watch("type"); const { rotationOption } = useSecretRotationV2Option(type); const items = [ { name: "Username", input: ( ( )} control={control} name="secretsMapping.username" /> ) }, { name: "Password", input: ( ( )} control={control} name="secretsMapping.password" /> ) } ]; return ; };