Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Shared destructive-confirm dialog primitive + standardized wording (SKY-12989) (#8009)
Aaron Perez7b1b0ac0318f
diff --git a/skyvern-frontend/src/components/DeleteConfirmationDialog.tsx b/skyvern-frontend/src/components/DeleteConfirmationDialog.tsxdeleted file mode 100644index 713a082b8..000000000--- a/skyvern-frontend/src/components/DeleteConfirmationDialog.tsx+++ /dev/null@@ -1,92 +0,0 @@-import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";--type AffectedBlock = {- nodeId: string;- label: string;- hasParameterKeyReference: boolean;- hasJinjaReference: boolean;-};--type Props = {- open: boolean;- onOpenChange: (open: boolean) => void;- title: string;- description: string;- affectedBlocks: AffectedBlock[];- onConfirm: () => void;-};--function DeleteConfirmationDialog({- open,- onOpenChange,- title,- description,- affectedBlocks,- onConfirm,-}: Props) {- return (- <Dialog open={open} onOpenChange={onOpenChange}>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>{title}</DialogTitle>- <DialogDescription asChild>- <div className="space-y-3">- <p>{description}</p>- {affectedBlocks.length > 0 && (- <div className="rounded-md border border-amber-500/50 bg-amber-500/10 p-3">- <p className="mb-2 font-medium text-amber-500">- The following blocks reference this item and will be- updated:- </p>- <ul className="list-inside list-disc space-y-1 text-sm text-slate-300">- {affectedBlocks.map((block) => (- <li key={block.nodeId}>- <span className="font-medium">{block.label}</span>- <span className="text-slate-400">- {" "}- (- {[- block.hasParameterKeyReference && "input selector",- block.hasJinjaReference && "text field",- ]- .filter(Boolean)- .join(", ")}- )- </span>- </li>- ))}- </ul>- </div>- )}- </div>- </DialogDescription>- </DialogHeader>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => {- onConfirm();- }}- >- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>- );-}--export { DeleteConfirmationDialog };-export type { AffectedBlock };diff --git a/skyvern-frontend/src/components/ui/confirm-dialog.test.tsx b/skyvern-frontend/src/components/ui/confirm-dialog.test.tsxnew file mode 100644index 000000000..ab6491ebf--- /dev/null+++ b/skyvern-frontend/src/components/ui/confirm-dialog.test.tsx@@ -0,0 +1,195 @@+// @vitest-environment jsdom+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";++import { ConfirmDialog } from "./confirm-dialog";++afterEach(cleanup);++function confirmButton() {+ return screen.getByRole("button", { name: "Delete" }) as HTMLButtonElement;+}++function cancelButton() {+ return screen.getByRole("button", { name: "Cancel" }) as HTMLButtonElement;+}++describe("ConfirmDialog", () => {+ it("renders the title, description, and standardized reversibility line", () => {+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Delete this credential?"+ description="The credential Prod API Key will be deleted."+ onConfirm={() => {}}+ />,+ );++ expect(screen.getByText("Delete this credential?")).toBeTruthy();+ expect(+ screen.getByText("The credential Prod API Key will be deleted."),+ ).toBeTruthy();+ expect(screen.getByText("This can't be undone.")).toBeTruthy();+ });++ it("omits the reversibility line when reversible", () => {+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Unassign folder?"+ description="The credentials in this folder will be unassigned, not deleted."+ reversible+ onConfirm={() => {}}+ />,+ );++ expect(screen.queryByText("This can't be undone.")).toBeNull();+ });++ it("lets a surface override the reversibility line with stronger wording", () => {+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Delete credential?"+ reversibilityNote="The Skyvern team has no way to restore a credential once it's deleted."+ onConfirm={() => {}}+ />,+ );++ expect(screen.queryByText("This can't be undone.")).toBeNull();+ expect(+ screen.getByText(+ "The Skyvern team has no way to restore a credential once it's deleted.",+ ),+ ).toBeTruthy();+ });++ it("confirms immediately when no typed confirmation is required", () => {+ const onConfirm = vi.fn();+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Delete schedule?"+ onConfirm={onConfirm}+ />,+ );++ expect(confirmButton().disabled).toBe(false);+ fireEvent.click(confirmButton());+ expect(onConfirm).toHaveBeenCalledTimes(1);+ });++ it("requires typed confirmation for bulk deletes at or above the threshold", () => {+ const onConfirm = vi.fn();+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Delete 12 agents?"+ itemCount={12}+ onConfirm={onConfirm}+ />,+ );++ const input = screen.getByRole("textbox") as HTMLInputElement;+ expect(input).toBeTruthy();+ expect(confirmButton().disabled).toBe(true);++ fireEvent.click(confirmButton());+ expect(onConfirm).not.toHaveBeenCalled();++ fireEvent.change(input, { target: { value: " DELETE " } });+ expect(confirmButton().disabled).toBe(false);++ fireEvent.click(confirmButton());+ expect(onConfirm).toHaveBeenCalledTimes(1);+ });++ it("does not require typed confirmation below the threshold", () => {+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Delete 3 agents?"+ itemCount={3}+ onConfirm={() => {}}+ />,+ );++ expect(screen.queryByRole("textbox")).toBeNull();+ expect(confirmButton().disabled).toBe(false);+ });++ it("can force typed confirmation independent of item count", () => {+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Clear all scripts?"+ requireTypedConfirmation+ confirmationPhrase="clear"+ confirmLabel="Clear All"+ onConfirm={() => {}}+ />,+ );++ const input = screen.getByRole("textbox") as HTMLInputElement;+ const button = screen.getByRole("button", {+ name: "Clear All",+ }) as HTMLButtonElement;+ expect(button.disabled).toBe(true);++ fireEvent.change(input, { target: { value: "clear" } });+ expect(button.disabled).toBe(false);+ });++ it("keeps confirm disabled while confirmDisabled is set (usage-lookup gating)", () => {+ render(+ <ConfirmDialog+ open+ onOpenChange={() => {}}+ title="Delete browser profile?"+ confirmDisabled+ onConfirm={() => {}}+ />,+ );++ expect(confirmButton().disabled).toBe(true);+ });++ it("disables both actions and shows a spinner while pending", () => {+ const onOpenChange = vi.fn();+ const { container } = render(+ <ConfirmDialog+ open+ onOpenChange={onOpenChange}+ title="Delete schedule?"+ isPending+ onConfirm={() => {}}+ />,+ );++ expect(confirmButton().disabled).toBe(true);+ expect(cancelButton().disabled).toBe(true);+ expect(container.ownerDocument.querySelector(".animate-spin")).toBeTruthy();+ });++ it("cancel requests a close", () => {+ const onOpenChange = vi.fn();+ render(+ <ConfirmDialog+ open+ onOpenChange={onOpenChange}+ title="Delete schedule?"+ onConfirm={() => {}}+ />,+ );++ fireEvent.click(cancelButton());+ expect(onOpenChange).toHaveBeenCalledWith(false);+ });+});diff --git a/skyvern-frontend/src/components/ui/confirm-dialog.tsx b/skyvern-frontend/src/components/ui/confirm-dialog.tsxnew file mode 100644index 000000000..ec3364bdf--- /dev/null+++ b/skyvern-frontend/src/components/ui/confirm-dialog.tsx@@ -0,0 +1,195 @@+import * as React from "react";+import { ReloadIcon } from "@radix-ui/react-icons";++import { Button, type ButtonProps } from "@/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/components/ui/dialog";+import { Input } from "@/components/ui/input";+import { Label } from "@/components/ui/label";++const BULK_TYPED_CONFIRMATION_THRESHOLD = 10;+const DEFAULT_CONFIRMATION_PHRASE = "delete";+const DEFAULT_REVERSIBILITY_NOTE = "This can't be undone.";++type ConfirmDialogProps = {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ /** What the user is confirming. e.g. "Delete 3 schedules?" */+ title: React.ReactNode;+ /**+ * What happens, and to how many items. Surfaces pass this copy; the dialog+ * owns the structure and the standardized reversibility line below it.+ */+ description?: React.ReactNode;+ /** Extra content rendered below the description (usage lists, radio choices, etc). */+ children?: React.ReactNode;+ /**+ * Omits the standardized "This can't be undone." line for actions that can be+ * undone, or that spell out reversibility in the description.+ */+ reversible?: boolean;+ /** Overrides the standardized reversibility line (e.g. stronger "PERMANENTLY deleted" wording). */+ reversibilityNote?: React.ReactNode;+ confirmLabel?: string;+ cancelLabel?: string;+ confirmVariant?: ButtonProps["variant"];+ /** Shows a spinner and blocks interaction while the action runs. */+ isPending?: boolean;+ /**+ * Extra gating on the confirm button, independent of pending/typed state.+ * e.g. holding Delete until a usage lookup resolves.+ */+ confirmDisabled?: boolean;+ onConfirm: () => void;+ /**+ * Require the user to type {@link confirmationPhrase} before confirming.+ * Auto-enabled when {@link itemCount} reaches the bulk threshold.+ */+ requireTypedConfirmation?: boolean;+ confirmationPhrase?: string;+ /** Number of items affected; when >= threshold, typed confirmation is required. */+ itemCount?: number;+ typedConfirmationThreshold?: number;+ /** Extra classes for the dialog content (e.g. `z-[60]` when nested in another dialog). */+ contentClassName?: string;+};++function ConfirmDialog({+ open,+ onOpenChange,+ title,+ description,+ children,+ reversible = false,+ reversibilityNote,+ confirmLabel = "Delete",+ cancelLabel = "Cancel",+ confirmVariant = "destructive",+ isPending = false,+ confirmDisabled = false,+ onConfirm,+ requireTypedConfirmation = false,+ confirmationPhrase = DEFAULT_CONFIRMATION_PHRASE,+ itemCount,+ typedConfirmationThreshold = BULK_TYPED_CONFIRMATION_THRESHOLD,+ contentClassName,+}: ConfirmDialogProps) {+ const inputId = React.useId();+ const [typed, setTyped] = React.useState("");++ const needsTypedConfirmation =+ requireTypedConfirmation ||+ (itemCount !== undefined && itemCount >= typedConfirmationThreshold);++ React.useEffect(() => {+ if (!open) {+ setTyped("");+ }+ }, [open]);++ const typedMatches =+ typed.trim().toLowerCase() === confirmationPhrase.trim().toLowerCase();+ const confirmBlocked =+ confirmDisabled || isPending || (needsTypedConfirmation && !typedMatches);++ const handleConfirm = () => {+ if (confirmBlocked) {+ return;+ }+ onConfirm();+ };++ const showReversibilityNote = !reversible;+ const hasDescriptionBlock = Boolean(description) || showReversibilityNote;++ return (+ <Dialog+ open={open}+ onOpenChange={(next) => {+ // Block dismissal while the action is in flight so a mid-delete close+ // can't strand the caller's pending state.+ if (isPending) {+ return;+ }+ onOpenChange(next);+ }}+ >+ <DialogContent+ className={contentClassName}+ onCloseAutoFocus={(e) => e.preventDefault()}+ >+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ {hasDescriptionBlock ? (+ <DialogDescription asChild>+ <div className="space-y-3">+ {typeof description === "string" ? (+ <p>{description}</p>+ ) : (+ description+ )}+ {showReversibilityNote ? (+ <p>{reversibilityNote ?? DEFAULT_REVERSIBILITY_NOTE}</p>+ ) : null}+ </div>+ </DialogDescription>+ ) : null}+ </DialogHeader>+ {children}+ {needsTypedConfirmation ? (+ <div className="flex flex-col gap-2">+ <Label htmlFor={inputId}>+ Type{" "}+ <code className="rounded bg-muted px-1 py-0.5 font-mono text-xs">+ {confirmationPhrase}+ </code>{" "}+ to confirm+ </Label>+ <Input+ id={inputId}+ value={typed}+ onChange={(event) => setTyped(event.target.value)}+ onKeyDown={(event) => {+ if (event.key === "Enter") {+ event.preventDefault();+ handleConfirm();+ }+ }}+ autoComplete="off"+ autoFocus+ disabled={isPending}+ />+ </div>+ ) : null}+ <DialogFooter>+ <Button+ variant="secondary"+ disabled={isPending}+ onClick={() => onOpenChange(false)}+ >+ {cancelLabel}+ </Button>+ <Button+ variant={confirmVariant}+ disabled={confirmBlocked}+ onClick={handleConfirm}+ >+ {isPending ? (+ <ReloadIcon className="mr-2 size-4 animate-spin" />+ ) : null}+ {confirmLabel}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}++export { ConfirmDialog, BULK_TYPED_CONFIRMATION_THRESHOLD };+export type { ConfirmDialogProps };diff --git a/skyvern-frontend/src/routes/browserProfiles/BrowserProfilesList.tsx b/skyvern-frontend/src/routes/browserProfiles/BrowserProfilesList.tsxindex 02a3ed1a5..0d42f043a 100644--- a/skyvern-frontend/src/routes/browserProfiles/BrowserProfilesList.tsx+++ b/skyvern-frontend/src/routes/browserProfiles/BrowserProfilesList.tsx@@ -9,14 +9,7 @@ import { GarbageIcon } from "@/components/icons/GarbageIcon";import { SelectionBar } from "@/components/SelectionBar";import { SelectionHeaderCheckboxCell } from "@/components/SelectionCheckbox";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useRowSelection } from "@/hooks/useRowSelection";import { bulkResultToast } from "@/util/bulkResultToast";@@ -376,50 +369,33 @@ function BrowserProfilesList({ searchKey, managed }: Props = {}) {</Button></SelectionBar>)}- <Dialog+ <ConfirmDialogopen={deleteDialog.open}onOpenChange={(open) => {- if (!open && !isBulkOperating) {+ if (!open) {setDeleteDialog({ open: false, targets: [] });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>- Delete {deleteDialog.targets.length} Browser Profile- {deleteDialog.targets.length === 1 ? "" : "s"}- </DialogTitle>- <DialogDescription>- Are you sure you want to delete {deleteDialog.targets.length}{" "}- {deleteDialog.targets.length === 1- ? "browser profile"- : "browser profiles"}- ? Linked credentials are unlinked automatically; any workflows- pinned to these profiles will need repointing. This action cannot- be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={isBulkOperating}- onClick={() => setDeleteDialog({ open: false, targets: [] })}- >- Cancel- </Button>- <Button- variant="destructive"- disabled={isBulkOperating}- onClick={() => {- void handleBulkDeleteConfirm();- }}- >- {isBulkOperating ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete ${deleteDialog.targets.length} browser profile${+ deleteDialog.targets.length === 1 ? "" : "s"+ }?`}+ description={+ <p>+ {deleteDialog.targets.length}{" "}+ {deleteDialog.targets.length === 1+ ? "browser profile"+ : "browser profiles"}{" "}+ will be permanently deleted. Linked credentials are unlinked+ automatically; any agents pinned to these profiles will need+ repointing.+ </p>+ }+ itemCount={deleteDialog.targets.length}+ isPending={isBulkOperating}+ onConfirm={() => {+ void handleBulkDeleteConfirm();+ }}+ /></div>);}diff --git a/skyvern-frontend/src/routes/browserProfiles/DeleteBrowserProfileButton.tsx b/skyvern-frontend/src/routes/browserProfiles/DeleteBrowserProfileButton.tsxindex 063d4e468..11b797c2a 100644--- a/skyvern-frontend/src/routes/browserProfiles/DeleteBrowserProfileButton.tsx+++ b/skyvern-frontend/src/routes/browserProfiles/DeleteBrowserProfileButton.tsx@@ -1,17 +1,9 @@-import { ReloadIcon, TrashIcon } from "@radix-ui/react-icons";+import { TrashIcon } from "@radix-ui/react-icons";import { useState } from "react";import { BrowserProfileApiResponse } from "@/api/types";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Tooltip,TooltipContent,@@ -20,7 +12,7 @@ import {} from "@/components/ui/tooltip";import { BrowserProfileUsageList } from "./BrowserProfileUsageList";-import { deleteWarning } from "./browserProfileRole";+import { deleteWarning, getBrowserProfileRole } from "./browserProfileRole";import { useBrowserProfileUsageQuery } from "./hooks/useBrowserProfileUsageQuery";import { useDeleteBrowserProfileMutation } from "./hooks/useBrowserProfileMutations";@@ -37,62 +29,52 @@ function DeleteBrowserProfileButton({ profile, onDeleted }: Props) {{ enabled: open },);+ // A remembered browser (workflow memory) or a credential login is re-created on the+ // next run/sign-in, so those deletes are soft. A plain saved profile is gone for good.+ const isSoftDelete = getBrowserProfileRole(profile, usage) !== "plain";+return (- <Dialog open={open} onOpenChange={setOpen}>+ <><TooltipProvider><Tooltip><TooltipTrigger asChild>- <DialogTrigger asChild>- <Button- size="icon"- variant="ghost"- aria-label="Delete browser profile"- className="text-muted-foreground hover:text-destructive"- >- <TrashIcon className="h-4 w-4" />- </Button>- </DialogTrigger>+ <Button+ size="icon"+ variant="ghost"+ aria-label="Delete browser profile"+ className="text-muted-foreground hover:text-destructive"+ onClick={() => setOpen(true)}+ >+ <TrashIcon className="h-4 w-4" />+ </Button></TooltipTrigger><TooltipContent>Delete Browser Profile</TooltipContent></Tooltip></TooltipProvider>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>+ <ConfirmDialog+ open={open}+ onOpenChange={setOpen}+ title={+ <>Delete{" "}<span className="font-bold text-primary">{profile.name}</span>?- </DialogTitle>- </DialogHeader>- <div className="space-y-4 text-sm text-neutral-600 dark:text-slate-400">- <p>{deleteWarning(profile, usage)}</p>- <BrowserProfileUsageList- usage={usage}- isLoading={open && isLoading}- />- </div>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={async () => {- await deleteMutation.mutateAsync(profile.browser_profile_id);- setOpen(false);- onDeleted?.();- }}- // Hold the destructive action until the used-by list has loaded so a user can't confirm- // before seeing what depends on the profile. A usage error re-enables it (warn, never block).- disabled={deleteMutation.isPending || isLoading}- >- {deleteMutation.isPending && (- <ReloadIcon className="mr-2 size-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ </>+ }+ description={<p>{deleteWarning(profile, usage)}</p>}+ reversible={isSoftDelete}+ isPending={deleteMutation.isPending}+ // Hold the destructive action until the used-by list has loaded so a user can't confirm+ // before seeing what depends on the profile. A usage error re-enables it (warn, never block).+ confirmDisabled={isLoading}+ onConfirm={async () => {+ await deleteMutation.mutateAsync(profile.browser_profile_id);+ setOpen(false);+ onDeleted?.();+ }}+ >+ <BrowserProfileUsageList usage={usage} isLoading={open && isLoading} />+ </ConfirmDialog>+ </>);}diff --git a/skyvern-frontend/src/routes/credentials/CredentialsBulkBar.tsx b/skyvern-frontend/src/routes/credentials/CredentialsBulkBar.tsxindex c926a084a..48dbe2331 100644--- a/skyvern-frontend/src/routes/credentials/CredentialsBulkBar.tsx+++ b/skyvern-frontend/src/routes/credentials/CredentialsBulkBar.tsx@@ -4,14 +4,7 @@ import { FolderIcon } from "@/components/icons/FolderIcon";import { TrashSolidIcon } from "@/components/icons/TrashSolidIcon";import { SelectionBar, SelectionBarDivider } from "@/components/SelectionBar";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { bulkResultToast } from "@/util/bulkResultToast";import {@@ -171,46 +164,29 @@ function CredentialsBulkBar({Delete</Button></SelectionBar>- <Dialog+ <ConfirmDialogopen={deleteDialog.open}onOpenChange={(open) => {- if (!open && !isOperating) {+ if (!open) {setDeleteDialog({ open: false, targets: [] });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>- Delete {deleteDialog.targets.length} Credential- {deleteDialog.targets.length === 1 ? "" : "s"}- </DialogTitle>- <DialogDescription>- Are you sure you want to delete {deleteDialog.targets.length}{" "}- {deleteDialog.targets.length === 1 ? "credential" : "credentials"}- ? This action cannot be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={isOperating}- onClick={() => setDeleteDialog({ open: false, targets: [] })}- >- Cancel- </Button>- <Button- variant="destructive"- disabled={isOperating}- onClick={() => {- void handleBulkDeleteConfirm();- }}- >- {isOperating ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete ${deleteDialog.targets.length} credential${+ deleteDialog.targets.length === 1 ? "" : "s"+ }?`}+ description={+ <p>+ {deleteDialog.targets.length}{" "}+ {deleteDialog.targets.length === 1 ? "credential" : "credentials"}{" "}+ will be permanently deleted.+ </p>+ }+ itemCount={deleteDialog.targets.length}+ isPending={isOperating}+ onConfirm={() => {+ void handleBulkDeleteConfirm();+ }}+ /></>);}diff --git a/skyvern-frontend/src/routes/credentials/DeleteCredentialButton.tsx b/skyvern-frontend/src/routes/credentials/DeleteCredentialButton.tsxindex 1bbc9aa04..7053feebe 100644--- a/skyvern-frontend/src/routes/credentials/DeleteCredentialButton.tsx+++ b/skyvern-frontend/src/routes/credentials/DeleteCredentialButton.tsx@@ -1,14 +1,8 @@-import {- Dialog,- DialogClose,- DialogContent,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { useState } from "react";+import { getClient } from "@/api/AxiosClient";import { Button } from "@/components/ui/button";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Tooltip,TooltipContent,@@ -19,7 +13,7 @@ import { toast } from "@/components/ui/use-toast";import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useMutation, useQueryClient } from "@tanstack/react-query";import { AxiosError } from "axios";-import { ReloadIcon, TrashIcon } from "@radix-ui/react-icons";+import { TrashIcon } from "@radix-ui/react-icons";import { CredentialApiResponse } from "@/api/types";type Props = {credential: CredentialApiResponse;@@ -28,6 +22,7 @@ type Props = {function DeleteCredentialButton({ credential }: Props) {const credentialGetter = useCredentialGetter();const queryClient = useQueryClient();+ const [open, setOpen] = useState(false);const deleteCredentialMutation = useMutation({mutationFn: async (id: string) => {@@ -38,6 +33,7 @@ function DeleteCredentialButton({ credential }: Props) {queryClient.invalidateQueries({queryKey: ["credentials"],});+ setOpen(false);toast({title: "Credential deleted",variant: "success",@@ -54,48 +50,40 @@ function DeleteCredentialButton({ credential }: Props) {});return (- <Dialog>+ <><TooltipProvider><Tooltip><TooltipTrigger asChild>- <DialogTrigger asChild>- <Button size="icon" variant="tertiary" className="h-8 w-9">- <TrashIcon className="size-5" />- </Button>- </DialogTrigger>+ <Button+ size="icon"+ variant="tertiary"+ className="h-8 w-9"+ onClick={() => setOpen(true)}+ >+ <TrashIcon className="size-5" />+ </Button></TooltipTrigger><TooltipContent>Delete Credential</TooltipContent></Tooltip></TooltipProvider>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>Are you sure?</DialogTitle>- </DialogHeader>- <div className="text-sm text-slate-400">- The credential{" "}- <span className="font-bold text-primary">{credential.name}</span> will- be PERMANENTLY deleted. The Skyvern team has no way to restore a- credential once it's deleted.- </div>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => {- deleteCredentialMutation.mutate(credential.credential_id);- }}- disabled={deleteCredentialMutation.isPending}- >- {deleteCredentialMutation.isPending && (- <ReloadIcon className="mr-2 size-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ <ConfirmDialog+ open={open}+ onOpenChange={setOpen}+ title="Delete credential?"+ description={+ <p>+ The credential{" "}+ <span className="font-bold text-primary">{credential.name}</span>{" "}+ will be permanently deleted.+ </p>+ }+ reversibilityNote="The Skyvern team can't restore a credential once it's deleted."+ isPending={deleteCredentialMutation.isPending}+ onConfirm={() =>+ deleteCredentialMutation.mutate(credential.credential_id)+ }+ />+ </>);}diff --git a/skyvern-frontend/src/routes/credentials/DeleteCredentialFolderButton.tsx b/skyvern-frontend/src/routes/credentials/DeleteCredentialFolderButton.tsxindex 4ccdbe699..88e44081a 100644--- a/skyvern-frontend/src/routes/credentials/DeleteCredentialFolderButton.tsx+++ b/skyvern-frontend/src/routes/credentials/DeleteCredentialFolderButton.tsx@@ -1,22 +1,11 @@import { TrashSolidIcon } from "@/components/icons/TrashSolidIcon";-import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Tooltip,TooltipContent,TooltipProvider,TooltipTrigger,} from "@/components/ui/tooltip";-import { ReloadIcon } from "@radix-ui/react-icons";import { useEffect, useState } from "react";import { useDeleteCredentialFolderMutation } from "./hooks/useCredentialFolderMutations";@@ -38,47 +27,40 @@ function DeleteCredentialFolderButton({ folderId, folderTitle }: Props) {}, [isDeleteFolderSuccess]);return (- <Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>+ <><TooltipProvider><Tooltip><TooltipTrigger asChild>- <DialogTrigger asChild>- <button- onClick={(e) => e.stopPropagation()}- className="rounded p-1.5 text-red-400 transition-colors hover:bg-red-500/20 hover:text-red-300"- aria-label="Delete folder"- >- <TrashSolidIcon className="h-4 w-4" />- </button>- </DialogTrigger>+ <button+ onClick={(e) => {+ e.stopPropagation();+ setIsDialogOpen(true);+ }}+ className="rounded p-1.5 text-red-400 transition-colors hover:bg-red-500/20 hover:text-red-300"+ aria-label="Delete folder"+ >+ <TrashSolidIcon className="h-4 w-4" />+ </button></TooltipTrigger><TooltipContent>Delete Folder</TooltipContent></Tooltip></TooltipProvider>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>Delete Folder: {folderTitle}</DialogTitle>- <DialogDescription>- The credentials in this folder will be unassigned, not deleted.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => deleteFolder({ folderId })}- disabled={isDeleteFolderPending}- >- {isDeleteFolderPending && (- <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ <ConfirmDialog+ open={isDialogOpen}+ onOpenChange={(open) => {+ if (!open) {+ setIsDialogOpen(false);+ }+ }}+ title={`Delete folder: ${folderTitle}?`}+ description={+ <p>The credentials in this folder will be unassigned, not deleted.</p>+ }+ reversible+ isPending={isDeleteFolderPending}+ onConfirm={() => deleteFolder({ folderId })}+ />+ </>);}diff --git a/skyvern-frontend/src/routes/schedules/ScheduleDetailPage.tsx b/skyvern-frontend/src/routes/schedules/ScheduleDetailPage.tsxindex f12fb7011..b868a3a38 100644--- a/skyvern-frontend/src/routes/schedules/ScheduleDetailPage.tsx+++ b/skyvern-frontend/src/routes/schedules/ScheduleDetailPage.tsx@@ -7,14 +7,7 @@ import {TrashIcon,} from "@radix-ui/react-icons";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";import { Switch } from "@/components/ui/switch";@@ -449,40 +442,18 @@ function ScheduleDetailPage() {</div></div></div>- <Dialog+ <ConfirmDialogopen={deleteDialogOpen}onOpenChange={(open) => {- if (!open && !deleteMutation.isPending) {+ if (!open) {setDeleteDialogOpen(false);}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>Delete Schedule</DialogTitle>- <DialogDescription>- Are you sure you want to delete this schedule? This action cannot- be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={deleteMutation.isPending}- onClick={() => setDeleteDialogOpen(false)}- >- Cancel- </Button>- <Button- variant="destructive"- disabled={deleteMutation.isPending}- onClick={handleDelete}- >- {deleteMutation.isPending ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title="Delete schedule?"+ description={<p>This schedule will be permanently deleted.</p>}+ isPending={deleteMutation.isPending}+ onConfirm={handleDelete}+ /></div>);}diff --git a/skyvern-frontend/src/routes/schedules/SchedulesPage.tsx b/skyvern-frontend/src/routes/schedules/SchedulesPage.tsxindex b2dcea744..a7c3c79b2 100644--- a/skyvern-frontend/src/routes/schedules/SchedulesPage.tsx+++ b/skyvern-frontend/src/routes/schedules/SchedulesPage.tsx@@ -36,14 +36,7 @@ import {DropdownMenuItem,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Select,SelectContent,@@ -674,77 +667,43 @@ function SchedulesPage() {)}{/* Bulk delete confirmation dialog */}- <Dialog+ <ConfirmDialogopen={bulkDeleteDialog.open}onOpenChange={(open) => {- if (!open && !isBulkOperating) {+ if (!open) {setBulkDeleteDialog({ open: false, count: 0 });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>Delete {bulkDeleteDialog.count} Schedules</DialogTitle>- <DialogDescription>- Are you sure you want to delete {bulkDeleteDialog.count}{" "}- {bulkDeleteDialog.count === 1 ? "schedule" : "schedules"}? This- action cannot be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={isBulkOperating}- onClick={() => setBulkDeleteDialog({ open: false, count: 0 })}- >- Cancel- </Button>- <Button- variant="destructive"- disabled={isBulkOperating}- onClick={handleBulkDeleteConfirm}- >- {isBulkOperating ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete ${bulkDeleteDialog.count} schedule${+ bulkDeleteDialog.count === 1 ? "" : "s"+ }?`}+ description={+ <p>+ {bulkDeleteDialog.count}{" "}+ {bulkDeleteDialog.count === 1 ? "schedule" : "schedules"} will be+ permanently deleted.+ </p>+ }+ itemCount={bulkDeleteDialog.count}+ isPending={isBulkOperating}+ onConfirm={() => {+ void handleBulkDeleteConfirm();+ }}+ />{/* Delete confirmation dialog */}- <Dialog+ <ConfirmDialogopen={deleteDialog.open}onOpenChange={(open) => {- if (!open && !deleteMutation.isPending) {+ if (!open) {setDeleteDialog({ open: false, schedule: null });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>Delete Schedule</DialogTitle>- <DialogDescription>- Are you sure you want to delete this schedule? This action cannot- be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={deleteMutation.isPending}- onClick={() => setDeleteDialog({ open: false, schedule: null })}- >- Cancel- </Button>- <Button- variant="destructive"- disabled={deleteMutation.isPending}- onClick={handleDeleteConfirm}- >- {deleteMutation.isPending ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title="Delete schedule?"+ description={<p>This schedule will be permanently deleted.</p>}+ isPending={deleteMutation.isPending}+ onConfirm={handleDeleteConfirm}+ />{/* Create Schedule Dialog */}<CreateOrgScheduleDialogdiff --git a/skyvern-frontend/src/routes/settings/LabelManagement.tsx b/skyvern-frontend/src/routes/settings/LabelManagement.tsxindex 0a2ce5d32..606ba9669 100644--- a/skyvern-frontend/src/routes/settings/LabelManagement.tsx+++ b/skyvern-frontend/src/routes/settings/LabelManagement.tsx@@ -8,6 +8,7 @@ import {TrashIcon,} from "@radix-ui/react-icons";import { Button } from "@/components/ui/button";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Card,CardContent,@@ -569,44 +570,24 @@ function LabelManagement() {existingGroups={groups.map((group) => group.key)}/>- <Dialog+ <ConfirmDialogopen={labelToDelete !== null}onOpenChange={(next) => {- if (!next && !deleteMutation.isPending) {+ if (!next) {setLabelToDelete(null);}}}- >- <DialogContent className="sm:max-w-md">- <DialogHeader>- <DialogTitle>Delete label “{labelToDelete?.value}”?</DialogTitle>- <DialogDescription>- This removes it from {usageLabel(deleteCount)} and from the “- {labelToDelete?.key}” group. This can’t be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="outline"- onClick={() => setLabelToDelete(null)}- disabled={deleteMutation.isPending}- >- Cancel- </Button>- <Button- variant="destructive"- className="gap-2"- disabled={deleteMutation.isPending}- onClick={confirmDelete}- >- {deleteMutation.isPending ? (- <ReloadIcon className="h-4 w-4 animate-spin" />- ) : null}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete label "${labelToDelete?.value ?? ""}"?`}+ description={+ <p>+ This removes it from {usageLabel(deleteCount)} and from the "+ {labelToDelete?.key ?? ""}" group.+ </p>+ }+ contentClassName="sm:max-w-md"+ isPending={deleteMutation.isPending}+ onConfirm={confirmDelete}+ /></div>);}diff --git a/skyvern-frontend/src/routes/tasks/create/SavedTaskCard.tsx b/skyvern-frontend/src/routes/tasks/create/SavedTaskCard.tsxindex a9d828325..43c1a9d15 100644--- a/skyvern-frontend/src/routes/tasks/create/SavedTaskCard.tsx+++ b/skyvern-frontend/src/routes/tasks/create/SavedTaskCard.tsx@@ -1,5 +1,4 @@import { getClient } from "@/api/AxiosClient";-import { Button } from "@/components/ui/button";import {Card,CardContent,@@ -7,14 +6,7 @@ import {CardHeader,CardTitle,} from "@/components/ui/card";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {DropdownMenu,DropdownMenuContent,@@ -26,7 +18,7 @@ import {import { toast } from "@/components/ui/use-toast";import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { cn } from "@/util/utils";-import { DotsHorizontalIcon, ReloadIcon } from "@radix-ui/react-icons";+import { DotsHorizontalIcon } from "@radix-ui/react-icons";import { useMutation, useQueryClient } from "@tanstack/react-query";import { useState } from "react";import { useNavigate } from "react-router-dom";@@ -90,59 +82,36 @@ function SavedTaskCard({ workflowId, title, url, description }: Props) {<span className="overflow-hidden text-ellipsis whitespace-nowrap">{title}</span>- <Dialog+ <DropdownMenu modal={false}>+ <DropdownMenuTrigger asChild>+ <DotsHorizontalIcon className="cursor-pointer" />+ </DropdownMenuTrigger>+ <DropdownMenuContent className="w-56">+ <DropdownMenuLabel>Template Actions</DropdownMenuLabel>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onSelect={() => {+ setOpen(true);+ }}+ >+ Delete Template+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ <ConfirmDialogopen={open}- onOpenChange={() => {- setOpen(false);+ onOpenChange={(next) => {+ if (!next) {+ setOpen(false);+ }+ }}+ title="Delete this task template?"+ description="This deletes the task template."+ isPending={deleteTaskMutation.isPending}+ onConfirm={() => {+ deleteTaskMutation.mutate(workflowId);}}- >- <DropdownMenu modal={false}>- <DropdownMenuTrigger asChild>- <DotsHorizontalIcon className="cursor-pointer" />- </DropdownMenuTrigger>- <DropdownMenuContent className="w-56">- <DropdownMenuLabel>Template Actions</DropdownMenuLabel>- <DropdownMenuSeparator />- <DropdownMenuItem- onSelect={() => {- setOpen(true);- }}- >- Delete Template- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- <DialogContent>- <DialogHeader>- <DialogTitle>Are you absolutely sure?</DialogTitle>- <DialogDescription>- Are you sure you want to delete this task template?- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- onClick={() => {- setOpen(false);- }}- >- Cancel- </Button>- <Button- variant="destructive"- onClick={() => {- deleteTaskMutation.mutate(workflowId);- }}- disabled={deleteTaskMutation.isPending}- >- {deleteTaskMutation.isPending && (- <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ /></CardTitle><CardDescription className="overflow-hidden text-ellipsis whitespace-nowrap text-slate-400">{url}diff --git a/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx b/skyvern-frontend/src/routes/workflows/WorkflowActions.tsxindex 6803436f5..32830c076 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx@@ -1,15 +1,8 @@+import { useState } from "react";+import { GarbageIcon } from "@/components/icons/GarbageIcon";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {DropdownMenu,DropdownMenuContent,@@ -28,7 +21,6 @@ import {DotsHorizontalIcon,DownloadIcon,MixerHorizontalIcon,- ReloadIcon,} from "@radix-ui/react-icons";import { useWorkflowRowActions } from "./hooks/useWorkflowRowActions";import { WorkflowApiResponse } from "./types/workflowTypes";@@ -56,9 +48,10 @@ function WorkflowActions({isDeleting,isTogglingTemplate,} = useWorkflowRowActions(workflow);+ const [deleteOpen, setDeleteOpen] = useState(false);return (- <Dialog>+ <><DropdownMenu><DropdownMenuTrigger asChild><Button@@ -122,38 +115,30 @@ function WorkflowActions({</DropdownMenuSubContent></DropdownMenuPortal></DropdownMenuSub>- <DialogTrigger>- <DropdownMenuItem className="p-2">- <GarbageIcon className="mr-2 h-4 w-4 text-destructive" />- Delete Agent- </DropdownMenuItem>- </DialogTrigger>+ <DropdownMenuItem+ className="p-2"+ onSelect={() => setDeleteOpen(true)}+ >+ <GarbageIcon className="mr-2 h-4 w-4 text-destructive" />+ Delete Agent+ </DropdownMenuItem></DropdownMenuContent></DropdownMenu>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>Are you sure?</DialogTitle>- <DialogDescription>+ <ConfirmDialog+ open={deleteOpen}+ onOpenChange={setDeleteOpen}+ title="Delete agent?"+ description={+ <p>The agent{" "}<span className="font-semibold text-primary">{workflow.title}</span>{" "}- will be deleted.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => deleteWorkflow({ onSuccess: onSuccessfullyDeleted })}- disabled={isDeleting}- >- {isDeleting && <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ will be permanently deleted.+ </p>+ }+ isPending={isDeleting}+ onConfirm={() => deleteWorkflow({ onSuccess: onSuccessfullyDeleted })}+ />+ </>);}diff --git a/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsx b/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsxindex 941b179ca..465878ff3 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowScriptsPage.tsx@@ -1,15 +1,6 @@import { getClient } from "@/api/AxiosClient";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { Skeleton } from "@/components/ui/skeleton";import {Table,@@ -36,7 +27,6 @@ import {FileTextIcon,Pencil2Icon,PlayIcon,- ReloadIcon,TrashIcon,} from "@radix-ui/react-icons";import { useMutation, useQueryClient } from "@tanstack/react-query";@@ -136,45 +126,36 @@ function DeleteScriptButton({});return (- <Dialog open={open} onOpenChange={setOpen}>- <DialogTrigger asChild>- <Button- variant="ghost"- size="icon"- className="size-8 text-muted-foreground hover:text-destructive"- onClick={(e) => e.stopPropagation()}- >- <TrashIcon className="size-4" />- </Button>- </DialogTrigger>- <DialogContent onClick={(e) => e.stopPropagation()}>- <DialogHeader>- <DialogTitle>Delete script?</DialogTitle>- <DialogDescription>- This will delete the cached script for{" "}- <span className="font-mono font-semibold text-primary">- {script.cache_key_value}- </span>- . The script will be regenerated on the next run.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => deleteMutation.mutate()}- disabled={deleteMutation.isPending}- >- {deleteMutation.isPending && (- <ReloadIcon className="mr-2 size-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ <>+ <Button+ variant="ghost"+ size="icon"+ className="size-8 text-muted-foreground hover:text-destructive"+ onClick={(e) => {+ e.stopPropagation();+ setOpen(true);+ }}+ >+ <TrashIcon className="size-4" />+ </Button>+ <span onClick={(e) => e.stopPropagation()}>+ <ConfirmDialog+ open={open}+ onOpenChange={setOpen}+ title="Delete script?"+ description={+ <p>+ This deletes the cached script for{" "}+ <span className="font-mono">{script.cache_key_value}</span>. It's+ regenerated on the next run.+ </p>+ }+ reversible+ isPending={deleteMutation.isPending}+ onConfirm={() => deleteMutation.mutate()}+ />+ </span>+ </>);}@@ -211,38 +192,32 @@ function ClearAllScriptsButton({});return (- <Dialog open={open} onOpenChange={setOpen}>- <DialogTrigger asChild>- <Button variant="destructive" size="sm" disabled={disabled}>- <TrashIcon className="mr-2 size-4" />- Clear All Scripts- </Button>- </DialogTrigger>- <DialogContent>- <DialogHeader>- <DialogTitle>Clear all scripts?</DialogTitle>- <DialogDescription>- This will delete all cached scripts for this agent. Scripts will be- regenerated on the next run. This action cannot be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => clearMutation.mutate()}- disabled={clearMutation.isPending}- >- {clearMutation.isPending && (- <ReloadIcon className="mr-2 size-4 animate-spin" />- )}- Clear All- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ <>+ <Button+ variant="destructive"+ size="sm"+ disabled={disabled}+ onClick={() => setOpen(true)}+ >+ <TrashIcon className="mr-2 size-4" />+ Clear All Scripts+ </Button>+ <ConfirmDialog+ open={open}+ onOpenChange={setOpen}+ title="Clear all scripts?"+ description={+ <p>+ This deletes all cached scripts for this agent. They're regenerated+ on the next run.+ </p>+ }+ reversible+ confirmLabel="Clear All"+ isPending={clearMutation.isPending}+ onConfirm={() => clearMutation.mutate()}+ />+ </>);}diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsxindex 2106a0b5c..5f088b8ee 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx@@ -9,14 +9,7 @@ import {SelectionHeaderCheckboxCell,} from "@/components/SelectionCheckbox";import { useRowSelection } from "@/hooks/useRowSelection";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Pagination,PaginationContent,@@ -1302,49 +1295,29 @@ function WorkflowsFlat() {/>)}- <Dialog+ <ConfirmDialogopen={bulkDeleteDialog.open}onOpenChange={(open) => {- if (!open && !isBulkOperating) {+ if (!open) {setBulkDeleteDialog({ open: false, targets: [] });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>- Delete {bulkDeleteDialog.targets.length} Agent- {bulkDeleteDialog.targets.length === 1 ? "" : "s"}- </DialogTitle>- <DialogDescription>- Are you sure you want to delete{" "}- {bulkDeleteDialog.targets.length}{" "}- {bulkDeleteDialog.targets.length === 1 ? "agent" : "agents"}?- This action cannot be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={isBulkOperating}- onClick={() =>- setBulkDeleteDialog({ open: false, targets: [] })- }- >- Cancel- </Button>- <Button- variant="destructive"- disabled={isBulkOperating}- onClick={() => {- void handleBulkDeleteConfirm();- }}- >- {isBulkOperating ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete ${bulkDeleteDialog.targets.length} agent${+ bulkDeleteDialog.targets.length === 1 ? "" : "s"+ }?`}+ description={+ <p>+ {bulkDeleteDialog.targets.length}{" "}+ {bulkDeleteDialog.targets.length === 1 ? "agent" : "agents"} will+ be permanently deleted.+ </p>+ }+ itemCount={bulkDeleteDialog.targets.length}+ isPending={isBulkOperating}+ onConfirm={() => {+ void handleBulkDeleteConfirm();+ }}+ />{/* Folder Dialogs */}<CreateFolderDialogdiff --git a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsxindex 6d1aed213..d46c43e42 100644--- a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx+++ b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx@@ -6,14 +6,7 @@ import { OnboardingTelemetry } from "@/util/onboarding/OnboardingTelemetry";import { Button } from "@/components/ui/button";import { SelectionHeaderCheckboxCell } from "@/components/SelectionCheckbox";import { useRowSelection } from "@/hooks/useRowSelection";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Table,TableBody,@@ -1059,49 +1052,29 @@ function WorkflowsTree() {/>)}- <Dialog+ <ConfirmDialogopen={bulkDeleteDialog.open}onOpenChange={(open) => {- if (!open && !isBulkOperating) {+ if (!open) {setBulkDeleteDialog({ open: false, targets: [] });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>- Delete {bulkDeleteDialog.targets.length} Agent- {bulkDeleteDialog.targets.length === 1 ? "" : "s"}- </DialogTitle>- <DialogDescription>- Are you sure you want to delete{" "}- {bulkDeleteDialog.targets.length}{" "}- {bulkDeleteDialog.targets.length === 1 ? "agent" : "agents"}?- This action cannot be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={isBulkOperating}- onClick={() =>- setBulkDeleteDialog({ open: false, targets: [] })- }- >- Cancel- </Button>- <Button- variant="destructive"- disabled={isBulkOperating}- onClick={() => {- void handleBulkDeleteConfirm();- }}- >- {isBulkOperating ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete ${bulkDeleteDialog.targets.length} agent${+ bulkDeleteDialog.targets.length === 1 ? "" : "s"+ }?`}+ description={+ <p>+ {bulkDeleteDialog.targets.length}{" "}+ {bulkDeleteDialog.targets.length === 1 ? "agent" : "agents"} will+ be permanently deleted.+ </p>+ }+ itemCount={bulkDeleteDialog.targets.length}+ isPending={isBulkOperating}+ onConfirm={() => {+ void handleBulkDeleteConfirm();+ }}+ />{/* Folder Dialogs */}<CreateFolderDialogdiff --git a/skyvern-frontend/src/routes/workflows/components/DeleteFolderButton.tsx b/skyvern-frontend/src/routes/workflows/components/DeleteFolderButton.tsxindex 1c3d952fb..8f22d341c 100644--- a/skyvern-frontend/src/routes/workflows/components/DeleteFolderButton.tsx+++ b/skyvern-frontend/src/routes/workflows/components/DeleteFolderButton.tsx@@ -1,15 +1,5 @@import { GarbageIcon } from "@/components/icons/GarbageIcon";-import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Tooltip,TooltipContent,@@ -18,7 +8,6 @@ import {} from "@/components/ui/tooltip";import { Label } from "@/components/ui/label";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";-import { ReloadIcon } from "@radix-ui/react-icons";import { useEffect, useState } from "react";import { useDeleteFolderMutation } from "../hooks/useFolderMutations";@@ -49,30 +38,38 @@ function DeleteFolderButton({ folderId, folderTitle }: Props) {};return (- <Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>+ <><TooltipProvider><Tooltip><TooltipTrigger asChild>- <DialogTrigger asChild>- <button- onClick={(e) => e.stopPropagation()}- className="rounded p-1.5 text-red-700 transition-colors hover:bg-red-500/20 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"- aria-label="Delete folder"- >- <GarbageIcon className="h-4 w-4" />- </button>- </DialogTrigger>+ <button+ onClick={(e) => {+ e.stopPropagation();+ setIsDialogOpen(true);+ }}+ className="rounded p-1.5 text-red-700 transition-colors hover:bg-red-500/20 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"+ aria-label="Delete folder"+ >+ <GarbageIcon className="h-4 w-4" />+ </button></TooltipTrigger><TooltipContent>Delete Folder</TooltipContent></Tooltip></TooltipProvider>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>Delete Folder: {folderTitle}</DialogTitle>- <DialogDescription>- Choose how you want to delete this folder.- </DialogDescription>- </DialogHeader>+ <ConfirmDialog+ open={isDialogOpen}+ onOpenChange={(open) => {+ if (!open) {+ setIsDialogOpen(false);+ }+ }}+ title={`Delete folder: ${folderTitle}?`}+ description={<p>Choose how you want to delete this folder.</p>}+ reversible={deleteOption === "folder_only"}+ reversibilityNote="The agents in this folder will be permanently deleted. This can't be undone."+ isPending={isDeleteFolderPending}+ onConfirm={handleDelete}+ ><RadioGroupvalue={deleteOption}onValueChange={(value) =>@@ -95,23 +92,8 @@ function DeleteFolderButton({ folderId, folderTitle }: Props) {</Label></div></RadioGroup>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={handleDelete}- disabled={isDeleteFolderPending}- >- {isDeleteFolderPending && (- <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ </ConfirmDialog>+ </>);}diff --git a/skyvern-frontend/src/routes/workflows/components/WorkflowRowActions.tsx b/skyvern-frontend/src/routes/workflows/components/WorkflowRowActions.tsxindex 4b04698aa..ef95f57ad 100644--- a/skyvern-frontend/src/routes/workflows/components/WorkflowRowActions.tsx+++ b/skyvern-frontend/src/routes/workflows/components/WorkflowRowActions.tsx@@ -6,7 +6,6 @@ import {DownloadIcon,Pencil2Icon,PlayIcon,- ReloadIcon,TokensIcon,} from "@radix-ui/react-icons";import { FolderIcon } from "@/components/icons/FolderIcon";@@ -16,15 +15,7 @@ import {RowActionsKebab,type RowActionItem,} from "@/components/RowActions";-import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { toast } from "@/components/ui/use-toast";import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";import { useUpdateWorkflowFolderMutation } from "../hooks/useFolderMutations";@@ -253,7 +244,7 @@ function WorkflowRowActions({icon: <GarbageIcon className="mr-2 h-4 w-4 text-destructive" />,destructive: true,disabled: isMultiSelect,- dialogTrigger: true,+ onSelect: () => setDeleteOpen(true),},);@@ -267,14 +258,7 @@ function WorkflowRowActions({);return (- <Dialog- open={deleteOpen}- onOpenChange={(open) => {- if (!isDeleting) {- setDeleteOpen(open);- }- }}- >+ <><RowActionsContextMenuitems={items}onOpenChange={(open) => {@@ -285,41 +269,28 @@ function WorkflowRowActions({>{children(kebab)}</RowActionsContextMenu>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>Are you sure?</DialogTitle>- <DialogDescription>+ <ConfirmDialog+ open={deleteOpen}+ onOpenChange={setDeleteOpen}+ title="Delete agent?"+ description={+ <p>The agent{" "}<span className="font-semibold text-primary">{workflow.title}</span>{" "}- will be deleted.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- onClick={() => setDeleteOpen(false)}- disabled={isDeleting}- >- Cancel- </Button>- <Button- variant="destructive"- onClick={() =>- deleteWorkflow({- onSuccess: () => {- setDeleteOpen(false);- onDeleted?.(workflow.workflow_permanent_id);- },- })- }- disabled={isDeleting}- >- {isDeleting && <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ will be permanently deleted.+ </p>+ }+ isPending={isDeleting}+ onConfirm={() =>+ deleteWorkflow({+ onSuccess: () => {+ setDeleteOpen(false);+ onDeleted?.(workflow.workflow_permanent_id);+ },+ })+ }+ />+ </>);}diff --git a/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagFilter.tsx b/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagFilter.tsxindex 57fe01856..09bb6b993 100644--- a/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagFilter.tsx+++ b/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagFilter.tsx@@ -1,14 +1,5 @@import * as React from "react";-import { ReloadIcon } from "@radix-ui/react-icons";-import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { type TagFilterTerm, type TagKey } from "../../types/tagTypes";import { type TagColorMap } from "../../types/tagColors";import { useDeleteTagKeyMutation } from "../../hooks/useWorkflowTagMutations";@@ -41,58 +32,38 @@ function WorkflowTagFilter({ value, onChange, ...controlProps }: Props) {onChange={onChange}onDeleteKey={setKeyToDelete}/>- <Dialog+ <ConfirmDialogopen={keyToDelete !== null}onOpenChange={(next) => {- if (!next && !deleteKeyMutation.isPending) {+ if (!next) {setKeyToDelete(null);}}}- >- <DialogContent className="sm:max-w-md">- <DialogHeader>- <DialogTitle>Delete group “{keyToDelete?.key}”?</DialogTitle>- <DialogDescription>- This removes it from {keyToDelete?.workflow_count ?? 0} workflow- {keyToDelete?.workflow_count === 1 ? "" : "s"} and from the group- list. This can’t be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="outline"- onClick={() => setKeyToDelete(null)}- disabled={deleteKeyMutation.isPending}- >- Cancel- </Button>- <Button- variant="destructive"- className="gap-2"- disabled={deleteKeyMutation.isPending}- onClick={() => {- if (!keyToDelete) {- return;- }- const deletedKey = keyToDelete.key;- deleteKeyMutation.mutate(deletedKey, {- onSuccess: () => {- // Drop any active filter term on the now-deleted group, else- // the list refetches with a stale ?tags= and shows empty.- onChange(value.filter((term) => term.key !== deletedKey));- setKeyToDelete(null);- },- });- }}- >- {deleteKeyMutation.isPending ? (- <ReloadIcon className="h-4 w-4 animate-spin" />- ) : null}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title={`Delete group "${keyToDelete?.key ?? ""}"?`}+ description={+ <p>+ This removes it from {keyToDelete?.workflow_count ?? 0} workflow+ {keyToDelete?.workflow_count === 1 ? "" : "s"} and from the group+ list.+ </p>+ }+ contentClassName="sm:max-w-md"+ isPending={deleteKeyMutation.isPending}+ onConfirm={() => {+ if (!keyToDelete) {+ return;+ }+ const deletedKey = keyToDelete.key;+ deleteKeyMutation.mutate(deletedKey, {+ onSuccess: () => {+ // Drop any active filter term on the now-deleted group, else+ // the list refetches with a stale ?tags= and shows empty.+ onChange(value.filter((term) => term.key !== deletedKey));+ setKeyToDelete(null);+ },+ });+ }}+ /></>);}diff --git a/skyvern-frontend/src/routes/workflows/editor/AffectedBlocksNotice.tsx b/skyvern-frontend/src/routes/workflows/editor/AffectedBlocksNotice.tsxnew file mode 100644index 000000000..1d87e18c3--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/editor/AffectedBlocksNotice.tsx@@ -0,0 +1,38 @@+import { type AffectedBlock } from "./jinjaReferences";++function AffectedBlocksNotice({+ affectedBlocks,+}: {+ affectedBlocks: AffectedBlock[];+}) {+ if (affectedBlocks.length === 0) {+ return null;+ }+ return (+ <div className="rounded-md border border-amber-500/50 bg-amber-500/10 p-3">+ <p className="mb-2 font-medium text-amber-500">+ The following blocks reference this item and will be updated:+ </p>+ <ul className="list-inside list-disc space-y-1 text-sm text-slate-300">+ {affectedBlocks.map((block) => (+ <li key={block.nodeId}>+ <span className="font-medium">{block.label}</span>+ <span className="text-slate-400">+ {" "}+ (+ {[+ block.hasParameterKeyReference && "input selector",+ block.hasJinjaReference && "text field",+ ]+ .filter(Boolean)+ .join(", ")}+ )+ </span>+ </li>+ ))}+ </ul>+ </div>+ );+}++export { AffectedBlocksNotice };diff --git a/skyvern-frontend/src/routes/workflows/editor/DeleteWorkflowButton.tsx b/skyvern-frontend/src/routes/workflows/editor/DeleteWorkflowButton.tsxindex d2e4d2540..afd9cc5b1 100644--- a/skyvern-frontend/src/routes/workflows/editor/DeleteWorkflowButton.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/DeleteWorkflowButton.tsx@@ -1,16 +1,7 @@import { getClient } from "@/api/AxiosClient";import { GarbageIcon } from "@/components/icons/GarbageIcon";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import {Tooltip,TooltipContent,@@ -19,9 +10,9 @@ import {} from "@/components/ui/tooltip";import { toast } from "@/components/ui/use-toast";import { useCredentialGetter } from "@/hooks/useCredentialGetter";-import { ReloadIcon } from "@radix-ui/react-icons";import { useMutation, useQueryClient } from "@tanstack/react-query";import { AxiosError } from "axios";+import { useState } from "react";import { useNodeCollapseStore } from "./collapse/useNodeCollapseStore";@@ -32,6 +23,7 @@ type Props = {function DeleteWorkflowButton({ id }: Props) {const credentialGetter = useCredentialGetter();const queryClient = useQueryClient();+ const [open, setOpen] = useState(false);const deleteWorkflowMutation = useMutation({mutationFn: async (id: string) => {@@ -54,43 +46,28 @@ function DeleteWorkflowButton({ id }: Props) {});return (- <Dialog>+ <><TooltipProvider><Tooltip><TooltipTrigger asChild>- <DialogTrigger asChild>- <Button size="icon" variant="outline">- <GarbageIcon className="h-4 w-4" />- </Button>- </DialogTrigger>+ <Button size="icon" variant="outline" onClick={() => setOpen(true)}>+ <GarbageIcon className="h-4 w-4" />+ </Button></TooltipTrigger><TooltipContent>Delete Agent</TooltipContent></Tooltip></TooltipProvider>- <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>- <DialogHeader>- <DialogTitle>Are you sure?</DialogTitle>- <DialogDescription>This agent will be deleted.</DialogDescription>- </DialogHeader>- <DialogFooter>- <DialogClose asChild>- <Button variant="secondary">Cancel</Button>- </DialogClose>- <Button- variant="destructive"- onClick={() => {- deleteWorkflowMutation.mutate(id);- }}- disabled={deleteWorkflowMutation.isPending}- >- {deleteWorkflowMutation.isPending && (- <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />- )}- Delete- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ <ConfirmDialog+ open={open}+ onOpenChange={setOpen}+ title="Delete agent?"+ description={<p>This agent will be permanently deleted.</p>}+ isPending={deleteWorkflowMutation.isPending}+ onConfirm={() => {+ deleteWorkflowMutation.mutate(id);+ }}+ />+ </>);}diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsxindex 942b422a4..32f288cc5 100644--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx@@ -93,7 +93,8 @@ import {DialogTrigger,} from "@/components/ui/dialog";import { toast } from "@/components/ui/use-toast";-import { DeleteConfirmationDialog } from "@/components/DeleteConfirmationDialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";+import { AffectedBlocksNotice } from "./AffectedBlocksNotice";import { BrowserStream } from "@/components/BrowserStream";import { RecordingPanel } from "@/routes/workflows/editor/recording/RecordingPanel";import { useApplyRecordedBlocks } from "@/routes/workflows/editor/recording/useApplyRecordedBlocks";@@ -3076,7 +3077,7 @@ function Workspace({}}}/>- <DeleteConfirmationDialog+ <ConfirmDialogopen={deleteBlockDialogState.open}onOpenChange={(open) => {if (!open) {@@ -3088,9 +3089,9 @@ function Workspace({});}}}- title="Delete Block"- description={`Are you sure you want to delete "${deleteBlockDialogState.nodeLabel}"?`}- affectedBlocks={affectedBlocksForDelete}+ title={`Delete block "${deleteBlockDialogState.nodeLabel}"?`}+ description="This block will be deleted from the agent."+ reversibleonConfirm={() => {if (deleteConfirmCallbackRef.current) {deleteConfirmCallbackRef.current();@@ -3102,7 +3103,9 @@ function Workspace({nodeLabel: null,});}}- />+ >+ <AffectedBlocksNotice affectedBlocks={affectedBlocksForDelete} />+ </ConfirmDialog>{/* Studio: the cache key/value panel escapes the Editor pane via theshell-level portal, so the Overview pane's Code view can open it (anddiff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParametersPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParametersPanel.tsxindex b2a9f701c..5533761b6 100644--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParametersPanel.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParametersPanel.tsx@@ -25,7 +25,8 @@ import {removeKeyFromNodesParameterKeys,replaceJinjaReferenceInNodes,} from "../workflowEditorUtils";-import { DeleteConfirmationDialog } from "@/components/DeleteConfirmationDialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";+import { AffectedBlocksNotice } from "../AffectedBlocksNotice";import { AppNode } from "../nodes";const WORKFLOW_EDIT_PANEL_WIDTH = 20 * 16;@@ -196,22 +197,24 @@ function WorkflowParametersPanel({ onMouseDownCapture }: Props) {</ScrollAreaViewport></ScrollArea></div>- <DeleteConfirmationDialog+ <ConfirmDialogopen={deleteDialogState.open}onOpenChange={(open) => {if (!open) {setDeleteDialogState({ open: false, parameterKey: null });}}}- title="Delete Input"- description={`Are you sure you want to delete "${deleteDialogState.parameterKey}"?`}- affectedBlocks={affectedBlocksForDelete}+ title={`Delete input "${deleteDialogState.parameterKey}"?`}+ description="This input will be deleted from the agent."+ reversibleonConfirm={() => {if (deleteDialogState.parameterKey) {handleDeleteParameter(deleteDialogState.parameterKey);}}}- />+ >+ <AffectedBlocksNotice affectedBlocks={affectedBlocksForDelete} />+ </ConfirmDialog>{operationPanelState.active && (<divclassName="absolute"diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/schedulePanel/WorkflowSchedulePanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/schedulePanel/WorkflowSchedulePanel.tsxindex 9715b4a5a..afc75dc38 100644--- a/skyvern-frontend/src/routes/workflows/editor/panels/schedulePanel/WorkflowSchedulePanel.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/panels/schedulePanel/WorkflowSchedulePanel.tsx@@ -1,13 +1,6 @@import { ScrollArea, ScrollAreaViewport } from "@/components/ui/scroll-area";import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";+import { ConfirmDialog } from "@/components/ui/confirm-dialog";import { useWorkflowSchedulesQuery } from "@/routes/workflows/hooks/useWorkflowSchedulesQuery";import {useCreateScheduleMutation,@@ -148,42 +141,18 @@ function WorkflowSchedulePanel({ onClose }: Props) {</ScrollAreaViewport></ScrollArea>- <Dialog+ <ConfirmDialogopen={deleteDialogState.open}onOpenChange={(open) => {- if (!open && !deleteSchedule.isPending) {+ if (!open) {setDeleteDialogState({ open: false, scheduleId: null });}}}- >- <DialogContent>- <DialogHeader>- <DialogTitle>Delete Schedule</DialogTitle>- <DialogDescription>- Are you sure you want to delete this schedule? This action cannot- be undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="secondary"- disabled={deleteSchedule.isPending}- onClick={() =>- setDeleteDialogState({ open: false, scheduleId: null })- }- >- Cancel- </Button>- <Button- variant="destructive"- disabled={deleteSchedule.isPending}- onClick={handleDeleteConfirm}- >- {deleteSchedule.isPending ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ title="Delete schedule?"+ description={<p>This schedule will be permanently deleted.</p>}+ isPending={deleteSchedule.isPending}+ onConfirm={handleDeleteConfirm}+ /></div>);}