()
| 376 | } |
| 377 | |
| 378 | export function NetworkPanel() { |
| 379 | const { events, selectedNodeId } = useExecutionTimelineStore(); |
| 380 | const [selectedRequestId, setSelectedRequestId] = useState<string | null>(null); |
| 381 | const [expandedHosts, setExpandedHosts] = useState<Set<string>>(new Set()); |
| 382 | |
| 383 | // Resizable pane state |
| 384 | const [leftPaneWidth, setLeftPaneWidth] = useState<number | null>(null); // null = 50%, number = pixels |
| 385 | const containerRef = useRef<HTMLDivElement>(null); |
| 386 | const isResizing = useRef(false); |
| 387 | |
| 388 | // Build network requests from HTTP events |
| 389 | const networkRequests = useMemo(() => { |
| 390 | const requestMap = new Map<string, NetworkRequest>(); |
| 391 | |
| 392 | // Filter to HTTP events only |
| 393 | const httpEvents = events.filter( |
| 394 | (e) => |
| 395 | e.type === 'HTTP_REQUEST_SENT' || |
| 396 | e.type === 'HTTP_RESPONSE_RECEIVED' || |
| 397 | e.type === 'HTTP_REQUEST_ERROR', |
| 398 | ); |
| 399 | |
| 400 | // Group by correlation ID |
| 401 | for (const event of httpEvents) { |
| 402 | const data = event.data as HttpEventData | undefined; |
| 403 | if (!data?.correlationId) continue; |
| 404 | |
| 405 | const correlationId = data.correlationId; |
| 406 | const existing = requestMap.get(correlationId); |
| 407 | |
| 408 | if (event.type === 'HTTP_REQUEST_SENT' && data.request) { |
| 409 | requestMap.set(correlationId, { |
| 410 | id: event.id, |
| 411 | correlationId, |
| 412 | nodeId: event.nodeId, |
| 413 | method: data.request.method, |
| 414 | url: data.request.url, |
| 415 | startTime: event.timestamp, |
| 416 | request: data.request, |
| 417 | ...existing, |
| 418 | }); |
| 419 | } else if (event.type === 'HTTP_RESPONSE_RECEIVED' && data.har) { |
| 420 | const existingOrNew = existing || { |
| 421 | id: event.id, |
| 422 | correlationId, |
| 423 | nodeId: event.nodeId, |
| 424 | method: data.har.request.method, |
| 425 | url: data.har.request.url, |
| 426 | startTime: data.har.startedDateTime, |
| 427 | }; |
| 428 | requestMap.set(correlationId, { |
| 429 | ...existingOrNew, |
| 430 | status: data.har.response.status, |
| 431 | statusText: data.har.response.statusText, |
| 432 | duration: data.har.time, |
| 433 | request: data.har.request, |
| 434 | response: data.har.response, |
| 435 | timings: data.har.timings, |
nothing calls this directly
no test coverage detected