mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 11:11:14 -05:00
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
This commit is contained in:
@@ -13,6 +13,8 @@ import { AlertTriangle, CheckCircle, XCircle, AlertCircle } from 'lucide-react';
|
|||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { supabase } from '@/lib/supabaseClient';
|
import { supabase } from '@/lib/supabaseClient';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { queryKeys } from '@/lib/queryKeys';
|
||||||
|
|
||||||
const SEVERITY_CONFIG = {
|
const SEVERITY_CONFIG = {
|
||||||
critical: { color: 'destructive', icon: XCircle },
|
critical: { color: 'destructive', icon: XCircle },
|
||||||
@@ -38,6 +40,7 @@ const ALERT_TYPE_LABELS: Record<string, string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function PipelineHealthAlerts() {
|
export function PipelineHealthAlerts() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
const { data: criticalAlerts } = useSystemAlerts('critical');
|
const { data: criticalAlerts } = useSystemAlerts('critical');
|
||||||
const { data: highAlerts } = useSystemAlerts('high');
|
const { data: highAlerts } = useSystemAlerts('high');
|
||||||
const { data: mediumAlerts } = useSystemAlerts('medium');
|
const { data: mediumAlerts } = useSystemAlerts('medium');
|
||||||
@@ -49,15 +52,23 @@ export function PipelineHealthAlerts() {
|
|||||||
].slice(0, 10);
|
].slice(0, 10);
|
||||||
|
|
||||||
const resolveAlert = async (alertId: string) => {
|
const resolveAlert = async (alertId: string) => {
|
||||||
|
console.log('🔴 Resolve button clicked in PipelineHealthAlerts', { alertId });
|
||||||
|
|
||||||
const { error } = await supabase
|
const { error } = await supabase
|
||||||
.from('system_alerts')
|
.from('system_alerts')
|
||||||
.update({ resolved_at: new Date().toISOString() })
|
.update({ resolved_at: new Date().toISOString() })
|
||||||
.eq('id', alertId);
|
.eq('id', alertId);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
console.error('❌ Error resolving alert:', error);
|
||||||
toast.error('Failed to resolve alert');
|
toast.error('Failed to resolve alert');
|
||||||
} else {
|
} else {
|
||||||
|
console.log('✅ Alert resolved successfully');
|
||||||
toast.success('Alert resolved');
|
toast.success('Alert resolved');
|
||||||
|
|
||||||
|
// Invalidate queries to refresh the UI
|
||||||
|
queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemAlerts() });
|
||||||
|
queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemHealth() });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user