diff --git a/frontend/src/components/settings/LabelsSection.tsx b/frontend/src/components/settings/LabelsSection.tsx index a6780cd4..1e8ad5b1 100644 --- a/frontend/src/components/settings/LabelsSection.tsx +++ b/frontend/src/components/settings/LabelsSection.tsx @@ -2,23 +2,7 @@ import { useState, useEffect, useCallback } from 'react'; import { Plus, Pencil, Trash2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from '@/components/ui/alert-dialog'; -import { - Dialog, - DialogContent, - DialogTitle, - DialogDescription, -} from '@/components/ui/dialog'; -import { VisuallyHidden } from '@radix-ui/react-visually-hidden'; +import { Modal, ModalHeader, ModalBody, ModalFooter, ConfirmModal } from '@/components/ui/modal'; import { apiFetch } from '@/lib/api'; import { toast } from '@/components/ui/toast-store'; import { SENCHO_LABELS_CHANGED } from '@/lib/events'; @@ -132,12 +116,13 @@ export function LabelsSection({ onLabelsChanged }: LabelsSectionProps = {}) { throw new Error(data?.error || 'Failed to delete label.'); } toast.success('Label deleted.'); - setDeleteTarget(null); fetchLabels(); onLabelsChanged?.(); window.dispatchEvent(new Event(SENCHO_LABELS_CHANGED)); } catch (err: unknown) { toast.error((err as Error)?.message || 'Something went wrong.'); + } finally { + setDeleteTarget(null); } }; @@ -193,65 +178,66 @@ export function LabelsSection({ onLabelsChanged }: LabelsSectionProps = {}) { - {/* Create / Edit Dialog */} - - - {editingLabel ? 'Edit Label' : 'Create Label'} - Manage label properties -
- setFormName(e.target.value)} - className="font-mono" - maxLength={30} - autoFocus - onKeyDown={e => { if (e.key === 'Enter') handleSave(); }} - /> -
-
Color
-
- {LABEL_COLORS.map(c => ( -
-
-
- - + {/* Create / Edit Modal */} + + + + setFormName(e.target.value)} + className="font-mono" + maxLength={30} + autoFocus + onKeyDown={e => { if (e.key === 'Enter') handleSave(); }} + /> +
+
Color
+
+ {LABEL_COLORS.map(c => ( +
- -
+ + setDialogOpen(false)} disabled={saving}> + Cancel + + } + primary={ + + } + /> + {/* Delete Confirmation */} - !open && setDeleteTarget(null)}> - - - Delete label “{deleteTarget?.name}”? - - This will remove the label from all stacks. This action cannot be undone. - - - - Cancel - - Delete - - - - + !open && setDeleteTarget(null)} + variant="destructive" + kicker="LABELS · DELETE · IRREVERSIBLE" + title={`Delete label "${deleteTarget?.name ?? ''}"`} + confirmLabel="Delete" + onConfirm={handleDelete} + > +

+ Removes the label from every stack across the fleet. +

+
); diff --git a/frontend/src/components/settings/SuppressionsPanel.tsx b/frontend/src/components/settings/SuppressionsPanel.tsx index 15dedf26..b961d9bd 100644 --- a/frontend/src/components/settings/SuppressionsPanel.tsx +++ b/frontend/src/components/settings/SuppressionsPanel.tsx @@ -5,24 +5,7 @@ import { Label } from '@/components/ui/label'; import { Badge } from '@/components/ui/badge'; import { Skeleton } from '@/components/ui/skeleton'; import { ScrollArea } from '@/components/ui/scroll-area'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from '@/components/ui/alert-dialog'; +import { Modal, ModalHeader, ModalBody, ModalFooter, ConfirmModal } from '@/components/ui/modal'; import { ChevronLeft, ChevronRight, Plus, ShieldOff, Trash2 } from 'lucide-react'; import { toast } from '@/components/ui/toast-store'; import { apiFetch } from '@/lib/api'; @@ -273,94 +256,89 @@ export function SuppressionsPanel({ isReplica }: SuppressionsPanelProps) { )} - - - - New Suppression - - Accept a CVE as known-benign so it stops triggering alerts across the fleet. - - -
-
- - setForm({ ...form, cveId: e.target.value })} - /> -
-
- - setForm({ ...form, pkgName: e.target.value })} - /> -
-
- - setForm({ ...form, imagePattern: e.target.value })} - /> -
-
- -