import React from "react" import { AlertTriangle, Trash2 } from "lucide-react" import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog" import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion" import { Button } from "@/components/ui/button" import { Separator } from "@/components/ui/separator" import type { JobStatus } from "@shared/types" import { ALL_JOB_STATUSES, STATUS_DESCRIPTIONS } from "@client/pages/settings/constants" type DangerZoneSectionProps = { statusesToClear: JobStatus[] toggleStatusToClear: (status: JobStatus) => void handleClearByStatuses: () => void handleClearDatabase: () => void isLoading: boolean isSaving: boolean } export const DangerZoneSection: React.FC = ({ statusesToClear, toggleStatusToClear, handleClearByStatuses, handleClearDatabase, isLoading, isSaving, }) => { return (
Danger Zone
Clear Jobs by Status
Select which job statuses you want to clear.
{ALL_JOB_STATUSES.map((status) => { const isSelected = statusesToClear.includes(status) return ( ) })}
Clear jobs by status? This will delete all jobs with the following statuses: {statusesToClear.join(', ')}. This action cannot be undone. Cancel Clear {statusesToClear.length} status{statusesToClear.length !== 1 ? 'es' : ''}
Clear Entire Database
Delete all jobs and pipeline runs from the database.
Clear all jobs? This deletes all jobs and pipeline runs from the database. This action cannot be undone. Cancel Clear database
) }