From 993ab98f31881cca4c27106e4f07869a1e8e1ab2 Mon Sep 17 00:00:00 2001 From: Anso Date: Mon, 4 May 2026 13:16:02 -0400 Subject: [PATCH] refactor(frontend): migrate PolicyBlockDialog, StateReviewDialog, EvictionDialog to Modal chrome (D-6) (#910) * refactor(frontend): migrate PolicyBlockDialog to Modal chrome (D-6) * refactor(frontend): migrate StateReviewDialog to Modal chrome (D-6) * refactor(frontend): migrate EvictionDialog to Modal chrome (D-6) --- .../components/blueprints/EvictionDialog.tsx | 72 ++++++++++--------- .../blueprints/StateReviewDialog.tsx | 44 +++++------- .../components/stack/PolicyBlockDialog.tsx | 69 +++++++++--------- 3 files changed, 94 insertions(+), 91 deletions(-) diff --git a/frontend/src/components/blueprints/EvictionDialog.tsx b/frontend/src/components/blueprints/EvictionDialog.tsx index 0e52ccd3..b5d672a0 100644 --- a/frontend/src/components/blueprints/EvictionDialog.tsx +++ b/frontend/src/components/blueprints/EvictionDialog.tsx @@ -1,8 +1,6 @@ import { useState } from 'react'; import { AlertTriangle, Camera } from 'lucide-react'; -import { - Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription, -} from '@/components/ui/dialog'; +import { Modal, ModalDestructiveHeader, ModalBody, ModalFooter } from '@/components/ui/modal'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; @@ -27,32 +25,35 @@ export function EvictionDialog({ } return ( - { if (!o) reset(); onOpenChange(o); }}> - - -
- - Withdraw deployment -
- - Stop {blueprintName} on {nodeName} - - - {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.'} - -
- + { 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. + 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 @@ -85,14 +85,18 @@ export function EvictionDialog({
)} - - - - {isStateful ? ( + } + primary={ + isStateful ? ( ) : ( - - )} - - -
+ ) + } + /> + ); } diff --git a/frontend/src/components/blueprints/StateReviewDialog.tsx b/frontend/src/components/blueprints/StateReviewDialog.tsx index 2c20cb1a..bb9968c7 100644 --- a/frontend/src/components/blueprints/StateReviewDialog.tsx +++ b/frontend/src/components/blueprints/StateReviewDialog.tsx @@ -1,7 +1,5 @@ import { Database, Play } from 'lucide-react'; -import { - Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription, -} from '@/components/ui/dialog'; +import { Modal, ModalHeader, ModalBody, ModalFooter } from '@/components/ui/modal'; import { Button } from '@/components/ui/button'; interface StateReviewDialogProps { @@ -17,21 +15,17 @@ export function StateReviewDialog({ open, onOpenChange, blueprintName, nodeName, busy, onAccept, }: StateReviewDialogProps) { return ( - - - -
- - Confirm first deploy -
- - Deploy {blueprintName} to {nodeName}? - - - This blueprint is stateful and has never run on this node. Sencho will create empty volumes unless you choose to restore from a prior snapshot. - -
- + + + +

+ This blueprint is stateful and has never run on this node. Sencho will create + empty volumes unless you choose to restore from a prior snapshot. +

-
- - - - -
-
+ } + /> + ); } diff --git a/frontend/src/components/stack/PolicyBlockDialog.tsx b/frontend/src/components/stack/PolicyBlockDialog.tsx index d6a428aa..15df590e 100644 --- a/frontend/src/components/stack/PolicyBlockDialog.tsx +++ b/frontend/src/components/stack/PolicyBlockDialog.tsx @@ -1,14 +1,9 @@ -import { ShieldAlert } from 'lucide-react'; import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from '@/components/ui/alert-dialog'; + Modal, + ModalDestructiveHeader, + ModalBody, + ModalFooter, +} from '@/components/ui/modal'; import { Button } from '@/components/ui/button'; import { SeverityChip } from '@/components/VulnerabilityScanSheet'; import type { VulnSeverity } from '@/types/security'; @@ -58,21 +53,19 @@ export function PolicyBlockDialog({ const violations = payload?.violations ?? []; return ( - { if (!next) onClose(); }}> - - -
- - Policy block · {stackName} -
- Deploy blocked by security policy - - Policy {policyName} blocks deploys - when any image meets or exceeds {maxSeverity}. - The following {violations.length === 1 ? 'image' : `${violations.length} images`} triggered the block. - -
- + { if (!next) onClose(); }} size="xl"> + + +

+ Policy {policyName} blocks deploys + when any image meets or exceeds{' '} + {maxSeverity}.{' '} + The following {violations.length === 1 ? 'image' : `${violations.length} images`} triggered the block. +

{violations.length === 0 ? (
@@ -92,12 +85,18 @@ export function PolicyBlockDialog({ )) )}
- - - Close - {canBypass ? ( + + + Close + + } + primary={ + canBypass ? ( ) : ( - Admin required to bypass - )} - - - + + ) + } + /> + ); }