import React from "react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { api } from "@/utils/api"; import { TrashIcon } from "lucide-react"; import { toast } from "sonner"; import { DropdownMenuItem } from "@/components/ui/dropdown-menu"; interface Props { nodeId: string; } export const DeleteWorker = ({ nodeId }: Props) => { const { mutateAsync, isLoading } = api.cluster.removeWorker.useMutation(); const utils = api.useUtils(); return ( e.preventDefault()}> Delete Are you absolutely sure? This action cannot be undone. This will permanently delete the worker. Cancel { await mutateAsync({ nodeId, }) .then(async () => { utils.cluster.getNodes.invalidate(); toast.success("Worker deleted succesfully"); }) .catch(() => { toast.error("Error to delete the worker"); }); }} > Confirm ); };