Skip to content

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

fix greptile comment and better ux for delete protection

Matheus Nogueiraeb3a15abe5bb
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx
index b6acddca2d..74bbbc054e 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx
@@ -139,7 +139,14 @@ export const GcpSyncFields = () => {
</Tooltip>
</FieldLabel>
<FieldContent>
- <Select value={value} onValueChange={(val) => onChange(val)} disabled={!projectId}>
+ <Select
+ value={value}
+ onValueChange={(val) => {
+ onChange(val);
+ setValue("destinationConfig.locationId", "");
+ }}
+ disabled={!projectId}
+ >
<SelectTrigger className="w-full capitalize" isError={Boolean(error)}>
<SelectValue placeholder="Select a scope..." />
</SelectTrigger>
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index 181facdbf5..00ca192b5c 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -1,8 +1,17 @@
-import { ReactNode, useEffect } from "react";
+import { ReactNode, useEffect, useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
-import { CircleHelp } from "lucide-react";
+import { AlertTriangleIcon, CircleHelp } from "lucide-react";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Field,
FieldContent,
FieldDescription,
@@ -44,6 +53,7 @@ type Props = {
};
export const SecretSyncOptionsFields = ({ hideInitialSync, children }: Props) => {
+ const [showDisableDeletionConfirm, setShowDisableDeletionConfirm] = useState(false);
const { control, watch, setValue } = useFormContext<TSecretSyncForm>();
const destination = watch("destination");
@@ -232,10 +242,43 @@ export const SecretSyncOptionsFields = ({ hideInitialSync, children }: Props) =>
id="disable-secret-deletion"
variant="project"
checked={value}
- onCheckedChange={onChange}
+ onCheckedChange={(checked) => {
+ if (checked) {
+ onChange(true);
+ } else {
+ setShowDisableDeletionConfirm(true);
+ }
+ }}
/>
</Field>
<FieldError errors={[error]} />
+ <AlertDialog
+ open={showDisableDeletionConfirm}
+ onOpenChange={setShowDisableDeletionConfirm}
+ >
+ <AlertDialogContent className="sm:max-w-lg!">
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <AlertTriangleIcon className="text-warning" />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Disable Secret Deletion Protection</AlertDialogTitle>
+ <AlertDialogDescription>
+ Are you sure you want to disable secret deletion protection? This can lead to
+ secrets being deleted from {destinationName} if they are not managed by
+ Infisical.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Keep it enabled</AlertDialogCancel>
+ <AlertDialogAction
+ variant="project"
+ onClick={() => onChange(false)}
+ >
+ Disable
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</Field>
)}
/>
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
index 861f141a38..5fece638ee 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
@@ -127,14 +127,14 @@ export const SecretSyncOptionsSection = ({ secretSync }: Props) => {
)}
</Detail>
{AdditionalSyncOptionsComponent}
- {disableSecretDeletion && (
- <Detail>
- <DetailLabel>Secret Deletion</DetailLabel>
- <DetailValue>
- <Badge variant="neutral">Disabled</Badge>
- </DetailValue>
- </Detail>
- )}
+ <Detail>
+ <DetailLabel>Secret Deletion Protection</DetailLabel>
+ <DetailValue>
+ <Badge variant={disableSecretDeletion ? "success" : "neutral"}>
+ {disableSecretDeletion ? "Enabled" : "Disabled"}
+ </Badge>
+ </DetailValue>
+ </Detail>
</DetailGroup>
</AccordionContent>
</AccordionItem>