@localstack/appinspector-ui 1.0.34 → 1.0.35
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 +6 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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";
|
|
@@ -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
|
|
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 {
|
|
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] =
|
|
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, {}),
|
|
@@ -4746,7 +4734,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
4746
4734
|
const [spans, setSpans] = useState9();
|
|
4747
4735
|
const [loading, setLoading] = useState9(false);
|
|
4748
4736
|
const [fetchError, setFetchError] = useState9();
|
|
4749
|
-
const fetchSpans =
|
|
4737
|
+
const fetchSpans = useCallback4(async () => {
|
|
4750
4738
|
setLoading(true);
|
|
4751
4739
|
try {
|
|
4752
4740
|
const response = await api.getSpans({
|
|
@@ -4768,7 +4756,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
4768
4756
|
const [selectedEvent, setSelectedEvent] = useState9();
|
|
4769
4757
|
const [viewPortPixelWidth, setViewPortPixelWidth] = useState9(0);
|
|
4770
4758
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
4771
|
-
const calculateDrawerWidth =
|
|
4759
|
+
const calculateDrawerWidth = useCallback4(() => {
|
|
4772
4760
|
const percentageMatch = /(\d+)%/.exec(DRAWER_WIDTH);
|
|
4773
4761
|
if (percentageMatch && open) {
|
|
4774
4762
|
const percentage = Number.parseInt(percentageMatch[1], 10);
|
|
@@ -4790,14 +4778,14 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
4790
4778
|
clearTimeout(timeoutId);
|
|
4791
4779
|
};
|
|
4792
4780
|
}, [open, calculateDrawerWidth]);
|
|
4793
|
-
const handleEventSelect =
|
|
4781
|
+
const handleEventSelect = useCallback4((event) => {
|
|
4794
4782
|
setSelectedEvent(event);
|
|
4795
4783
|
setOpen(true);
|
|
4796
4784
|
}, []);
|
|
4797
|
-
const handleRetry =
|
|
4785
|
+
const handleRetry = useCallback4(() => {
|
|
4798
4786
|
void checkStatus();
|
|
4799
4787
|
}, [checkStatus]);
|
|
4800
|
-
const navigateToSpansList =
|
|
4788
|
+
const navigateToSpansList = useCallback4(() => {
|
|
4801
4789
|
onClose?.();
|
|
4802
4790
|
}, [onClose]);
|
|
4803
4791
|
return /* @__PURE__ */ jsx141(
|
|
@@ -4846,7 +4834,7 @@ var SpansListPage = () => {
|
|
|
4846
4834
|
}, [filterWriteOperations, pageSize, page]);
|
|
4847
4835
|
const [fetchError, setFetchError] = useState10();
|
|
4848
4836
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
4849
|
-
const fetchSpans =
|
|
4837
|
+
const fetchSpans = useCallback5(async () => {
|
|
4850
4838
|
setLoading(true);
|
|
4851
4839
|
try {
|
|
4852
4840
|
const response = await api.getSpans(queryOptions);
|
|
@@ -4863,7 +4851,7 @@ var SpansListPage = () => {
|
|
|
4863
4851
|
setLoading(false);
|
|
4864
4852
|
}
|
|
4865
4853
|
}, [api, page, queryOptions]);
|
|
4866
|
-
const fetchSpansSync =
|
|
4854
|
+
const fetchSpansSync = useCallback5(() => {
|
|
4867
4855
|
void fetchSpans();
|
|
4868
4856
|
}, [fetchSpans]);
|
|
4869
4857
|
useEffect7(() => {
|
|
@@ -4878,11 +4866,11 @@ var SpansListPage = () => {
|
|
|
4878
4866
|
}, [fetchSpans]);
|
|
4879
4867
|
const [selectedTraceId, setSelectedTraceId] = useState10();
|
|
4880
4868
|
const [selectedSpanId, setSelectedSpanId] = useState10();
|
|
4881
|
-
const navigateToSpan =
|
|
4869
|
+
const navigateToSpan = useCallback5((span) => {
|
|
4882
4870
|
setSelectedTraceId(span.trace_id);
|
|
4883
4871
|
setSelectedSpanId(span.span_id);
|
|
4884
4872
|
}, []);
|
|
4885
|
-
const clearSpans =
|
|
4873
|
+
const clearSpans = useCallback5(async () => {
|
|
4886
4874
|
setLoading(true);
|
|
4887
4875
|
try {
|
|
4888
4876
|
await api.deleteSpans();
|
|
@@ -4896,7 +4884,7 @@ var SpansListPage = () => {
|
|
|
4896
4884
|
setLoading(false);
|
|
4897
4885
|
}
|
|
4898
4886
|
}, [api, fetchSpans]);
|
|
4899
|
-
const handleRetry =
|
|
4887
|
+
const handleRetry = useCallback5(() => {
|
|
4900
4888
|
void checkStatus();
|
|
4901
4889
|
}, [checkStatus]);
|
|
4902
4890
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
@@ -4967,7 +4955,7 @@ var routes = {
|
|
|
4967
4955
|
|
|
4968
4956
|
// src/context.tsx
|
|
4969
4957
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
4970
|
-
import { useCallback as
|
|
4958
|
+
import { useCallback as useCallback6, useMemo as useMemo8 } from "react";
|
|
4971
4959
|
|
|
4972
4960
|
// src/constants/error-messages.ts
|
|
4973
4961
|
var ERROR_MESSAGES = {
|
|
@@ -5094,7 +5082,7 @@ var AppInspectorContextProvider = (props) => {
|
|
|
5094
5082
|
const api = useMemo8(() => {
|
|
5095
5083
|
return false ? createApiClientMock() : createApiClient({ localstackEndpoint: props.localstackEndpoint });
|
|
5096
5084
|
}, [props.localstackEndpoint]);
|
|
5097
|
-
const resolveLink =
|
|
5085
|
+
const resolveLink = useCallback6(
|
|
5098
5086
|
(options) => {
|
|
5099
5087
|
if (options.to === "settings") {
|
|
5100
5088
|
return `${props.routePrefix}/settings`;
|