Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: make key schema behavior more clear

Scott Wilson73804e6e1ba1
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx
index e2b8b11601..f9e1bbfbe8 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx
@@ -277,11 +277,14 @@ const BEHAVIOR_ORDER: SecretSyncInitialSyncBehavior[] = [
];
type InitialSyncAlertsProps = {
- onGoToInitialSync: () => void;
- onGoToOptions: () => void;
+ onGoToInitialSync?: () => void;
+ onGoToOptions?: () => void;
};
-export const InitialSyncAlerts = ({ onGoToInitialSync, onGoToOptions }: InitialSyncAlertsProps) => {
+export const InitialSyncAlerts = ({
+ onGoToInitialSync,
+ onGoToOptions
+}: InitialSyncAlertsProps = {}) => {
const { watch } = useFormContext<TSecretSyncForm>();
const destination = watch("destination");
const destinationName = SECRET_SYNC_MAP[destination].name;
@@ -296,6 +299,15 @@ export const InitialSyncAlerts = ({ onGoToInitialSync, onGoToOptions }: InitialS
const linkClass =
"font-medium text-warning cursor-pointer underline underline-offset-2 hover:text-warning/80 focus-visible:outline-1 focus-visible:outline-danger";
+ const renderRemedy = (text: string, onClick?: () => void) =>
+ onClick ? (
+ <button type="button" onClick={onClick} className={linkClass}>
+ {text}
+ </button>
+ ) : (
+ text
+ );
+
return (
!vercelSensitive &&
initialSyncBehavior === SecretSyncInitialSyncBehavior.OverwriteDestination &&
@@ -307,18 +319,9 @@ export const InitialSyncAlerts = ({ onGoToInitialSync, onGoToOptions }: InitialS
<AlertDescription>
<p>
Anything in {destinationName} not in Infisical will be removed. To keep them,{" "}
- <button type="button" onClick={onGoToInitialSync} className={linkClass}>
- import from provider
- </button>
- ,{" "}
- <button type="button" onClick={onGoToOptions} className={linkClass}>
- customize key names
- </button>
- , or{" "}
- <button type="button" onClick={onGoToOptions} className={linkClass}>
- disable secret deletion
- </button>
- .
+ {renderRemedy("import from provider", onGoToInitialSync)},{" "}
+ {renderRemedy("customize key names", onGoToOptions)}, or{" "}
+ {renderRemedy("disable secret deletion", onGoToOptions)}.
</p>
</AlertDescription>
</Alert>
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncKeySchemaField.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncKeySchemaField.tsx
index 9bfad61e25..3308cafd3d 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncKeySchemaField.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncKeySchemaField.tsx
@@ -82,8 +82,8 @@ export const SecretSyncKeySchemaField = () => {
<FieldContent>
<Label htmlFor="customize-key-names">Customize key names</Label>
<FieldDescription>
- By default, keys keep their Infisical names when written to {destinationName}. Enable to
- rewrite each key with a template.
+ Add a prefix or pattern so Infisical can identify which keys in {destinationName} it
+ manages — anything else is left untouched.
</FieldDescription>
</FieldContent>
<Switch
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index c1f82a197f..fe446c0a97 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -226,8 +226,8 @@ export const SecretSyncOptionsFields = ({ hideInitialSync, children }: Props) =>
)}
/>
)}
- {syncOption?.supportsKeySchema !== false && <SecretSyncKeySchemaField />}
{children}
+ {syncOption?.supportsKeySchema !== false && <SecretSyncKeySchemaField />}
{AdditionalSyncOptionsFieldsComponent}
</>
);