Skip to content

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

improvement: add step links to secret deletion warning banner

Scott Wilson33a41d53207b
diff --git a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
index b1efc5aba9..e206c9e252 100644
--- a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
+++ b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx
@@ -359,7 +359,16 @@ export const CreateSecretSyncForm = ({
{currentTab.rightDescription}
</p>
</div>
- {selectedTabIndex >= 2 && <InitialSyncAlerts />}
+ {selectedTabIndex >= 2 && (
+ <InitialSyncAlerts
+ onGoToInitialSync={() =>
+ setSelectedTabIndex(formTabs.findIndex((t) => t.key === "initialSync"))
+ }
+ onGoToOptions={() =>
+ setSelectedTabIndex(formTabs.findIndex((t) => t.key === "options"))
+ }
+ />
+ )}
</aside>
</div>
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx
index c0c9f22b4a..e2b8b11601 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncInitialSyncBehaviorFields.tsx
@@ -276,7 +276,12 @@ const BEHAVIOR_ORDER: SecretSyncInitialSyncBehavior[] = [
SecretSyncInitialSyncBehavior.ImportPrioritizeDestination
];
-export const InitialSyncAlerts = () => {
+type InitialSyncAlertsProps = {
+ onGoToInitialSync: () => void;
+ onGoToOptions: () => void;
+};
+
+export const InitialSyncAlerts = ({ onGoToInitialSync, onGoToOptions }: InitialSyncAlertsProps) => {
const { watch } = useFormContext<TSecretSyncForm>();
const destination = watch("destination");
const destinationName = SECRET_SYNC_MAP[destination].name;
@@ -288,6 +293,9 @@ export const InitialSyncAlerts = () => {
const disableSecretDeletion = watch("syncOptions.disableSecretDeletion");
const keySchema = watch("syncOptions.keySchema");
+ const linkClass =
+ "font-medium text-warning cursor-pointer underline underline-offset-2 hover:text-warning/80 focus-visible:outline-1 focus-visible:outline-danger";
+
return (
!vercelSensitive &&
initialSyncBehavior === SecretSyncInitialSyncBehavior.OverwriteDestination &&
@@ -295,10 +303,23 @@ export const InitialSyncAlerts = () => {
!keySchema && (
<Alert variant="warning">
<TriangleAlert />
- <AlertTitle>Secrets will be deleted</AlertTitle>
+ <AlertTitle>External secrets will be deleted</AlertTitle>
<AlertDescription>
- Anything in {destinationName} not in Infisical will be removed. To keep them, import
- instead, add a key schema, or disable secret deletion.
+ <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>
+ .
+ </p>
</AlertDescription>
</Alert>
)