Skip to content

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

improvement(ui): align secret update confirmation with v3 dialog (#8325)

Andrew Huangd102f825fa00
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx
index 46ec65a6cf..7146843b15 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx
@@ -39,6 +39,7 @@ import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
+ AlertDialogConfirmationField,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
@@ -62,9 +63,6 @@ import {
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
- Field,
- FieldContent,
- FieldLabel,
IconButton,
InfisicalSecretInput,
Input,
@@ -344,7 +342,6 @@ export const SecretEditTableRow = ({
const [isDeleting, setIsDeleting] = useToggle();
const [isEditing, setIsEditing] = useToggle();
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
- const [editConfirmation, setEditConfirmation] = useState("");
const [isCommentOpen, setIsCommentOpen] = useState(false);
const [isTagOpen, setIsTagOpen] = useState(false);
const [isMetadataOpen, setIsMetadataOpen] = useState(false);
@@ -361,10 +358,6 @@ export const SecretEditTableRow = ({
setIsModalOpen((prev) => !prev);
}, []);
- useEffect(() => {
- if (!popUp.editSecret.isOpen) setEditConfirmation("");
- }, [popUp.editSecret.isOpen]);
-
const originalCommentRef = useRef(comment ?? "");
const originalTagsRef = useRef(tags?.map((t) => ({ id: t.id, slug: t.slug })) ?? []);
const originalMetadataRef = useRef(
@@ -1928,8 +1921,9 @@ export const SecretEditTableRow = ({
<AlertDialog
open={popUp.editSecret.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("editSecret", isOpen)}
+ confirmationValue="confirm"
>
- <AlertDialogContent className="sm:max-w-4xl!">
+ <AlertDialogContent className="max-w-3xl [&>*]:min-w-0">
<AlertDialogHeader>
<AlertDialogMedia>
<SaveIcon />
@@ -1947,35 +1941,16 @@ export const SecretEditTableRow = ({
onlyReferences
/>
)}
- <form
- onSubmit={(e) => {
- e.preventDefault();
- if (editConfirmation === "confirm") handleEditSecret(popUp?.editSecret?.data);
- }}
- >
- <Field>
- <FieldLabel>
- Type <span className="font-bold">confirm</span> to proceed
- </FieldLabel>
- <FieldContent>
- <Input
- value={editConfirmation}
- onChange={(e) => setEditConfirmation(e.target.value)}
- placeholder="Type confirm here"
- autoComplete="off"
- />
- </FieldContent>
- </Field>
- </form>
+ <AlertDialogConfirmationField />
<AlertDialogFooter>
- <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogCancel isDisabled={isEditing}>Cancel</AlertDialogCancel>
<AlertDialogAction
variant="project"
onClick={(e) => {
e.preventDefault();
handleEditSecret(popUp?.editSecret?.data);
}}
- disabled={editConfirmation !== "confirm" || isEditing}
+ isPending={isEditing}
>
Save Changes
</AlertDialogAction>