MCPcopy Create free account
hub / github.com/ShipSecAI/studio / NetworkPanel

Function NetworkPanel

frontend/src/components/timeline/NetworkPanel.tsx:378–669  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

376}
377
378export 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,

Callers

nothing calls this directly

Calls 12

cnFunction · 0.90
parseUrlFunction · 0.85
toggleHostFunction · 0.85
fromMethod · 0.80
hasMethod · 0.80
getStatusColorFunction · 0.70
formatDurationFunction · 0.70
getMethod · 0.65
pushMethod · 0.65
setMethod · 0.45
addEventListenerMethod · 0.45
removeEventListenerMethod · 0.45

Tested by

no test coverage detected