import { Controller, useFormContext, useWatch } from "react-hook-form"; import { SingleValue } from "react-select"; import { faCircleInfo } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField"; import { FilterableSelect, FormControl, Input, Tooltip } from "@app/components/v2"; import { TWindmillWorkspace, useWindmillConnectionListWorkspaces } from "@app/hooks/api/appConnections/windmill"; import { SecretSync } from "@app/hooks/api/secretSyncs"; import { TSecretSyncForm } from "../schemas"; export const WindmillSyncFields = () => { const { control, setValue } = useFormContext< TSecretSyncForm & { destination: SecretSync.Windmill } >(); const connectionId = useWatch({ name: "connection.id", control }); const { data: workspaces, isLoading: isWorkspacesLoading } = useWindmillConnectionListWorkspaces( connectionId, { enabled: Boolean(connectionId) } ); return ( <> { setValue("destinationConfig.workspace", ""); }} /> (
Don't see the workspace you're looking for?{" "}
} > workspace.name === value) ?? null} onChange={(option) => onChange((option as SingleValue)?.name ?? null) } options={workspaces} placeholder="Select a workspace..." getOptionLabel={(option) => option.name} getOptionValue={(option) => option.name} />
)} /> ( The workspace path where secrets should be synced to. Path must follow Windmill{" "} owner path convention . } isError={Boolean(error)} errorText={error?.message} label="Path" > )} /> ); };