import { useParams } from 'common' import { useState } from 'react' import { toast } from 'sonner' import { AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from 'ui' import { Admonition } from 'ui-patterns/admonition' import { useDeleteReplicationTenantMutation } from '@/data/replication/delete-tenant-mutation' interface DisablePipelinesDialogProps { open: boolean setOpen: (value: boolean) => void } export const DisablePipelinesDialog = ({ open, setOpen }: DisablePipelinesDialogProps) => { const { ref: projectRef } = useParams() const [error, setError] = useState(null) const { mutateAsync: deleteReplicationTenant, isPending: isSubmitting } = useDeleteReplicationTenantMutation({ onSuccess: () => { toast.success('Pipelines has been disabled') setOpen(false) }, onError: () => {}, }) const onConfirm = async () => { setError(null) try { if (!projectRef) throw new Error('Project ref is required') await deleteReplicationTenant({ projectRef }) } catch (error: any) { setError(error.message ?? 'An unknown error occurred') throw error } } return ( !isSubmitting && setOpen(open)}> Disable Pipelines

This will remove the etl schema and all connected resources from your database. Any active replication pipelines sending changes to external destinations will stop.

Read replicas are not affected.

{error && ( )} Cancel Disable
) }