@localstack/appinspector-ui 1.0.24 → 1.0.26
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 +27 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2573,14 +2573,15 @@ var PillCell = ({
|
|
|
2573
2573
|
// src/components/cells/service-cell.tsx
|
|
2574
2574
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
2575
2575
|
var ServiceCell = ({
|
|
2576
|
-
borderColor,
|
|
2577
|
-
borderWidth,
|
|
2578
2576
|
height = "24px",
|
|
2579
2577
|
resource,
|
|
2578
|
+
selected,
|
|
2580
2579
|
service,
|
|
2581
2580
|
showIcon = true,
|
|
2582
2581
|
width = "32px"
|
|
2583
2582
|
}) => {
|
|
2583
|
+
const borderColor = selected ? "text.primary" : "background.dark";
|
|
2584
|
+
const borderWidth = selected ? "2px" : void 0;
|
|
2584
2585
|
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_material4.Box, { sx: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(PillCell, { borderColor, borderWidth, height, children: [
|
|
2585
2586
|
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_jsx_runtime125.Fragment, { children: [
|
|
2586
2587
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
@@ -2589,6 +2590,7 @@ var ServiceCell = ({
|
|
|
2589
2590
|
sx: {
|
|
2590
2591
|
alignItems: "center",
|
|
2591
2592
|
display: "flex",
|
|
2593
|
+
flexShrink: 0,
|
|
2592
2594
|
height,
|
|
2593
2595
|
justifyContent: "center",
|
|
2594
2596
|
overflow: "hidden",
|
|
@@ -4525,25 +4527,12 @@ var handleStyle = {
|
|
|
4525
4527
|
borderColor: "lightgray",
|
|
4526
4528
|
opacity: 0
|
|
4527
4529
|
};
|
|
4528
|
-
var ServiceNode = (0, import_react16.memo)(
|
|
4529
|
-
const handleClick = (0, import_react16.useCallback)(() => {
|
|
4530
|
-
data.onEventSelect(data.event);
|
|
4531
|
-
}, [data]);
|
|
4532
|
-
const handleKeyPress = (0, import_react16.useCallback)(
|
|
4533
|
-
(event) => {
|
|
4534
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
4535
|
-
handleClick();
|
|
4536
|
-
}
|
|
4537
|
-
},
|
|
4538
|
-
[handleClick]
|
|
4539
|
-
);
|
|
4530
|
+
var ServiceNode = (0, import_react16.memo)(({ data, selected }) => {
|
|
4540
4531
|
const hasErrors = (data.event.errors && data.event.errors.length > 0) ?? false;
|
|
4541
4532
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_material18.Box, { sx: { maxWidth: 200 }, children: [
|
|
4542
4533
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
|
|
4543
4534
|
import_material18.Box,
|
|
4544
4535
|
{
|
|
4545
|
-
onClick: handleClick,
|
|
4546
|
-
onKeyDown: handleKeyPress,
|
|
4547
4536
|
role: "button",
|
|
4548
4537
|
sx: {
|
|
4549
4538
|
"&:hover": {
|
|
@@ -4567,10 +4556,9 @@ var ServiceNode = (0, import_react16.memo)(function ServiceNode2({ data, selecte
|
|
|
4567
4556
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
4568
4557
|
ServiceCell,
|
|
4569
4558
|
{
|
|
4570
|
-
borderColor: selected ? "text.primary" : void 0,
|
|
4571
|
-
borderWidth: selected ? "1.5px" : void 0,
|
|
4572
4559
|
height: "32px",
|
|
4573
4560
|
resource: data.event.resource_name,
|
|
4561
|
+
selected,
|
|
4574
4562
|
service: data.event.service_name,
|
|
4575
4563
|
width: "32px"
|
|
4576
4564
|
}
|
|
@@ -4625,7 +4613,7 @@ var ServiceNode = (0, import_react16.memo)(function ServiceNode2({ data, selecte
|
|
|
4625
4613
|
// src/components/trace-graph/utils.ts
|
|
4626
4614
|
var import_dagre = __toESM(require("@dagrejs/dagre"), 1);
|
|
4627
4615
|
var import_react17 = require("@xyflow/react");
|
|
4628
|
-
var generateNodesAndEdges = (event,
|
|
4616
|
+
var generateNodesAndEdges = (event, parentId) => {
|
|
4629
4617
|
const nodes = [];
|
|
4630
4618
|
const edges = [];
|
|
4631
4619
|
nodes.push({
|
|
@@ -4634,7 +4622,6 @@ var generateNodesAndEdges = (event, onEventSelect, parentId) => {
|
|
|
4634
4622
|
event,
|
|
4635
4623
|
height: 28,
|
|
4636
4624
|
id: event.span_id,
|
|
4637
|
-
onEventSelect,
|
|
4638
4625
|
position: { x: 0, y: 0 },
|
|
4639
4626
|
width: 28
|
|
4640
4627
|
},
|
|
@@ -4665,7 +4652,10 @@ var generateNodesAndEdges = (event, onEventSelect, parentId) => {
|
|
|
4665
4652
|
}
|
|
4666
4653
|
if (event.children && event.children.length > 0) {
|
|
4667
4654
|
for (const child of event.children) {
|
|
4668
|
-
const { edges: childEdges, nodes: childNodes } = generateNodesAndEdges(
|
|
4655
|
+
const { edges: childEdges, nodes: childNodes } = generateNodesAndEdges(
|
|
4656
|
+
child,
|
|
4657
|
+
event.span_id
|
|
4658
|
+
);
|
|
4669
4659
|
nodes.push(...childNodes);
|
|
4670
4660
|
edges.push(...childEdges);
|
|
4671
4661
|
}
|
|
@@ -4687,14 +4677,14 @@ var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
|
|
|
4687
4677
|
import_dagre.default.layout(dagreGraph);
|
|
4688
4678
|
const layoutedNodes = inputNodes.map((node) => {
|
|
4689
4679
|
const nodeWithPosition = dagreGraph.node(node.id);
|
|
4690
|
-
|
|
4680
|
+
return {
|
|
4691
4681
|
...node,
|
|
4692
4682
|
position: {
|
|
4693
4683
|
x: nodeWithPosition.x - nodeWidth / 2,
|
|
4694
4684
|
y: nodeWithPosition.y - nodeHeight / 2
|
|
4695
|
-
}
|
|
4685
|
+
},
|
|
4686
|
+
selectable: true
|
|
4696
4687
|
};
|
|
4697
|
-
return newNode;
|
|
4698
4688
|
});
|
|
4699
4689
|
return { edges: inputEdges, nodes: layoutedNodes };
|
|
4700
4690
|
};
|
|
@@ -4841,19 +4831,12 @@ var TraceGraph = ({
|
|
|
4841
4831
|
const [edges, setEdges] = (0, import_react21.useState)([]);
|
|
4842
4832
|
const [initialViewSet, setInitialViewSet] = (0, import_react21.useState)(false);
|
|
4843
4833
|
const { fitView, setCenter } = (0, import_react20.useReactFlow)();
|
|
4844
|
-
const
|
|
4845
|
-
|
|
4846
|
-
(
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
if (targetNode) {
|
|
4851
|
-
addSelectedNodes([targetNode.id]);
|
|
4852
|
-
}
|
|
4853
|
-
}
|
|
4854
|
-
},
|
|
4855
|
-
[nodes, store]
|
|
4856
|
-
);
|
|
4834
|
+
const updateSelectedNode = (0, import_react21.useCallback)((nodeId) => {
|
|
4835
|
+
const toSelect = new Set(nodeId ? [nodeId] : []);
|
|
4836
|
+
setNodes((previousNodes) => {
|
|
4837
|
+
return previousNodes.map((node) => ({ ...node, selected: toSelect.has(node.id) }));
|
|
4838
|
+
});
|
|
4839
|
+
}, []);
|
|
4857
4840
|
(0, import_react21.useEffect)(() => {
|
|
4858
4841
|
const spansMap = /* @__PURE__ */ new Map();
|
|
4859
4842
|
const rootSpans = [];
|
|
@@ -4876,16 +4859,19 @@ var TraceGraph = ({
|
|
|
4876
4859
|
let allNodes = [];
|
|
4877
4860
|
let allEdges = [];
|
|
4878
4861
|
for (const rootSpan of rootSpans) {
|
|
4879
|
-
const { edges: newEdges, nodes: newNodes } = generateNodesAndEdges(rootSpan
|
|
4880
|
-
onEventSelect(event);
|
|
4881
|
-
});
|
|
4862
|
+
const { edges: newEdges, nodes: newNodes } = generateNodesAndEdges(rootSpan);
|
|
4882
4863
|
allNodes = [...allNodes, ...newNodes];
|
|
4883
4864
|
allEdges = [...allEdges, ...newEdges];
|
|
4884
4865
|
}
|
|
4885
4866
|
const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges);
|
|
4867
|
+
for (const node of layoutedNodes) {
|
|
4868
|
+
if (node.id === initialFocusEventId) {
|
|
4869
|
+
node.selected = true;
|
|
4870
|
+
}
|
|
4871
|
+
}
|
|
4886
4872
|
setNodes(layoutedNodes);
|
|
4887
4873
|
setEdges(layoutedEdges);
|
|
4888
|
-
}, [
|
|
4874
|
+
}, [spans.data, initialFocusEventId]);
|
|
4889
4875
|
(0, import_react21.useEffect)(() => {
|
|
4890
4876
|
const shouldSetInitialView = !spans.loading && nodes.length > 0 && !initialViewSet;
|
|
4891
4877
|
if (shouldSetInitialView) {
|