From da32935d63b35370ff984bbc9c997632083153ea Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:10:10 +0000 Subject: [PATCH] Add debugging for Resolve on monitoring page Enhance PipelineHealthAlerts flow to log and refresh - Add console logs when resolving alerts on PipelineHealthAlerts - Invalidate related queries to refresh UI after resolution - Improve error handling and user feedback paths for resolve action --- src/components/admin/PipelineHealthAlerts.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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() }); } };