import { Controller, useFormContext } from "react-hook-form"; import { SingleValue } from "react-select"; import { faCircleInfo } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas"; import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2"; import { useAzureConnectionListClients } from "@app/hooks/api/appConnections/azure"; import { TAzureClient } from "@app/hooks/api/appConnections/azure/types"; import { SecretRotation } from "@app/hooks/api/secretRotationsV2"; export const AzureClientSecretRotationParametersFields = () => { const { control, watch, setValue } = useFormContext< TSecretRotationV2Form & { type: SecretRotation.AzureClientSecret; } >(); const connectionId = watch("connection.id"); const { data: clients, isPending: isClientsPending } = useAzureConnectionListClients( connectionId, { enabled: Boolean(connectionId) } ); return ( ( Ensure that your connection has the{" "} Application.ReadWrite.All, Directory.ReadWrite.All, Application.ReadWrite.OwnedBy, user_impersonation and User.Read {" "} permissions and the application exists in Azure. } >
Don't see the application you're looking for?{" "}
} > client.id === value) ?? null} onChange={(option) => { onChange((option as SingleValue)?.id ?? null); setValue("parameters.appName", (option as SingleValue)?.name ?? ""); setValue("parameters.clientId", (option as SingleValue)?.appId ?? ""); }} options={clients} placeholder="Select an application..." getOptionLabel={(option) => option.name} getOptionValue={(option) => option.id} />
)} /> ); };