@localstack/appinspector-ui 1.0.71 → 1.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -367,7 +367,7 @@ var init_event_streams = __esm({
367
367
 
368
368
  // src/pages/spans-list-page.tsx
369
369
  import { Box as Box19 } from "@mui/material";
370
- import { useCallback as useCallback9, useState as useState14 } from "react";
370
+ import { useCallback as useCallback9, useState as useState13 } from "react";
371
371
 
372
372
  // src/components/spans-list/spans-list.tsx
373
373
  import { Alert, Box as Box4, Button as Button2 } from "@mui/material";
@@ -13846,7 +13846,7 @@ import { ArrowBack } from "@mui/icons-material";
13846
13846
  import { Box as Box18, Button as Button5, Drawer, Paper as Paper2 } from "@mui/material";
13847
13847
  import { styled } from "@mui/material/styles";
13848
13848
  import { ReactFlowProvider } from "@xyflow/react";
13849
- import { useCallback as useCallback8, useEffect as useEffect18, useRef as useRef13, useState as useState13 } from "react";
13849
+ import { useCallback as useCallback8, useEffect as useEffect18, useRef as useRef13, useState as useState12 } from "react";
13850
13850
 
13851
13851
  // src/components/event-details/event-details.tsx
13852
13852
  import { Box as Box14, Chip as Chip3, Divider as Divider2, Stack as Stack2, Typography as Typography10 } from "@mui/material";
@@ -24499,8 +24499,8 @@ function renderKeyValue(key, value) {
24499
24499
  // src/components/trace-graph/trace-graph.tsx
24500
24500
  import "@xyflow/react/dist/base.css";
24501
24501
  import { Alert as Alert3, Button as Button4, useTheme as useTheme3 } from "@mui/material";
24502
- import { Background, ReactFlow, useNodesState } from "@xyflow/react";
24503
- import { useEffect as useEffect17, useState as useState12 } from "react";
24502
+ import { Background, MarkerType, Position as Position2, ReactFlow, useEdgesState, useNodesState } from "@xyflow/react";
24503
+ import { useEffect as useEffect17 } from "react";
24504
24504
 
24505
24505
  // src/components/trace-graph/service-node.tsx
24506
24506
  import { Box as Box16, Stack as Stack3, Typography as Typography11 } from "@mui/material";
@@ -24651,56 +24651,6 @@ var ServiceNode = memo9(({ data, selected }) => {
24651
24651
 
24652
24652
  // src/components/trace-graph/utils.ts
24653
24653
  import dagre from "@dagrejs/dagre";
24654
- import { MarkerType, Position as Position2 } from "@xyflow/react";
24655
- var generateNodesAndEdges = (event, parentId) => {
24656
- const nodes = [];
24657
- const edges = [];
24658
- nodes.push({
24659
- data: {
24660
- data: { [event.span_id]: event },
24661
- event,
24662
- height: 28,
24663
- id: event.span_id,
24664
- position: { x: 0, y: 0 },
24665
- width: 28
24666
- },
24667
- id: event.span_id,
24668
- position: { x: 0, y: 0 },
24669
- // Will be set by layout
24670
- sourcePosition: Position2.Right,
24671
- targetPosition: Position2.Left,
24672
- type: "service"
24673
- });
24674
- if (parentId) {
24675
- edges.push({
24676
- animated: false,
24677
- id: `e-${parentId}-${event.span_id}`,
24678
- markerEnd: {
24679
- color: "lightgray",
24680
- height: 16,
24681
- type: MarkerType.Arrow,
24682
- width: 16
24683
- },
24684
- source: parentId,
24685
- style: {
24686
- stroke: "lightgray",
24687
- strokeWidth: 1
24688
- },
24689
- target: event.span_id
24690
- });
24691
- }
24692
- if (event.children && event.children.length > 0) {
24693
- for (const child of event.children) {
24694
- const { edges: childEdges, nodes: childNodes } = generateNodesAndEdges(
24695
- child,
24696
- event.span_id
24697
- );
24698
- nodes.push(...childNodes);
24699
- edges.push(...childEdges);
24700
- }
24701
- }
24702
- return { edges, nodes };
24703
- };
24704
24654
  var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
24705
24655
  const dagreGraph = new dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
24706
24656
  const direction = "LR";
@@ -24851,40 +24801,48 @@ var TraceGraph = ({
24851
24801
  spans
24852
24802
  }) => {
24853
24803
  const [nodes, setNodes, onNodesChange] = useNodesState([]);
24854
- const [edges, setEdges] = useState12([]);
24804
+ const [edges, setEdges] = useEdgesState([]);
24855
24805
  useEffect17(() => {
24856
- const spansMap = /* @__PURE__ */ new Map();
24857
- const rootSpans = [];
24806
+ const allNodes = [];
24807
+ const allEdges = [];
24858
24808
  for (const span of spans.data ?? []) {
24859
- spansMap.set(span.span_id, { ...span, children: [] });
24860
- }
24861
- for (const span of spans.data ?? []) {
24862
- const currentSpan = spansMap.get(span.span_id);
24863
- if (!currentSpan) continue;
24864
- if (span.parent_span_id && spansMap.has(span.parent_span_id)) {
24865
- const parentSpan = spansMap.get(span.parent_span_id);
24866
- if (parentSpan) {
24867
- parentSpan.children ??= [];
24868
- parentSpan.children.push(currentSpan);
24869
- }
24870
- } else {
24871
- rootSpans.push(currentSpan);
24809
+ allNodes.push({
24810
+ data: {
24811
+ data: { [span.span_id]: span },
24812
+ event: span,
24813
+ height: 28,
24814
+ id: span.span_id,
24815
+ position: { x: 0, y: 0 },
24816
+ width: 28
24817
+ },
24818
+ id: span.span_id,
24819
+ position: { x: 0, y: 0 },
24820
+ sourcePosition: Position2.Right,
24821
+ targetPosition: Position2.Left,
24822
+ type: "service"
24823
+ });
24824
+ if (span.parent_span_id !== null) {
24825
+ allEdges.push({
24826
+ animated: false,
24827
+ id: `e-${span.parent_span_id}-${span.span_id}`,
24828
+ markerEnd: { color: "lightgray", height: 16, type: MarkerType.Arrow, width: 16 },
24829
+ source: span.parent_span_id,
24830
+ style: { stroke: "lightgray", strokeWidth: 1 },
24831
+ target: span.span_id
24832
+ });
24872
24833
  }
24873
24834
  for (const linkedSpanId of span.linked_span_ids ?? []) {
24874
- const linkedSpan = spansMap.get(linkedSpanId);
24875
- if (linkedSpan) {
24876
- linkedSpan.children ??= [];
24877
- linkedSpan.children.push(currentSpan);
24878
- }
24835
+ allEdges.push({
24836
+ id: `e-link-${linkedSpanId}-${span.span_id}`,
24837
+ markerEnd: { color: "lightgray", height: 16, type: MarkerType.Arrow, width: 16 },
24838
+ source: linkedSpanId,
24839
+ style: { stroke: "lightgray", strokeWidth: 1 },
24840
+ // animated: true,
24841
+ // style: { stroke: 'lightgray', strokeDasharray: '4 2', strokeWidth: 1 },
24842
+ target: span.span_id
24843
+ });
24879
24844
  }
24880
24845
  }
24881
- let allNodes = [];
24882
- let allEdges = [];
24883
- for (const rootSpan of rootSpans) {
24884
- const { edges: newEdges, nodes: newNodes } = generateNodesAndEdges(rootSpan);
24885
- allNodes = [...allNodes, ...newNodes];
24886
- allEdges = [...allEdges, ...newEdges];
24887
- }
24888
24846
  const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges);
24889
24847
  for (const node of layoutedNodes) {
24890
24848
  if (node.id === initialFocusEventId) {
@@ -24893,7 +24851,7 @@ var TraceGraph = ({
24893
24851
  }
24894
24852
  setNodes(layoutedNodes);
24895
24853
  setEdges(layoutedEdges);
24896
- }, [spans.data, initialFocusEventId, setNodes]);
24854
+ }, [spans.data, initialFocusEventId, setNodes, setEdges]);
24897
24855
  const theme = useTheme3();
24898
24856
  return /* @__PURE__ */ jsxs133(Fragment7, { children: [
24899
24857
  spans.error && /* @__PURE__ */ jsxs133(
@@ -25096,9 +25054,9 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
25096
25054
  }
25097
25055
  var TraceGraphPage = ({ onClose, spanId, traceId }) => {
25098
25056
  const api = useAppInspectorApi();
25099
- const [spans, setSpans] = useState13();
25100
- const [loading, setLoading] = useState13(false);
25101
- const [fetchError, setFetchError] = useState13();
25057
+ const [spans, setSpans] = useState12();
25058
+ const [loading, setLoading] = useState12(false);
25059
+ const [fetchError, setFetchError] = useState12();
25102
25060
  const fetchSpans = useCallback8(async () => {
25103
25061
  setLoading(true);
25104
25062
  try {
@@ -25115,8 +25073,8 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
25115
25073
  useEffect18(() => {
25116
25074
  void fetchSpans();
25117
25075
  }, [fetchSpans]);
25118
- const [open, setOpen] = useState13(true);
25119
- const [selectedEvent, setSelectedEvent] = useState13(() => spans?.find((span) => span.span_id === spanId));
25076
+ const [open, setOpen] = useState12(true);
25077
+ const [selectedEvent, setSelectedEvent] = useState12(() => spans?.find((span) => span.span_id === spanId));
25120
25078
  const spansReference = useRef13();
25121
25079
  useEffect18(() => {
25122
25080
  if (!spansReference.current && spans) {
@@ -25183,8 +25141,8 @@ var SpansListPage = () => {
25183
25141
  void clearSpans();
25184
25142
  }, [clearSpans]);
25185
25143
  const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
25186
- const [selectedTraceId, setSelectedTraceId] = useState14();
25187
- const [selectedSpanId, setSelectedSpanId] = useState14();
25144
+ const [selectedTraceId, setSelectedTraceId] = useState13();
25145
+ const [selectedSpanId, setSelectedSpanId] = useState13();
25188
25146
  const navigateToSpan = useCallback9((span) => {
25189
25147
  setSelectedTraceId(span.trace_id);
25190
25148
  setSelectedSpanId(span.span_id);