@localstack/appinspector-ui 1.0.150 → 1.0.152
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 +198 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +177 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2425,8 +2425,8 @@ __export(index_exports, {
|
|
|
2425
2425
|
module.exports = __toCommonJS(index_exports);
|
|
2426
2426
|
|
|
2427
2427
|
// src/pages/spans-list-page.tsx
|
|
2428
|
-
var
|
|
2429
|
-
var
|
|
2428
|
+
var import_material24 = require("@mui/material");
|
|
2429
|
+
var import_react65 = require("react");
|
|
2430
2430
|
|
|
2431
2431
|
// src/api/errors.ts
|
|
2432
2432
|
var AppInspectorDisabledError = class extends Error {
|
|
@@ -17442,6 +17442,7 @@ var AwsServiceIconBase = (0, import_react38.memo)((props) => {
|
|
|
17442
17442
|
return Icon ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Icon, { ...props }) : null;
|
|
17443
17443
|
});
|
|
17444
17444
|
var supportedServiceNames = Object.keys(ICONS_MAP);
|
|
17445
|
+
var getServiceIconComponent = (service) => ICONS_MAP[service];
|
|
17445
17446
|
|
|
17446
17447
|
// src/components/aws-service-icon/aws-service-icon.tsx
|
|
17447
17448
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
@@ -19070,10 +19071,10 @@ var useSpans = () => {
|
|
|
19070
19071
|
|
|
19071
19072
|
// src/pages/trace-graph-page.tsx
|
|
19072
19073
|
var import_icons_material13 = require("@mui/icons-material");
|
|
19073
|
-
var
|
|
19074
|
+
var import_material23 = require("@mui/material");
|
|
19074
19075
|
var import_styles = require("@mui/material/styles");
|
|
19075
|
-
var
|
|
19076
|
-
var
|
|
19076
|
+
var import_react63 = require("@xyflow/react");
|
|
19077
|
+
var import_react64 = require("react");
|
|
19077
19078
|
|
|
19078
19079
|
// src/components/event-details/event-details.tsx
|
|
19079
19080
|
var import_icons_material10 = require("@mui/icons-material");
|
|
@@ -31680,9 +31681,9 @@ var EventDetails = ({ onClose, selectedEvent }) => {
|
|
|
31680
31681
|
|
|
31681
31682
|
// src/components/trace-graph/trace-graph.tsx
|
|
31682
31683
|
var import_base = require("@xyflow/react/dist/base.css");
|
|
31683
|
-
var
|
|
31684
|
-
var
|
|
31685
|
-
var
|
|
31684
|
+
var import_material22 = require("@mui/material");
|
|
31685
|
+
var import_react61 = require("@xyflow/react");
|
|
31686
|
+
var import_react62 = require("react");
|
|
31686
31687
|
|
|
31687
31688
|
// src/components/trace-graph/service-node.tsx
|
|
31688
31689
|
var import_icons_material11 = require("@mui/icons-material");
|
|
@@ -32012,20 +32013,121 @@ var Controls = (0, import_react58.memo)(() => {
|
|
|
32012
32013
|
);
|
|
32013
32014
|
});
|
|
32014
32015
|
|
|
32015
|
-
// src/components/trace-graph/
|
|
32016
|
+
// src/components/trace-graph/xyflow/minimap-node.tsx
|
|
32017
|
+
var import_material21 = require("@mui/material");
|
|
32018
|
+
var import_react59 = require("@xyflow/react");
|
|
32019
|
+
var import_react60 = require("react");
|
|
32016
32020
|
var import_jsx_runtime143 = require("react/jsx-runtime");
|
|
32021
|
+
var ICON_FRACTION = 0.35;
|
|
32022
|
+
var PADDING_FRACTION = 0.18;
|
|
32023
|
+
var ICON_NATIVE_SIZE = 80;
|
|
32024
|
+
var MinimapServiceNode = (0, import_react60.memo)(({
|
|
32025
|
+
height,
|
|
32026
|
+
id: id2,
|
|
32027
|
+
onClick,
|
|
32028
|
+
selected,
|
|
32029
|
+
width,
|
|
32030
|
+
x,
|
|
32031
|
+
y
|
|
32032
|
+
}) => {
|
|
32033
|
+
const theme = (0, import_material21.useTheme)();
|
|
32034
|
+
const node = (0, import_react59.useStore)((s) => s.nodeLookup.get(id2));
|
|
32035
|
+
const event = node?.data.event;
|
|
32036
|
+
const serviceName = event?.service_name;
|
|
32037
|
+
const Icon = serviceName ? getServiceIconComponent(serviceName) : void 0;
|
|
32038
|
+
const { operation_status, status_code } = event ?? {};
|
|
32039
|
+
const isError = operation_status ? operation_status === "error" || operation_status === "iam_explicit_deny" || operation_status === "iam_implicit_deny" : status_code === 2;
|
|
32040
|
+
const errorColor = theme.palette.error.main;
|
|
32041
|
+
const iconSize = Math.min(width, height) * ICON_FRACTION;
|
|
32042
|
+
const padding = Math.min(width, height) * PADDING_FRACTION;
|
|
32043
|
+
const scale2 = iconSize / ICON_NATIVE_SIZE;
|
|
32044
|
+
const dotRadius = Math.min(width, height) * 0.12;
|
|
32045
|
+
const dotX = x + padding + iconSize / 2;
|
|
32046
|
+
const dotY = y + height - padding - dotRadius;
|
|
32047
|
+
const outlineColor = selected ? isError ? errorColor : "#1a73e8" : "#cccccc";
|
|
32048
|
+
const outlineWidth = selected ? 2 : 1;
|
|
32049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)("g", { onClick: onClick ? (event2) => {
|
|
32050
|
+
onClick(event2, id2);
|
|
32051
|
+
} : void 0, children: [
|
|
32052
|
+
/* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
32053
|
+
"rect",
|
|
32054
|
+
{
|
|
32055
|
+
fill: "white",
|
|
32056
|
+
height,
|
|
32057
|
+
rx: 3,
|
|
32058
|
+
ry: 3,
|
|
32059
|
+
stroke: outlineColor,
|
|
32060
|
+
strokeWidth: outlineWidth,
|
|
32061
|
+
width,
|
|
32062
|
+
x,
|
|
32063
|
+
y
|
|
32064
|
+
}
|
|
32065
|
+
),
|
|
32066
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
32067
|
+
"rect",
|
|
32068
|
+
{
|
|
32069
|
+
fill: errorColor,
|
|
32070
|
+
height: height - 6,
|
|
32071
|
+
rx: 2,
|
|
32072
|
+
ry: 2,
|
|
32073
|
+
width: 3,
|
|
32074
|
+
x: x + 1.5,
|
|
32075
|
+
y: y + 3
|
|
32076
|
+
}
|
|
32077
|
+
),
|
|
32078
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("g", { transform: `translate(${String(x + padding)}, ${String(y + padding)}) scale(${String(scale2)})`, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Icon, { height: ICON_NATIVE_SIZE, width: ICON_NATIVE_SIZE }) }),
|
|
32079
|
+
isError && Icon && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
32080
|
+
"circle",
|
|
32081
|
+
{
|
|
32082
|
+
cx: dotX,
|
|
32083
|
+
cy: dotY,
|
|
32084
|
+
fill: errorColor,
|
|
32085
|
+
r: dotRadius
|
|
32086
|
+
}
|
|
32087
|
+
)
|
|
32088
|
+
] });
|
|
32089
|
+
});
|
|
32090
|
+
|
|
32091
|
+
// src/components/trace-graph/trace-graph.tsx
|
|
32092
|
+
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
32017
32093
|
var nodeTypes = {
|
|
32018
32094
|
service: ServiceNode
|
|
32019
32095
|
};
|
|
32096
|
+
var ExtentUpdater = ({ onUpdate, viewportRef }) => {
|
|
32097
|
+
const zoom = (0, import_react61.useStore)((s) => s.transform[2]);
|
|
32098
|
+
const width = (0, import_react61.useStore)((s) => s.width);
|
|
32099
|
+
const height = (0, import_react61.useStore)((s) => s.height);
|
|
32100
|
+
(0, import_react62.useEffect)(() => {
|
|
32101
|
+
viewportRef.current = { height, width, zoom };
|
|
32102
|
+
onUpdate();
|
|
32103
|
+
}, [zoom, width, height, onUpdate, viewportRef]);
|
|
32104
|
+
return null;
|
|
32105
|
+
};
|
|
32020
32106
|
var TraceGraph = ({
|
|
32021
32107
|
initialFocusEventId,
|
|
32022
32108
|
onEventSelect,
|
|
32023
32109
|
onRefresh,
|
|
32024
32110
|
spans
|
|
32025
32111
|
}) => {
|
|
32026
|
-
const [nodes2, setNodes, onNodesChange] = (0,
|
|
32027
|
-
const [edges, setEdges] = (0,
|
|
32028
|
-
(0,
|
|
32112
|
+
const [nodes2, setNodes, onNodesChange] = (0, import_react61.useNodesState)([]);
|
|
32113
|
+
const [edges, setEdges] = (0, import_react61.useEdgesState)([]);
|
|
32114
|
+
const [translateExtent, setTranslateExtent] = (0, import_react62.useState)();
|
|
32115
|
+
const nodeBoundsRef = (0, import_react62.useRef)(null);
|
|
32116
|
+
const viewportRef = (0, import_react62.useRef)({ height: 0, width: 0, zoom: 1 });
|
|
32117
|
+
const updateExtent = (0, import_react62.useCallback)(() => {
|
|
32118
|
+
const bounds = nodeBoundsRef.current;
|
|
32119
|
+
const { height, width, zoom } = viewportRef.current;
|
|
32120
|
+
if (!bounds || width === 0 || height === 0) return;
|
|
32121
|
+
const NODE_W = 200;
|
|
32122
|
+
const NODE_H = 80;
|
|
32123
|
+
const hMargin = (width - NODE_W) / zoom;
|
|
32124
|
+
const vMargin = (height - NODE_H) / zoom;
|
|
32125
|
+
setTranslateExtent([
|
|
32126
|
+
[bounds.minX - hMargin, bounds.minY - vMargin],
|
|
32127
|
+
[bounds.maxX + hMargin, bounds.maxY + vMargin]
|
|
32128
|
+
]);
|
|
32129
|
+
}, []);
|
|
32130
|
+
(0, import_react62.useEffect)(() => {
|
|
32029
32131
|
const allNodes = [];
|
|
32030
32132
|
const allEdges = [];
|
|
32031
32133
|
for (const span of spans.data ?? []) {
|
|
@@ -32040,15 +32142,15 @@ var TraceGraph = ({
|
|
|
32040
32142
|
},
|
|
32041
32143
|
id: span.span_id,
|
|
32042
32144
|
position: { x: 0, y: 0 },
|
|
32043
|
-
sourcePosition:
|
|
32044
|
-
targetPosition:
|
|
32145
|
+
sourcePosition: import_react61.Position.Right,
|
|
32146
|
+
targetPosition: import_react61.Position.Left,
|
|
32045
32147
|
type: "service"
|
|
32046
32148
|
});
|
|
32047
32149
|
if (span.parent_span_id !== null) {
|
|
32048
32150
|
allEdges.push({
|
|
32049
32151
|
animated: false,
|
|
32050
32152
|
id: `e-${span.parent_span_id}-${span.span_id}`,
|
|
32051
|
-
markerEnd: { color: "lightgray", height: 16, type:
|
|
32153
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react61.MarkerType.Arrow, width: 16 },
|
|
32052
32154
|
source: span.parent_span_id,
|
|
32053
32155
|
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
32054
32156
|
target: span.span_id
|
|
@@ -32057,7 +32159,7 @@ var TraceGraph = ({
|
|
|
32057
32159
|
for (const outgoingLinkSpanId of span.outgoing_link_span_ids ?? []) {
|
|
32058
32160
|
allEdges.push({
|
|
32059
32161
|
id: `e-link-${outgoingLinkSpanId}-${span.span_id}`,
|
|
32060
|
-
markerEnd: { color: "lightgray", height: 16, type:
|
|
32162
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react61.MarkerType.Arrow, width: 16 },
|
|
32061
32163
|
source: outgoingLinkSpanId,
|
|
32062
32164
|
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
32063
32165
|
// animated: true,
|
|
@@ -32085,13 +32187,24 @@ var TraceGraph = ({
|
|
|
32085
32187
|
}
|
|
32086
32188
|
setNodes(layoutedNodes);
|
|
32087
32189
|
setEdges(layoutedEdges);
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
|
|
32091
|
-
|
|
32092
|
-
|
|
32190
|
+
if (layoutedNodes.length > 0) {
|
|
32191
|
+
const NODE_W = 200;
|
|
32192
|
+
const NODE_H = 80;
|
|
32193
|
+
nodeBoundsRef.current = {
|
|
32194
|
+
maxX: Math.max(...layoutedNodes.map((n) => n.position.x + NODE_W)),
|
|
32195
|
+
maxY: Math.max(...layoutedNodes.map((n) => n.position.y + NODE_H)),
|
|
32196
|
+
minX: Math.min(...layoutedNodes.map((n) => n.position.x)),
|
|
32197
|
+
minY: Math.min(...layoutedNodes.map((n) => n.position.y))
|
|
32198
|
+
};
|
|
32199
|
+
updateExtent();
|
|
32200
|
+
}
|
|
32201
|
+
}, [spans.data, initialFocusEventId, setNodes, setEdges, updateExtent]);
|
|
32202
|
+
const theme = (0, import_material22.useTheme)();
|
|
32203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(import_jsx_runtime144.Fragment, { children: [
|
|
32204
|
+
spans.error && /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
32205
|
+
import_material22.Alert,
|
|
32093
32206
|
{
|
|
32094
|
-
action: /* @__PURE__ */ (0,
|
|
32207
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_material22.Button, { onClick: () => {
|
|
32095
32208
|
onRefresh();
|
|
32096
32209
|
}, children: "Retry" }),
|
|
32097
32210
|
severity: "error",
|
|
@@ -32102,8 +32215,8 @@ var TraceGraph = ({
|
|
|
32102
32215
|
]
|
|
32103
32216
|
}
|
|
32104
32217
|
),
|
|
32105
|
-
/* @__PURE__ */ (0,
|
|
32106
|
-
|
|
32218
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
32219
|
+
import_react61.ReactFlow,
|
|
32107
32220
|
{
|
|
32108
32221
|
"data-testid": TRACE_GRAPH_TEST_ID,
|
|
32109
32222
|
edges,
|
|
@@ -32119,10 +32232,20 @@ var TraceGraph = ({
|
|
|
32119
32232
|
},
|
|
32120
32233
|
onNodesChange,
|
|
32121
32234
|
selectNodesOnDrag: false,
|
|
32235
|
+
translateExtent,
|
|
32122
32236
|
children: [
|
|
32123
|
-
/* @__PURE__ */ (0,
|
|
32124
|
-
/* @__PURE__ */ (0,
|
|
32125
|
-
|
|
32237
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(ExtentUpdater, { onUpdate: updateExtent, viewportRef }),
|
|
32238
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Controls, {}),
|
|
32239
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
32240
|
+
import_react61.MiniMap,
|
|
32241
|
+
{
|
|
32242
|
+
nodeComponent: MinimapServiceNode,
|
|
32243
|
+
pannable: true,
|
|
32244
|
+
zoomable: true
|
|
32245
|
+
}
|
|
32246
|
+
),
|
|
32247
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
32248
|
+
import_react61.Background,
|
|
32126
32249
|
{
|
|
32127
32250
|
bgColor: theme.palette.background.default,
|
|
32128
32251
|
color: theme.palette.text.disabled
|
|
@@ -32135,7 +32258,7 @@ var TraceGraph = ({
|
|
|
32135
32258
|
};
|
|
32136
32259
|
|
|
32137
32260
|
// src/pages/trace-graph-page.tsx
|
|
32138
|
-
var
|
|
32261
|
+
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
32139
32262
|
var DRAWER_WIDTH = "35%";
|
|
32140
32263
|
var Main = (0, import_styles.styled)("main", { shouldForwardProp: (property) => property !== "open" })(({ open, theme }) => ({
|
|
32141
32264
|
flexGrow: 1,
|
|
@@ -32152,7 +32275,7 @@ var Main = (0, import_styles.styled)("main", { shouldForwardProp: (property) =>
|
|
|
32152
32275
|
})
|
|
32153
32276
|
}
|
|
32154
32277
|
}));
|
|
32155
|
-
var StyledDrawer = (0, import_styles.styled)(
|
|
32278
|
+
var StyledDrawer = (0, import_styles.styled)(import_material23.Drawer)(({ headerHeight }) => ({
|
|
32156
32279
|
"& .MuiDrawer-paper": {
|
|
32157
32280
|
bottom: 0,
|
|
32158
32281
|
boxSizing: "border-box",
|
|
@@ -32181,8 +32304,8 @@ var TraceGraphView = ({
|
|
|
32181
32304
|
}) => {
|
|
32182
32305
|
const { deploymentContainer } = useAppInspector();
|
|
32183
32306
|
const isVSCode = deploymentContainer.source === "vscode";
|
|
32184
|
-
return /* @__PURE__ */ (0,
|
|
32185
|
-
|
|
32307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
32308
|
+
import_material23.Box,
|
|
32186
32309
|
{
|
|
32187
32310
|
"data-testid": TRACE_GRAPH_PAGE_TEST_ID,
|
|
32188
32311
|
sx: {
|
|
@@ -32194,14 +32317,14 @@ var TraceGraphView = ({
|
|
|
32194
32317
|
overflow: "hidden"
|
|
32195
32318
|
},
|
|
32196
32319
|
children: [
|
|
32197
|
-
/* @__PURE__ */ (0,
|
|
32198
|
-
/* @__PURE__ */ (0,
|
|
32320
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(import_material23.Box, { sx: { display: "flex", width: "100%", ...isVSCode && { pt: 1.5, px: 2 } }, children: [
|
|
32321
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_material23.Button, { onClick: () => {
|
|
32199
32322
|
navigateToSpansList();
|
|
32200
|
-
}, startIcon: /* @__PURE__ */ (0,
|
|
32201
|
-
/* @__PURE__ */ (0,
|
|
32323
|
+
}, startIcon: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_icons_material13.ArrowBack, {}), children: "Go back" }),
|
|
32324
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_material23.Box, { sx: { flexGrow: 1 } })
|
|
32202
32325
|
] }),
|
|
32203
|
-
/* @__PURE__ */ (0,
|
|
32204
|
-
|
|
32326
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
32327
|
+
import_material23.Paper,
|
|
32205
32328
|
{
|
|
32206
32329
|
sx: {
|
|
32207
32330
|
display: "flex",
|
|
@@ -32212,14 +32335,14 @@ var TraceGraphView = ({
|
|
|
32212
32335
|
...isVSCode && { borderRadius: 0 }
|
|
32213
32336
|
},
|
|
32214
32337
|
children: [
|
|
32215
|
-
/* @__PURE__ */ (0,
|
|
32216
|
-
|
|
32338
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(Main, { open, children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
32339
|
+
import_material23.Box,
|
|
32217
32340
|
{
|
|
32218
32341
|
sx: {
|
|
32219
32342
|
height: "100%",
|
|
32220
32343
|
overflow: "auto"
|
|
32221
32344
|
},
|
|
32222
|
-
children: traceId !== void 0 && /* @__PURE__ */ (0,
|
|
32345
|
+
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_react63.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
32223
32346
|
TraceGraph,
|
|
32224
32347
|
{
|
|
32225
32348
|
initialFocusEventId: spanId,
|
|
@@ -32236,7 +32359,7 @@ var TraceGraphView = ({
|
|
|
32236
32359
|
) })
|
|
32237
32360
|
}
|
|
32238
32361
|
) }),
|
|
32239
|
-
/* @__PURE__ */ (0,
|
|
32362
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(StyledDrawer, { anchor: "right", headerHeight, open, variant: "persistent", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(EventDetails, { onClose: handleClose, selectedEvent }) })
|
|
32240
32363
|
]
|
|
32241
32364
|
}
|
|
32242
32365
|
)
|
|
@@ -32288,10 +32411,10 @@ async function fetchConnectedTracesWaterfall(api, traceIds, allSpans = /* @__PUR
|
|
|
32288
32411
|
var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
32289
32412
|
const api = useAppInspectorApi();
|
|
32290
32413
|
const { headerHeight } = useAppInspector();
|
|
32291
|
-
const [spans, setSpans] = (0,
|
|
32292
|
-
const [loading, setLoading] = (0,
|
|
32293
|
-
const [fetchError, setFetchError] = (0,
|
|
32294
|
-
const fetchSpans = (0,
|
|
32414
|
+
const [spans, setSpans] = (0, import_react64.useState)();
|
|
32415
|
+
const [loading, setLoading] = (0, import_react64.useState)(false);
|
|
32416
|
+
const [fetchError, setFetchError] = (0, import_react64.useState)();
|
|
32417
|
+
const fetchSpans = (0, import_react64.useCallback)(async () => {
|
|
32295
32418
|
setLoading(true);
|
|
32296
32419
|
try {
|
|
32297
32420
|
const spans2 = await fetchConnectedTraces(api, traceId);
|
|
@@ -32304,27 +32427,27 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
32304
32427
|
setLoading(false);
|
|
32305
32428
|
}
|
|
32306
32429
|
}, [api, traceId]);
|
|
32307
|
-
(0,
|
|
32430
|
+
(0, import_react64.useEffect)(() => {
|
|
32308
32431
|
void fetchSpans();
|
|
32309
32432
|
}, [fetchSpans]);
|
|
32310
|
-
const [open, setOpen] = (0,
|
|
32311
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
32312
|
-
const spansReference = (0,
|
|
32313
|
-
(0,
|
|
32433
|
+
const [open, setOpen] = (0, import_react64.useState)(true);
|
|
32434
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react64.useState)(() => spans?.find((span) => span.span_id === spanId));
|
|
32435
|
+
const spansReference = (0, import_react64.useRef)();
|
|
32436
|
+
(0, import_react64.useEffect)(() => {
|
|
32314
32437
|
if (!spansReference.current && spans) {
|
|
32315
32438
|
setSelectedEvent(spans.find((span) => span.span_id === spanId));
|
|
32316
32439
|
spansReference.current = spans;
|
|
32317
32440
|
}
|
|
32318
32441
|
}, [spans, setSelectedEvent, spanId]);
|
|
32319
|
-
const handleEventSelect = (0,
|
|
32442
|
+
const handleEventSelect = (0, import_react64.useCallback)((spanId2) => {
|
|
32320
32443
|
const span = spans?.find((s) => s.span_id === spanId2);
|
|
32321
32444
|
setSelectedEvent(span);
|
|
32322
32445
|
setOpen(true);
|
|
32323
32446
|
}, [spans]);
|
|
32324
|
-
const navigateToSpansList = (0,
|
|
32447
|
+
const navigateToSpansList = (0, import_react64.useCallback)(() => {
|
|
32325
32448
|
onClose?.();
|
|
32326
32449
|
}, [onClose]);
|
|
32327
|
-
return /* @__PURE__ */ (0,
|
|
32450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
32328
32451
|
TraceGraphView,
|
|
32329
32452
|
{
|
|
32330
32453
|
fetchError,
|
|
@@ -32346,7 +32469,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
32346
32469
|
};
|
|
32347
32470
|
|
|
32348
32471
|
// src/pages/spans-list-page.tsx
|
|
32349
|
-
var
|
|
32472
|
+
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
32350
32473
|
var SpansListPage = () => {
|
|
32351
32474
|
const api = useAppInspectorApi();
|
|
32352
32475
|
const {
|
|
@@ -32370,33 +32493,33 @@ var SpansListPage = () => {
|
|
|
32370
32493
|
warningCount
|
|
32371
32494
|
} = useSpans();
|
|
32372
32495
|
const { checkStatus, phase, status, statusError } = useAppInspectorStatus();
|
|
32373
|
-
const clearSpansSync = (0,
|
|
32496
|
+
const clearSpansSync = (0, import_react65.useCallback)(() => {
|
|
32374
32497
|
void clearSpans();
|
|
32375
32498
|
}, [clearSpans]);
|
|
32376
32499
|
const localstackVersion = status?.localstackVersion ?? (statusError instanceof AppInspectorNotFoundError ? statusError.localstackVersion : void 0);
|
|
32377
32500
|
const versionCompatibility = checkEmulatorVersion(localstackVersion);
|
|
32378
32501
|
const searchSupported = emulatorSupportsSearch(localstackVersion);
|
|
32379
|
-
const [bannerDismissed, setBannerDismissed] = (0,
|
|
32502
|
+
const [bannerDismissed, setBannerDismissed] = (0, import_react65.useState)(false);
|
|
32380
32503
|
const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
|
|
32381
|
-
const [selectedTraceId, setSelectedTraceId] = (0,
|
|
32382
|
-
const [selectedSpanId, setSelectedSpanId] = (0,
|
|
32383
|
-
const navigateToSpan = (0,
|
|
32504
|
+
const [selectedTraceId, setSelectedTraceId] = (0, import_react65.useState)();
|
|
32505
|
+
const [selectedSpanId, setSelectedSpanId] = (0, import_react65.useState)();
|
|
32506
|
+
const navigateToSpan = (0, import_react65.useCallback)((span) => {
|
|
32384
32507
|
setSelectedTraceId(span.trace_id);
|
|
32385
32508
|
setSelectedSpanId(span.span_id);
|
|
32386
32509
|
}, []);
|
|
32387
|
-
const handleRetry = (0,
|
|
32510
|
+
const handleRetry = (0, import_react65.useCallback)(() => {
|
|
32388
32511
|
checkStatus();
|
|
32389
32512
|
fetchForward();
|
|
32390
32513
|
}, [checkStatus, fetchForward]);
|
|
32391
|
-
const handleEnable = (0,
|
|
32514
|
+
const handleEnable = (0, import_react65.useCallback)(async () => {
|
|
32392
32515
|
await api.setStatus({ status: "ENABLED" });
|
|
32393
32516
|
clearFetchError();
|
|
32394
32517
|
checkStatus();
|
|
32395
32518
|
}, [api, checkStatus, clearFetchError]);
|
|
32396
|
-
const isDelayedRefetchRef = (0,
|
|
32397
|
-
const delayedRefetchTimerRef = (0,
|
|
32398
|
-
const prevFetchingForwardRef = (0,
|
|
32399
|
-
(0,
|
|
32519
|
+
const isDelayedRefetchRef = (0, import_react65.useRef)(false);
|
|
32520
|
+
const delayedRefetchTimerRef = (0, import_react65.useRef)();
|
|
32521
|
+
const prevFetchingForwardRef = (0, import_react65.useRef)(false);
|
|
32522
|
+
(0, import_react65.useEffect)(() => {
|
|
32400
32523
|
const wasFetching = prevFetchingForwardRef.current;
|
|
32401
32524
|
prevFetchingForwardRef.current = fetchingForward;
|
|
32402
32525
|
if (wasFetching && !fetchingForward) {
|
|
@@ -32417,10 +32540,10 @@ var SpansListPage = () => {
|
|
|
32417
32540
|
switch (phase) {
|
|
32418
32541
|
case "CHECKING_STATUS":
|
|
32419
32542
|
case "CONNECTING_WS": {
|
|
32420
|
-
return /* @__PURE__ */ (0,
|
|
32543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(StatusMessage, { phase });
|
|
32421
32544
|
}
|
|
32422
32545
|
case "DISABLED": {
|
|
32423
|
-
return /* @__PURE__ */ (0,
|
|
32546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
32424
32547
|
StatusMessage,
|
|
32425
32548
|
{
|
|
32426
32549
|
onEnable: handleEnable,
|
|
@@ -32429,7 +32552,7 @@ var SpansListPage = () => {
|
|
|
32429
32552
|
);
|
|
32430
32553
|
}
|
|
32431
32554
|
case "INCOMPATIBLE": {
|
|
32432
|
-
return /* @__PURE__ */ (0,
|
|
32555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
32433
32556
|
StatusMessage,
|
|
32434
32557
|
{
|
|
32435
32558
|
localstackVersion,
|
|
@@ -32442,7 +32565,7 @@ var SpansListPage = () => {
|
|
|
32442
32565
|
break;
|
|
32443
32566
|
}
|
|
32444
32567
|
case "UNREACHABLE": {
|
|
32445
|
-
return /* @__PURE__ */ (0,
|
|
32568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
32446
32569
|
StatusMessage,
|
|
32447
32570
|
{
|
|
32448
32571
|
onRetry: handleRetry,
|
|
@@ -32451,9 +32574,9 @@ var SpansListPage = () => {
|
|
|
32451
32574
|
);
|
|
32452
32575
|
}
|
|
32453
32576
|
}
|
|
32454
|
-
return /* @__PURE__ */ (0,
|
|
32455
|
-
/* @__PURE__ */ (0,
|
|
32456
|
-
|
|
32577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_jsx_runtime146.Fragment, { children: [
|
|
32578
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
32579
|
+
import_material24.Box,
|
|
32457
32580
|
{
|
|
32458
32581
|
"data-testid": SPANS_LIST_PAGE_TEST_ID,
|
|
32459
32582
|
sx: {
|
|
@@ -32468,7 +32591,7 @@ var SpansListPage = () => {
|
|
|
32468
32591
|
width: "100%"
|
|
32469
32592
|
},
|
|
32470
32593
|
children: [
|
|
32471
|
-
/* @__PURE__ */ (0,
|
|
32594
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
32472
32595
|
EmulatorVersionBanner,
|
|
32473
32596
|
{
|
|
32474
32597
|
compatibility: bannerDismissed && versionCompatibility === "warning" ? "ok" : versionCompatibility,
|
|
@@ -32478,7 +32601,7 @@ var SpansListPage = () => {
|
|
|
32478
32601
|
} : void 0
|
|
32479
32602
|
}
|
|
32480
32603
|
),
|
|
32481
|
-
/* @__PURE__ */ (0,
|
|
32604
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
32482
32605
|
SpansList,
|
|
32483
32606
|
{
|
|
32484
32607
|
clearingSpans,
|
|
@@ -32507,7 +32630,7 @@ var SpansListPage = () => {
|
|
|
32507
32630
|
]
|
|
32508
32631
|
}
|
|
32509
32632
|
),
|
|
32510
|
-
selectedTraceId !== void 0 && /* @__PURE__ */ (0,
|
|
32633
|
+
selectedTraceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(TraceGraphPage, { onClose: () => {
|
|
32511
32634
|
setSelectedTraceId(void 0);
|
|
32512
32635
|
}, spanId: selectedSpanId, traceId: selectedTraceId })
|
|
32513
32636
|
] });
|