@localstack/appinspector-ui 1.0.70 → 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,13 +367,13 @@ 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";
374
374
 
375
375
  // src/components/spans-list/spans-data-grid.tsx
376
- import { DeleteForeverOutlined, PauseOutlined, PlayArrowOutlined, SwapVertOutlined } from "@mui/icons-material";
376
+ import { DeleteForeverOutlined, PauseOutlined, PlayArrowOutlined } from "@mui/icons-material";
377
377
  import {
378
378
  Box as Box3,
379
379
  Button,
@@ -387,6 +387,7 @@ import {
387
387
  TableContainer,
388
388
  TableHead,
389
389
  TableRow,
390
+ TableSortLabel,
390
391
  Tooltip as Tooltip2,
391
392
  Typography as Typography2,
392
393
  useTheme as useTheme2
@@ -12646,7 +12647,17 @@ var SpansDataGrid = ({
12646
12647
  }),
12647
12648
  columnHelper.accessor("startTime", {
12648
12649
  cell: (props) => /* @__PURE__ */ jsx124(ResponsiveTimestampCell, { date: props.getValue() }),
12649
- header: "Time",
12650
+ header: () => /* @__PURE__ */ jsx124(
12651
+ TableSortLabel,
12652
+ {
12653
+ active: true,
12654
+ direction: order2 === "newest_first" ? "asc" : "desc",
12655
+ onClick: () => {
12656
+ onOrderChange(order2 === "newest_first" ? "oldest_first" : "newest_first");
12657
+ },
12658
+ children: "Time"
12659
+ }
12660
+ ),
12650
12661
  id: "startTime",
12651
12662
  size: 120
12652
12663
  }),
@@ -12703,7 +12714,7 @@ var SpansDataGrid = ({
12703
12714
  // The actions column doesn't need more space
12704
12715
  size: 96
12705
12716
  })
12706
- ], [onSpanClick]);
12717
+ ], [onSpanClick, onOrderChange, order2]);
12707
12718
  const table = useReactTable({
12708
12719
  columns,
12709
12720
  data: spans ?? [],
@@ -12730,23 +12741,6 @@ var SpansDataGrid = ({
12730
12741
  label: ""
12731
12742
  }
12732
12743
  ),
12733
- /* @__PURE__ */ jsx124(
12734
- FormControlLabel,
12735
- {
12736
- control: /* @__PURE__ */ jsx124(
12737
- Button,
12738
- {
12739
- onClick: () => {
12740
- onOrderChange(order2 === "newest_first" ? "oldest_first" : "newest_first");
12741
- },
12742
- startIcon: /* @__PURE__ */ jsx124(SwapVertOutlined, {}),
12743
- variant: "text",
12744
- children: order2 === "newest_first" ? "Newest First" : "Oldest First"
12745
- }
12746
- ),
12747
- label: ""
12748
- }
12749
- ),
12750
12744
  /* @__PURE__ */ jsx124(
12751
12745
  FormControlLabel,
12752
12746
  {
@@ -13852,7 +13846,7 @@ import { ArrowBack } from "@mui/icons-material";
13852
13846
  import { Box as Box18, Button as Button5, Drawer, Paper as Paper2 } from "@mui/material";
13853
13847
  import { styled } from "@mui/material/styles";
13854
13848
  import { ReactFlowProvider } from "@xyflow/react";
13855
- 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";
13856
13850
 
13857
13851
  // src/components/event-details/event-details.tsx
13858
13852
  import { Box as Box14, Chip as Chip3, Divider as Divider2, Stack as Stack2, Typography as Typography10 } from "@mui/material";
@@ -24505,8 +24499,8 @@ function renderKeyValue(key, value) {
24505
24499
  // src/components/trace-graph/trace-graph.tsx
24506
24500
  import "@xyflow/react/dist/base.css";
24507
24501
  import { Alert as Alert3, Button as Button4, useTheme as useTheme3 } from "@mui/material";
24508
- import { Background, ReactFlow, useNodesState } from "@xyflow/react";
24509
- 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";
24510
24504
 
24511
24505
  // src/components/trace-graph/service-node.tsx
24512
24506
  import { Box as Box16, Stack as Stack3, Typography as Typography11 } from "@mui/material";
@@ -24657,56 +24651,6 @@ var ServiceNode = memo9(({ data, selected }) => {
24657
24651
 
24658
24652
  // src/components/trace-graph/utils.ts
24659
24653
  import dagre from "@dagrejs/dagre";
24660
- import { MarkerType, Position as Position2 } from "@xyflow/react";
24661
- var generateNodesAndEdges = (event, parentId) => {
24662
- const nodes = [];
24663
- const edges = [];
24664
- nodes.push({
24665
- data: {
24666
- data: { [event.span_id]: event },
24667
- event,
24668
- height: 28,
24669
- id: event.span_id,
24670
- position: { x: 0, y: 0 },
24671
- width: 28
24672
- },
24673
- id: event.span_id,
24674
- position: { x: 0, y: 0 },
24675
- // Will be set by layout
24676
- sourcePosition: Position2.Right,
24677
- targetPosition: Position2.Left,
24678
- type: "service"
24679
- });
24680
- if (parentId) {
24681
- edges.push({
24682
- animated: false,
24683
- id: `e-${parentId}-${event.span_id}`,
24684
- markerEnd: {
24685
- color: "lightgray",
24686
- height: 16,
24687
- type: MarkerType.Arrow,
24688
- width: 16
24689
- },
24690
- source: parentId,
24691
- style: {
24692
- stroke: "lightgray",
24693
- strokeWidth: 1
24694
- },
24695
- target: event.span_id
24696
- });
24697
- }
24698
- if (event.children && event.children.length > 0) {
24699
- for (const child of event.children) {
24700
- const { edges: childEdges, nodes: childNodes } = generateNodesAndEdges(
24701
- child,
24702
- event.span_id
24703
- );
24704
- nodes.push(...childNodes);
24705
- edges.push(...childEdges);
24706
- }
24707
- }
24708
- return { edges, nodes };
24709
- };
24710
24654
  var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
24711
24655
  const dagreGraph = new dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
24712
24656
  const direction = "LR";
@@ -24857,40 +24801,48 @@ var TraceGraph = ({
24857
24801
  spans
24858
24802
  }) => {
24859
24803
  const [nodes, setNodes, onNodesChange] = useNodesState([]);
24860
- const [edges, setEdges] = useState12([]);
24804
+ const [edges, setEdges] = useEdgesState([]);
24861
24805
  useEffect17(() => {
24862
- const spansMap = /* @__PURE__ */ new Map();
24863
- const rootSpans = [];
24806
+ const allNodes = [];
24807
+ const allEdges = [];
24864
24808
  for (const span of spans.data ?? []) {
24865
- spansMap.set(span.span_id, { ...span, children: [] });
24866
- }
24867
- for (const span of spans.data ?? []) {
24868
- const currentSpan = spansMap.get(span.span_id);
24869
- if (!currentSpan) continue;
24870
- if (span.parent_span_id && spansMap.has(span.parent_span_id)) {
24871
- const parentSpan = spansMap.get(span.parent_span_id);
24872
- if (parentSpan) {
24873
- parentSpan.children ??= [];
24874
- parentSpan.children.push(currentSpan);
24875
- }
24876
- } else {
24877
- 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
+ });
24878
24833
  }
24879
24834
  for (const linkedSpanId of span.linked_span_ids ?? []) {
24880
- const linkedSpan = spansMap.get(linkedSpanId);
24881
- if (linkedSpan) {
24882
- linkedSpan.children ??= [];
24883
- linkedSpan.children.push(currentSpan);
24884
- }
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
+ });
24885
24844
  }
24886
24845
  }
24887
- let allNodes = [];
24888
- let allEdges = [];
24889
- for (const rootSpan of rootSpans) {
24890
- const { edges: newEdges, nodes: newNodes } = generateNodesAndEdges(rootSpan);
24891
- allNodes = [...allNodes, ...newNodes];
24892
- allEdges = [...allEdges, ...newEdges];
24893
- }
24894
24846
  const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges);
24895
24847
  for (const node of layoutedNodes) {
24896
24848
  if (node.id === initialFocusEventId) {
@@ -24899,7 +24851,7 @@ var TraceGraph = ({
24899
24851
  }
24900
24852
  setNodes(layoutedNodes);
24901
24853
  setEdges(layoutedEdges);
24902
- }, [spans.data, initialFocusEventId, setNodes]);
24854
+ }, [spans.data, initialFocusEventId, setNodes, setEdges]);
24903
24855
  const theme = useTheme3();
24904
24856
  return /* @__PURE__ */ jsxs133(Fragment7, { children: [
24905
24857
  spans.error && /* @__PURE__ */ jsxs133(
@@ -25102,9 +25054,9 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
25102
25054
  }
25103
25055
  var TraceGraphPage = ({ onClose, spanId, traceId }) => {
25104
25056
  const api = useAppInspectorApi();
25105
- const [spans, setSpans] = useState13();
25106
- const [loading, setLoading] = useState13(false);
25107
- const [fetchError, setFetchError] = useState13();
25057
+ const [spans, setSpans] = useState12();
25058
+ const [loading, setLoading] = useState12(false);
25059
+ const [fetchError, setFetchError] = useState12();
25108
25060
  const fetchSpans = useCallback8(async () => {
25109
25061
  setLoading(true);
25110
25062
  try {
@@ -25121,8 +25073,8 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
25121
25073
  useEffect18(() => {
25122
25074
  void fetchSpans();
25123
25075
  }, [fetchSpans]);
25124
- const [open, setOpen] = useState13(true);
25125
- 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));
25126
25078
  const spansReference = useRef13();
25127
25079
  useEffect18(() => {
25128
25080
  if (!spansReference.current && spans) {
@@ -25189,8 +25141,8 @@ var SpansListPage = () => {
25189
25141
  void clearSpans();
25190
25142
  }, [clearSpans]);
25191
25143
  const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
25192
- const [selectedTraceId, setSelectedTraceId] = useState14();
25193
- const [selectedSpanId, setSelectedSpanId] = useState14();
25144
+ const [selectedTraceId, setSelectedTraceId] = useState13();
25145
+ const [selectedSpanId, setSelectedSpanId] = useState13();
25194
25146
  const navigateToSpan = useCallback9((span) => {
25195
25147
  setSelectedTraceId(span.trace_id);
25196
25148
  setSelectedSpanId(span.span_id);