import { Ban } from "lucide-react"; import { toast } from "sonner"; 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"; interface Props { id: string; type: "application" | "compose"; } export const CancelQueues = ({ id, type }: Props) => { const { mutateAsync, isPending } = type === "application" ? api.application.cleanQueues.useMutation() : api.compose.cleanQueues.useMutation(); const { data: isCloud } = api.settings.isCloud.useQuery(); if (isCloud) { return null; } return ( Are you sure to cancel the incoming deployments? This will cancel all the incoming deployments Cancel { await mutateAsync({ applicationId: id || "", composeId: id || "", }) .then(() => { toast.success("Queues are being cleaned"); }) .catch((err) => { toast.error(err.message); }); }} > Confirm ); };