import { Controller, useFormContext } from "react-hook-form"; import { FilterableSelect, FormControl } from "@app/components/v2"; import { useProject } from "@app/context"; import { useListWorkspacePkiSubscribers } from "@app/hooks/api"; import { TPkiSyncForm } from "./schemas"; export const PkiSyncSourceFields = () => { const { control } = useFormContext(); const { currentProject } = useProject(); const { data: pkiSubscribers = [], isLoading } = useListWorkspacePkiSubscribers( currentProject?.id || "" ); return ( <>

Specify the PKI subscriber where you would like to sync certificates from.

( sub.id === value)} onChange={(selectedSubscriber) => { if (Array.isArray(selectedSubscriber)) return; if ( selectedSubscriber && !Array.isArray(selectedSubscriber) && "id" in selectedSubscriber ) { onChange(selectedSubscriber.id); } else { onChange(undefined); } }} options={pkiSubscribers} isLoading={isLoading} placeholder="Select PKI subscriber..." getOptionLabel={(option) => option?.name || ""} getOptionValue={(option) => option?.id || ""} /> )} /> ); };