@localstack/appinspector-ui 1.0.34 → 1.0.36

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.cjs CHANGED
@@ -2795,10 +2795,10 @@ var columns = [
2795
2795
  ];
2796
2796
  var defaultSortingOption = { field: "start_time_unix_nano", sort: "asc" };
2797
2797
  var SpansDataGrid = ({
2798
- filterWriteOperations = true,
2798
+ includeReadOperations = false,
2799
2799
  loading,
2800
2800
  onClearSpans,
2801
- onFilterWriteOperationsChange,
2801
+ onIncludeReadOperationsChange,
2802
2802
  onPageChange,
2803
2803
  onPageSizeChange,
2804
2804
  onRefresh,
@@ -2868,20 +2868,20 @@ var SpansDataGrid = ({
2868
2868
  }
2869
2869
  ),
2870
2870
  /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_material5.Box, { sx: { flexGrow: 1 } }),
2871
- onFilterWriteOperationsChange && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
2871
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
2872
2872
  import_material5.FormControlLabel,
2873
2873
  {
2874
2874
  control: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
2875
2875
  import_material5.Switch,
2876
2876
  {
2877
- checked: filterWriteOperations,
2877
+ checked: includeReadOperations,
2878
2878
  onChange: (event) => {
2879
- onFilterWriteOperationsChange(event.target.checked);
2879
+ onIncludeReadOperationsChange?.(event.target.checked);
2880
2880
  },
2881
2881
  size: "small"
2882
2882
  }
2883
2883
  ),
2884
- label: "Only Write Operations"
2884
+ label: "Include Read Operations"
2885
2885
  }
2886
2886
  ),
2887
2887
  /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_material5.Button, { onClick: onClearSpans, startIcon: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_icons_material.DeleteForeverOutlined, {}), children: "Clear Spans" }),
