diff --git a/src/components/admin/PipelineHealthAlerts.tsx b/src/components/admin/PipelineHealthAlerts.tsx index 15b60258..d01e24ef 100644 --- a/src/components/admin/PipelineHealthAlerts.tsx +++ b/src/components/admin/PipelineHealthAlerts.tsx @@ -13,6 +13,8 @@ import { AlertTriangle, CheckCircle, XCircle, AlertCircle } from 'lucide-react'; import { format } from 'date-fns'; import { supabase } from '@/lib/supabaseClient'; import { toast } from 'sonner'; +import { useQueryClient } from '@tanstack/react-query'; +import { queryKeys } from '@/lib/queryKeys'; const SEVERITY_CONFIG = { critical: { color: 'destructive', icon: XCircle }, @@ -38,6 +40,7 @@ const ALERT_TYPE_LABELS: Record = { }; export function PipelineHealthAlerts() { + const queryClient = useQueryClient(); const { data: criticalAlerts } = useSystemAlerts('critical'); const { data: highAlerts } = useSystemAlerts('high'); const { data: mediumAlerts } = useSystemAlerts('medium'); @@ -49,15 +52,23 @@ export function PipelineHealthAlerts() { ].slice(0, 10); const resolveAlert = async (alertId: string) => { + console.log('🔴 Resolve button clicked in PipelineHealthAlerts', { alertId }); + const { error } = await supabase .from('system_alerts') .update({ resolved_at: new Date().toISOString() }) .eq('id', alertId); if (error) { + console.error('❌ Error resolving alert:', error); toast.error('Failed to resolve alert'); } else { + console.log('✅ Alert resolved successfully'); toast.success('Alert resolved'); + + // Invalidate queries to refresh the UI + queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemAlerts() }); + queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemHealth() }); } };