diff --git a/ui/src/pages/AgentHealth/AgentHealth.tsx b/ui/src/pages/AgentHealth/AgentHealth.tsx index ed13241a..eaa81582 100644 --- a/ui/src/pages/AgentHealth/AgentHealth.tsx +++ b/ui/src/pages/AgentHealth/AgentHealth.tsx @@ -5,6 +5,7 @@ import { StatCard, StatusDot, Badge, MonoText, GroupCard, DataTable, EventFeed, LogViewer, ButtonGroup, SectionHeader, Toggle, Select, Button, useToast, + Alert, ConfirmDialog, } from '@cameleer/design-system'; import type { Column, FeedEvent, LogEntry, ButtonGroupItem } from '@cameleer/design-system'; import styles from './AgentHealth.module.css'; @@ -111,6 +112,7 @@ export default function AgentHealth() { const dismissApp = useDismissApp(); const catalogEntry = catalogApps?.find((a) => a.slug === appId); + const [confirmDismissOpen, setConfirmDismissOpen] = useState(false); const [configEditing, setConfigEditing] = useState(false); const [configDraft, setConfigDraft] = useState>({}); @@ -292,6 +294,46 @@ export default function AgentHealth() { return (
+ {/* No agents warning + dismiss — shown when app-scoped, no agents, admin */} + {appId && agentList.length === 0 && isAdmin && ( + <> + + + {catalogEntry?.managed ? 'Managed app' : 'Discovered app'} — {(catalogEntry?.exchangeCount ?? 0).toLocaleString()} exchanges recorded. + {' '}You can dismiss this application to remove it and all associated data. + +
+ +
+
+ setConfirmDismissOpen(false)} + onConfirm={() => { + setConfirmDismissOpen(false); + dismissApp.mutate(appId, { + onSuccess: () => { + toast({ title: 'Application dismissed', description: `${appId} and all associated data have been deleted`, variant: 'success' }); + navigate('/runtime'); + }, + onError: (err) => { + toast({ title: 'Dismiss failed', description: err.message, variant: 'error', duration: 86_400_000 }); + }, + }); + }} + title="Dismiss Application" + message={`This will permanently delete "${appId}" and all associated data (${(catalogEntry?.exchangeCount ?? 0).toLocaleString()} exchanges, logs, diagrams).`} + confirmText="This action cannot be undone." + confirmLabel="Dismiss" + variant="danger" + loading={dismissApp.isPending} + /> + + )} + {/* Stat strip */}
)} - {/* Dismiss application card — shown when app-scoped, no agents, admin */} - {appId && agentList.length === 0 && isAdmin && ( -
-
-
- No agents connected - {catalogEntry && ( - - {catalogEntry.managed ? 'Managed app' : 'Discovered app'} — {catalogEntry.exchangeCount.toLocaleString()} exchanges recorded - - )} -
- -
-
- )} {/* Group cards grid */}