@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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/pages/spans-list-page.tsx
2
2
  import { Box as Box19 } from "@mui/material";
3
- import { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo7, useRef as useRef4, useState as useState10 } from "react";
3
+ import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo7, useRef as useRef4, useState as useState10 } from "react";
4
4
 
5
5
  // src/api/use-api.tsx
6
6
  import { createContext, useContext } from "react";
@@ -2758,10 +2758,10 @@ var columns = [
2758
2758
  ];
2759
2759
  var defaultSortingOption = { field: "start_time_unix_nano", sort: "asc" };
2760
2760
  var SpansDataGrid = ({
2761
- filterWriteOperations = true,
2761
+ includeReadOperations = false,
2762
2762
  loading,
2763
2763
  onClearSpans,
2764
- onFilterWriteOperationsChange,
2764
+ onIncludeReadOperationsChange,
2765
2765
  onPageChange,
2766
2766
  onPageSizeChange,
2767
2767
  onRefresh,
@@ -2831,20 +2831,20 @@ var SpansDataGrid = ({
2831
2831
  }
2832
2832
  ),
2833
2833
  /* @__PURE__ */ jsx126(Box4, { sx: { flexGrow: 1 } }),
2834
- onFilterWriteOperationsChange && /* @__PURE__ */ jsx126(
2834
+ /* @__PURE__ */ jsx126(
2835
2835
  FormControlLabel,
2836
2836
  {
2837
2837
  control: /* @__PURE__ */ jsx126(
2838
2838
  Switch,
2839
2839
  {
2840
- checked: filterWriteOperations,
2840
+ checked: includeReadOperations,
2841
2841
  onChange: (event) => {
2842
- onFilterWriteOperationsChange(event.target.checked);
2842
+ onIncludeReadOperationsChange?.(event.target.checked);
2843
2843
  },
2844
2844
  size: "small"
2845
2845
  }
2846
2846
  ),
2847
- label: "Only Write Operations"
2847
+ label: "Include Read Operations"
2848
2848
  }
2849
2849
  ),
2850
2850
  /* @__PURE__ */ jsx126(Button, { onClick: onClearSpans, startIcon: /* @__PURE__ */ jsx126(DeleteForeverOutlined, {}), children: "Clear Spans" }),
@@ -2917,10 +2917,10 @@ var SpansList = (props) => {
2917
2917
  (props.spans.data !== void 0 || props.spans.loading) && /* @__PURE__ */ jsx127(
2918
2918
  SpansDataGrid,
2919
2919
  {
2920
- filterWriteOperations: props.filterWriteOperations,
2920
+ includeReadOperations: props.includeReadOperations,
2921
2921
  loading: props.spans.loading,
2922
2922
  onClearSpans: props.onClearSpans,
2923
- onFilterWriteOperationsChange: props.onFilterWriteOperationsChange,
2923
+ onIncludeReadOperationsChange: props.onIncludeReadOperationsChange,
2924
2924
  onPageChange: props.onPageChange,
2925
2925
  onPageSizeChange: props.onPageSizeChange,
2926
2926
  onRefresh: props.onRefresh,
@@ -3321,7 +3321,7 @@ import { ArrowBack } from "@mui/icons-material";
3321
3321
  import { Box as Box18, Button as Button5, Drawer, Paper as Paper2 } from "@mui/material";
3322
3322
  import { styled } from "@mui/material/styles";
3323
3323
  import { ReactFlowProvider } from "@xyflow/react";
3324
- import { useCallback as useCallback5, useEffect as useEffect6, useState as useState9 } from "react";
3324
+ import { useCallback as useCallback4, useEffect as useEffect6, useState as useState9 } from "react";
3325
3325
 
3326
3326
  // src/components/event-details/event-details.tsx
3327
3327
  import { Box as Box14, Chip as Chip3, Divider as Divider2, Stack as Stack2, Typography as Typography9 } from "@mui/material";
@@ -4136,8 +4136,8 @@ function renderKeyValue(key, value) {
4136
4136
  // src/components/trace-graph/trace-graph.tsx
4137
4137
  import "@xyflow/react/dist/base.css";
4138
4138
  import { Alert as Alert3, Button as Button4, useTheme as useTheme2 } from "@mui/material";
4139
- import { Background, ReactFlow, useReactFlow as useReactFlow2 } from "@xyflow/react";
4140
- import { useCallback as useCallback4, useEffect as useEffect5, useState as useState8 } from "react";
4139
+ import { Background, ReactFlow, useNodesState, useReactFlow as useReactFlow2 } from "@xyflow/react";
4140
+ import { useEffect as useEffect5, useState as useState8 } from "react";
4141
4141
 
4142
4142
  // src/components/trace-graph/service-node.tsx
4143
4143
  import { Box as Box16, Stack as Stack3, Typography as Typography10 } from "@mui/material";
@@ -4503,16 +4503,10 @@ var TraceGraph = ({
4503
4503
  spans,
4504
4504
  viewPortPixelWidth
4505
4505
  }) => {
4506
- const [nodes, setNodes] = useState8([]);
4506
+ const [nodes, setNodes, onNodesChange] = useNodesState([]);
4507
4507
  const [edges, setEdges] = useState8([]);
4508
4508
  const [initialViewSet, setInitialViewSet] = useState8(false);
4509
4509
  const { fitView, setCenter } = useReactFlow2();
4510
- const updateSelectedNode = useCallback4((nodeId) => {
4511
- const toSelect = new Set(nodeId ? [nodeId] : []);
4512
- setNodes((previousNodes) => {
4513
- return previousNodes.map((node) => ({ ...node, selected: toSelect.has(node.id) }));
4514
- });
4515
- }, []);
4516
4510
  useEffect5(() => {
4517
4511
  const spansMap = /* @__PURE__ */ new Map();
4518
4512
  const rootSpans = [];
@@ -4547,7 +4541,7 @@ var TraceGraph = ({
4547
4541
  }
4548
4542
  setNodes(layoutedNodes);
4549
4543
  setEdges(layoutedEdges);
4550
- }, [spans.data, initialFocusEventId]);
4544
+ }, [spans.data, initialFocusEventId, setNodes]);
4551
4545
  useEffect5(() => {
4552
4546
  const shouldSetInitialView = !spans.loading && nodes.length > 0 && !initialViewSet;
4553
4547
  if (shouldSetInitialView) {
@@ -4568,15 +4562,6 @@ var TraceGraph = ({
4568
4562
  setInitialViewSet(true);
4569
4563
  }
4570
4564
  }, [spans.loading, nodes, initialFocusEventId, viewPortPixelWidth, setCenter, fitView, onEventSelect, initialViewSet]);
4571
- useEffect5(() => {
4572
- if (initialFocusEventId) {
4573
- updateSelectedNode(initialFocusEventId);
4574
- }
4575
- }, [initialFocusEventId, updateSelectedNode]);
4576
- const onNodeClick = useCallback4((_event, node) => {
4577
- onEventSelect(node.data.event);
4578
- updateSelectedNode(node.id);
4579
- }, [onEventSelect, updateSelectedNode]);
4580
4565
  const theme = useTheme2();
4581
4566
  return /* @__PURE__ */ jsxs132(Fragment7, { children: [
4582
4567
  spans.error && /* @__PURE__ */ jsxs132(
@@ -4604,7 +4589,10 @@ var TraceGraph = ({
4604
4589
  minZoom: 0.1,
4605
4590
  nodes,
4606
4591
  nodeTypes,
4607
- onNodeClick,
4592
+ onNodeClick: (_event, node) => {
4593
+ onEventSelect(node.data.event);
4594
+ },
4595
+ onNodesChange,
4608
4596
  selectNodesOnDrag: false,
4609
4597
  children: [
4610
4598
  /* @__PURE__ */ jsx140(Controls, {}),
@@ -4745,11 +4733,13 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
4745
4733
  const api = useAppInspectorApi();
4746
4734
  const [spans, setSpans] = useState9();
4747
4735
  const [loading, setLoading] = useState9(false);
4736
+ const [includeReadOperations] = useLocalStorage("includeReadOperations", false);
4748
4737
  const [fetchError, setFetchError] = useState9();
4749
- const fetchSpans = useCallback5(async () => {
4738
+ const fetchSpans = useCallback4(async () => {
4750
4739
  setLoading(true);
4751
4740
  try {
4752
4741
  const response = await api.getSpans({
4742
+ is_write_operation: includeReadOperations ? void 0 : true,
4753
4743
  trace_id: traceId
4754
4744
  });
4755
4745
  setSpans(response.spans);
@@ -4760,7 +4750,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
4760
4750
  } finally {
4761
4751
  setLoading(false);
4762
4752
  }
4763
- }, [api, traceId]);
4753
+ }, [api, includeReadOperations, traceId]);
4764
4754
  useEffect6(() => {
4765
4755
  void fetchSpans();
4766
4756
  }, [fetchSpans]);
@@ -4768,7 +4758,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
4768
4758
  const [selectedEvent, setSelectedEvent] = useState9();
4769
4759
  const [viewPortPixelWidth, setViewPortPixelWidth] = useState9(0);
4770
4760
  const { checkStatus, error: statusError, status } = useStatus();
4771
- const calculateDrawerWidth = useCallback5(() => {
4761
+ const calculateDrawerWidth = useCallback4(() => {
4772
4762
  const percentageMatch = /(\d+)%/.exec(DRAWER_WIDTH);
4773
4763
  if (percentageMatch && open) {
4774
4764
  const percentage = Number.parseInt(percentageMatch[1], 10);
@@ -4790,14 +4780,14 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
4790
4780
  clearTimeout(timeoutId);
4791
4781
  };
4792
4782
  }, [open, calculateDrawerWidth]);
4793
- const handleEventSelect = useCallback5((event) => {
4783
+ const handleEventSelect = useCallback4((event) => {
4794
4784
  setSelectedEvent(event);
4795
4785
  setOpen(true);
4796
4786
  }, []);
4797
- const handleRetry = useCallback5(() => {
4787
+ const handleRetry = useCallback4(() => {
4798
4788
  void checkStatus();
4799
4789
  }, [checkStatus]);
4800
- const navigateToSpansList = useCallback5(() => {
4790
+ const navigateToSpansList = useCallback4(() => {
4801
4791
  onClose?.();
4802
4792
  }, [onClose]);
4803
4793
  return /* @__PURE__ */ jsx141(
@@ -4832,21 +4822,21 @@ var SpansListPage = () => {
4832
4822
  const [spans, setSpans] = useState10();
4833
4823
  const [loading, setLoading] = useState10(false);
4834
4824
  const hasFetched = useRef4(false);
4835
- const [filterWriteOperations, setFilterWriteOperations] = useLocalStorage("filterWriteOperations", true);
4825
+ const [includeReadOperations, setIncludeReadOperations] = useLocalStorage("includeReadOperations", false);
4836
4826
  const mapPageToNextCursor = useRef4({});
4837
4827
  const [page, setPage] = useState10(0);
4838
4828
  const [pageSize, setPageSize] = useState10(100);
4839
4829
  const [spanCount, setSpanCount] = useState10(0);
4840
4830
  const queryOptions = useMemo7(() => {
4841
4831
  return {
4842
- is_write_operation: filterWriteOperations ? true : void 0,
4832
+ is_write_operation: includeReadOperations ? void 0 : true,
4843
4833
  limit: pageSize,
4844
4834
  pagination_token: mapPageToNextCursor.current[page - 1]
4845
4835
  };
4846
- }, [filterWriteOperations, pageSize, page]);
4836
+ }, [includeReadOperations, pageSize, page]);
4847
4837
  const [fetchError, setFetchError] = useState10();
4848
4838
  const { checkStatus, error: statusError, status } = useStatus();
4849
- const fetchSpans = useCallback6(async () => {
4839
+ const fetchSpans = useCallback5(async () => {
4850
4840
  setLoading(true);
4851
4841
  try {
4852
4842
  const response = await api.getSpans(queryOptions);
@@ -4863,7 +4853,7 @@ var SpansListPage = () => {
4863
4853
  setLoading(false);
4864
4854
  }
4865
4855
  }, [api, page, queryOptions]);
4866
- const fetchSpansSync = useCallback6(() => {
4856
+ const fetchSpansSync = useCallback5(() => {
4867
4857
  void fetchSpans();
4868
4858
  }, [fetchSpans]);
4869
4859
  useEffect7(() => {
@@ -4878,11 +4868,11 @@ var SpansListPage = () => {
4878
4868
  }, [fetchSpans]);
4879
4869
  const [selectedTraceId, setSelectedTraceId] = useState10();
4880
4870
  const [selectedSpanId, setSelectedSpanId] = useState10();
4881
- const navigateToSpan = useCallback6((span) => {
4871
+ const navigateToSpan = useCallback5((span) => {
4882
4872
  setSelectedTraceId(span.trace_id);
4883
4873
  setSelectedSpanId(span.span_id);
4884
4874
  }, []);
4885
- const clearSpans = useCallback6(async () => {
4875
+ const clearSpans = useCallback5(async () => {
4886
4876
  setLoading(true);
4887
4877
  try {
4888
4878
  await api.deleteSpans();
@@ -4896,7 +4886,7 @@ var SpansListPage = () => {
4896
4886
  setLoading(false);
4897
4887
  }
4898
4888
  }, [api, fetchSpans]);
4899
- const handleRetry = useCallback6(() => {
4889
+ const handleRetry = useCallback5(() => {
4900
4890
  void checkStatus();
4901
4891
  }, [checkStatus]);
4902
4892
  const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
@@ -4926,12 +4916,12 @@ var SpansListPage = () => {
4926
4916
  ) : /* @__PURE__ */ jsx142(
4927
4917
  SpansList,
4928
4918
  {
4929
- filterWriteOperations,
4919
+ includeReadOperations,
4930
4920
  onClearSpans: () => {
4931
4921
  void clearSpans();
4932
4922
  },
4933
- onFilterWriteOperationsChange: (value) => {
4934
- setFilterWriteOperations(value);
4923
+ onIncludeReadOperationsChange: (value) => {
4924
+ setIncludeReadOperations(value);
4935
4925
  },
4936
4926
  onPageChange: setPage,
4937
4927
  onPageSizeChange: setPageSize,
@@ -4967,7 +4957,7 @@ var routes = {
4967
4957
 
4968
4958
  // src/context.tsx
4969
4959
  import { createContext as createContext2, useContext as useContext2 } from "react";
4970
- import { useCallback as useCallback7, useMemo as useMemo8 } from "react";
4960
+ import { useCallback as useCallback6, useMemo as useMemo8 } from "react";
4971
4961
 
4972
4962
  // src/constants/error-messages.ts
4973
4963
  var ERROR_MESSAGES = {
@@ -5094,7 +5084,7 @@ var AppInspectorContextProvider = (props) => {
5094
5084
  const api = useMemo8(() => {
5095
5085
  return false ? createApiClientMock() : createApiClient({ localstackEndpoint: props.localstackEndpoint });
5096
5086
  }, [props.localstackEndpoint]);
5097
- const resolveLink = useCallback7(
5087
+ const resolveLink = useCallback6(
5098
5088
  (options) => {
5099
5089
  if (options.to === "settings") {
5100
5090
  return `${props.routePrefix}/settings`;