@@ -2954,10 +2954,10 @@ var SpansList = (props) => {
2954
2954
  (props.spans.data !== void 0 || props.spans.loading) && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
2955
2955
  SpansDataGrid,
2956
2956
  {
2957
- filterWriteOperations: props.filterWriteOperations,
2957
+ includeReadOperations: props.includeReadOperations,
2958
2958
  loading: props.spans.loading,
2959
2959
  onClearSpans: props.onClearSpans,
2960
- onFilterWriteOperationsChange: props.onFilterWriteOperationsChange,
2960
+ onIncludeReadOperationsChange: props.onIncludeReadOperationsChange,
2961
2961
  onPageChange: props.onPageChange,
2962
2962
  onPageSizeChange: props.onPageSizeChange,
2963
2963
  onRefresh: props.onRefresh,
@@ -4540,16 +4540,10 @@ var TraceGraph = ({
4540
4540
  spans,
4541
4541
  viewPortPixelWidth
4542
4542
  }) => {
4543
- const [nodes, setNodes] = (0, import_react18.useState)([]);
4543
+ const [nodes, setNodes, onNodesChange] = (0, import_react17.useNodesState)([]);
4544
4544
  const [edges, setEdges] = (0, import_react18.useState)([]);
4545
4545
  const [initialViewSet, setInitialViewSet] = (0, import_react18.useState)(false);
4546
4546
  const { fitView, setCenter } = (0, import_react17.useReactFlow)();
4547
- const updateSelectedNode = (0, import_react18.useCallback)((nodeId) => {
4548
- const toSelect = new Set(nodeId ? [nodeId] : []);
4549
- setNodes((previousNodes) => {
4550
- return previousNodes.map((node) => ({ ...node, selected: toSelect.has(node.id) }));
4551
- });
4552
- }, []);
4553
4547
  (0, import_react18.useEffect)(() => {
4554
4548
  const spansMap = /* @__PURE__ */ new Map();
4555
4549
  const rootSpans = [];
@@ -4584,7 +4578,7 @@ var TraceGraph = ({
4584
4578
  }
4585
4579
  setNodes(layoutedNodes);
4586
4580
  setEdges(layoutedEdges);
4587
- }, [spans.data, initialFocusEventId]);
4581
+ }, [spans.data, initialFocusEventId, setNodes]);
4588
4582
  (0, import_react18.useEffect)(() => {
4589
4583
  const shouldSetInitialView = !spans.loading && nodes.length > 0 && !initialViewSet;
4590
4584
  if (shouldSetInitialView) {
@@ -4605,15 +4599,6 @@ var TraceGraph = ({
4605
4599
  setInitialViewSet(true);
4606
4600
  }
4607
4601
  }, [spans.loading, nodes, initialFocusEventId, viewPortPixelWidth, setCenter, fitView, onEventSelect, initialViewSet]);
4608
- (0, import_react18.useEffect)(() => {
4609
- if (initialFocusEventId) {
4610
- updateSelectedNode(initialFocusEventId);
4611
- }
4612
- }, [initialFocusEventId, updateSelectedNode]);
4613
- const onNodeClick = (0, import_react18.useCallback)((_event, node) => {
4614
- onEventSelect(node.data.event);
4615
- updateSelectedNode(node.id);
4616
- }, [onEventSelect, updateSelectedNode]);
4617
4602
  const theme = (0, import_material19.useTheme)();
4618
4603
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
4619
4604
  spans.error && /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
@@ -4641,7 +4626,10 @@ var TraceGraph = ({
4641
4626
  minZoom: 0.1,
4642
4627
  nodes,
4643
4628
  nodeTypes,
4644
- onNodeClick,
4629
+ onNodeClick: (_event, node) => {
4630
+ onEventSelect(node.data.event);
4631
+ },
4632
+ onNodesChange,
4645
4633
  selectNodesOnDrag: false,
4646
4634
  children: [
4647
4635
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Controls, {}),
@@ -4782,11 +4770,13 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
4782
4770
  const api = useAppInspectorApi();
4783
4771
  const [spans, setSpans] = (0, import_react20.useState)();
4784
4772
  const [loading, setLoading] = (0, import_react20.useState)(false);
4773
+ const [includeReadOperations] = useLocalStorage("includeReadOperations", false);
4785
4774
  const [fetchError, setFetchError] = (0, import_react20.useState)();
4786
4775
  const fetchSpans = (0, import_react20.useCallback)(async () => {
4787
4776
  setLoading(true);
4788
4777
  try {
4789
4778
  const response = await api.getSpans({
4779
+ is_write_operation: includeReadOperations ? void 0 : true,
4790
4780
  trace_id: traceId
4791
4781
  });
4792
4782
  setSpans(response.spans);
@@ -4797,7 +4787,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
4797
4787
  } finally {
4798
4788
  setLoading(false);
4799
4789
  }
4800
- }, [api, traceId]);
4790
+ }, [api, includeReadOperations, traceId]);
4801
4791
  (0, import_react20.useEffect)(() => {
4802
4792
  void fetchSpans();
4803
4793
  }, [fetchSpans]);
@@ -4869,18 +4859,18 @@ var SpansListPage = () => {
4869
4859
  const [spans, setSpans] = (0, import_react21.useState)();
4870
4860
  const [loading, setLoading] = (0, import_react21.useState)(false);
4871
4861
  const hasFetched = (0, import_react21.useRef)(false);
4872
- const [filterWriteOperations, setFilterWriteOperations] = useLocalStorage("filterWriteOperations", true);
4862
+ const [includeReadOperations, setIncludeReadOperations] = useLocalStorage("includeReadOperations", false);
4873
4863
  const mapPageToNextCursor = (0, import_react21.useRef)({});
4874
4864
  const [page, setPage] = (0, import_react21.useState)(0);
4875
4865
  const [pageSize, setPageSize] = (0, import_react21.useState)(100);
4876
4866
  const [spanCount, setSpanCount] = (0, import_react21.useState)(0);
4877
4867
  const queryOptions = (0, import_react21.useMemo)(() => {
4878
4868
  return {
4879
- is_write_operation: filterWriteOperations ? true : void 0,
4869
+ is_write_operation: includeReadOperations ? void 0 : true,
4880
4870
  limit: pageSize,
4881
4871
  pagination_token: mapPageToNextCursor.current[page - 1]
4882
4872
  };
4883
- }, [filterWriteOperations, pageSize, page]);
4873
+ }, [includeReadOperations, pageSize, page]);
4884
4874
  const [fetchError, setFetchError] = (0, import_react21.useState)();
4885
4875
  const { checkStatus, error: statusError, status } = useStatus();
4886
4876
  const fetchSpans = (0, import_react21.useCallback)(async () => {
@@ -4963,12 +4953,12 @@ var SpansListPage = () => {
4963
4953
  ) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
4964
4954
  SpansList,
4965
4955
  {
4966
- filterWriteOperations,
4956
+ includeReadOperations,
4967
4957
  onClearSpans: () => {
4968
4958
  void clearSpans();
4969
4959
  },
4970
- onFilterWriteOperationsChange: (value) => {
4971
- setFilterWriteOperations(value);
4960
+ onIncludeReadOperationsChange: (value) => {
4961
+ setIncludeReadOperations(value);
4972
4962
  },
4973
4963
  onPageChange: setPage,
4974
4964
  onPageSizeChange: setPageSize,