diff --git a/apps/web/src/app/[locale]/page.tsx b/apps/web/src/app/[locale]/page.tsx index 35dc1db8..c980b3f0 100644 --- a/apps/web/src/app/[locale]/page.tsx +++ b/apps/web/src/app/[locale]/page.tsx @@ -300,23 +300,28 @@ function DispositionTab() { {/* By Anomaly Top 5 */} {Array.isArray(data?.by_anomaly) && data.by_anomaly.length > 0 && (() => { - const top5 = [...data.by_anomaly].sort((a: any, b: any) => b.count - a.count).slice(0, 5) - const maxCount = top5[0]?.count || 1 + const top5 = [...data.by_anomaly] + .sort((a: any, b: any) => (b.disposition?.total ?? 0) - (a.disposition?.total ?? 0)) + .slice(0, 5) + const maxCount = top5[0]?.disposition?.total || 1 return (
{t('byAnomalyTitle')}
{top5.map((item: any, i: number) => { - const autoRate = item.count > 0 ? Math.round((item.auto_repair ?? 0) / item.count * 100) : 0 + const disp = item.disposition ?? {} + const count = disp.total ?? 0 + const autoRate = Math.round((disp.auto_rate ?? 0) * 100) + const label = item.alert_name || item.anomaly_key || '--' return (
- {item.anomaly_type || item.type || '--'} + {label} - {item.count} · {t('byAnomalyAutoRate', { pct: autoRate })} + {count} · {t('byAnomalyAutoRate', { pct: autoRate })}
-
= 80 ? '#22C55E' : autoRate >= 50 ? '#F59E0B' : '#cc2200', borderRadius: 3, transition: 'width 0.4s ease' }} /> +
= 80 ? '#22C55E' : autoRate >= 50 ? '#F59E0B' : '#cc2200', borderRadius: 3, transition: 'width 0.4s ease' }} />
)