import { useState } from 'react'; import { AlertTriangle, Camera } from 'lucide-react'; import { Modal, ModalDestructiveHeader, ModalBody, ModalFooter } from '@/components/ui/modal'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; interface EvictionDialogProps { open: boolean; onOpenChange: (open: boolean) => void; blueprintName: string; nodeName: string; isStateful: boolean; busy: boolean; onConfirm: (mode: 'standard' | 'snapshot_then_evict' | 'evict_and_destroy') => void; } export function EvictionDialog({ open, onOpenChange, blueprintName, nodeName, isStateful, busy, onConfirm, }: EvictionDialogProps) { const [confirmText, setConfirmText] = useState(''); const destructiveDisabled = isStateful && confirmText.trim() !== blueprintName; function reset() { setConfirmText(''); } return ( { if (!o) reset(); onOpenChange(o); }} size="lg" >

{isStateful ? 'This blueprint is stateful. Choose how to handle its data on this node.' : 'Sencho will run docker compose down and remove the blueprint directory on this node.'}

{isStateful && (

Named volumes or bind mounts were detected. Evicting destroys the named volumes managed by this stack on{' '} {nodeName}. Bind mounts on the host filesystem are left in place.

Evict and destroy data

Type {blueprintName} to confirm.

setConfirmText(e.target.value)} placeholder={blueprintName} className="font-mono text-xs" disabled={busy} />
)}
onOpenChange(false)} disabled={busy}> Cancel } primary={ isStateful ? ( ) : ( ) } />
); }