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
feat(ui): improve External Infisical path selection with fallback to manual entry
Igor Correa95e0123d443f
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ExternalInfisicalSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ExternalInfisicalSyncFields.tsxindex 7dcf1cc0ab..10f7f6c033 100644--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ExternalInfisicalSyncFields.tsx+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/ExternalInfisicalSyncFields.tsx@@ -3,7 +3,7 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";import { SingleValue } from "react-select";import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";-import { FilterableSelect, FormControl } from "@app/components/v2";+import { FilterableSelect, FormControl, Input } from "@app/components/v2";import {TRemoteInfisicalEnvironmentFolderTree,TRemoteInfisicalProject,@@ -28,10 +28,13 @@ export const ExternalInfisicalSyncFields = () => {enabled: Boolean(connectionId)});- const { data: folderTree = {}, isPending: isFolderTreeLoading } =- useExternalInfisicalConnectionGetEnvironmentFolderTree(connectionId, projectId, {- enabled: Boolean(connectionId) && Boolean(projectId)- });+ const {+ data: folderTree = {},+ isPending: isFolderTreeLoading,+ isError: isFolderTreeError+ } = useExternalInfisicalConnectionGetEnvironmentFolderTree(connectionId, projectId, {+ enabled: Boolean(connectionId) && Boolean(projectId)+ });const environments = useMemo(() => {return projects.find((p) => p.id === projectId)?.environments ?? [];@@ -49,6 +52,13 @@ export const ExternalInfisicalSyncFields = () => {return [root, ...folders];}, [folderTree, environmentSlug]);+ // When folder tree fails or returns empty, allow manual path entry, since the target env might not have the API+ // modified to allow MI access to folder tree yet+ const showManualPathInput =+ Boolean(connectionId && projectId && environmentSlug) &&+ !isFolderTreeLoading &&+ (isFolderTreeError || folderOptions.length <= 1);+return (<><SecretSyncConnectionField@@ -123,20 +133,25 @@ export const ExternalInfisicalSyncFields = () => {isError={Boolean(error?.message)}label="Secret path"tooltipText="The folder path on the remote Infisical instance to sync secrets to"+ helperText={showManualPathInput ? "Enter the path (e.g. / or /my-folder)" : undefined}>- <FilterableSelect- isLoading={isFolderTreeLoading && Boolean(projectId)}- isDisabled={!connectionId || !projectId || !environmentSlug}- value={folderOptions.find((f) => f.path === value) ?? folderOptions[0]}- onChange={(option) => {- const v = option as SingleValue<{ path: string; name: string }>;- onChange(v?.path ?? "/");- }}- options={folderOptions}- placeholder="Select a path..."- getOptionLabel={(option) => option.path}- getOptionValue={(option) => option.path}- />+ {showManualPathInput ? (+ <Input value={value} onChange={(e) => onChange(e.target.value)} placeholder="/" />+ ) : (+ <FilterableSelect+ isLoading={isFolderTreeLoading && Boolean(projectId)}+ isDisabled={!connectionId || !projectId || !environmentSlug}+ value={folderOptions.find((f) => f.path === value) ?? folderOptions[0]}+ onChange={(option) => {+ const v = option as SingleValue<{ path: string; name: string }>;+ onChange(v?.path ?? "/");+ }}+ options={folderOptions}+ placeholder="Select a path..."+ getOptionLabel={(option) => option.path}+ getOptionValue={(option) => option.path}+ />+ )}</FormControl>)}/>