'use client'; import type { NetworkMetrics } from '@/types/metrics'; import { formatTimestamp, formatBytesPerSec } from '@/lib/formatters'; interface NetworkAlertPanelProps { data: NetworkMetrics; height?: number; } interface Alert { level: 'warning' | 'critical'; instance: string; message: string; } export default function NetworkAlertPanel({ data, height = 300 }: NetworkAlertPanelProps) { const alerts: Alert[] = []; [...data.receive, ...data.transmit].forEach((inst) => { const direction = data.receive.includes(inst) ? 'RX' : 'TX'; const label = `${direction} ${inst.instance || 'total'}`; inst.peaks.peaks.forEach((peak) => { alerts.push({ level: 'warning', instance: label, message: `${formatTimestamp(peak.startTime)} ~ ${formatTimestamp(peak.endTime)} 트래픽 급증 (max: ${formatBytesPerSec(peak.maxValue)})`, }); }); }); if (alerts.length === 0) { return (

특이사항 없음

); } return (

주의 구간 ({alerts.length}건)

); }