@localstack/appinspector-ui 1.0.13 → 1.0.15
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 +109 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +109 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2561,7 +2561,7 @@ var AwsServiceIcon = ({ hideTooltip, service, size = "medium", title }) => {
|
|
|
2561
2561
|
var import_material2 = require("@mui/material");
|
|
2562
2562
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
2563
2563
|
var defaultBackgroundColor = "background.paper";
|
|
2564
|
-
var defaultBorderColor = "
|
|
2564
|
+
var defaultBorderColor = "palette.divider";
|
|
2565
2565
|
var PillCell = ({
|
|
2566
2566
|
backgroundColor = defaultBackgroundColor,
|
|
2567
2567
|
borderColor = defaultBorderColor,
|
|
@@ -2629,7 +2629,9 @@ var ServiceCell = ({
|
|
|
2629
2629
|
import_material3.Typography,
|
|
2630
2630
|
{
|
|
2631
2631
|
sx: {
|
|
2632
|
-
|
|
2632
|
+
borderRightColor: resource ? borderColor : "none",
|
|
2633
|
+
borderRightStyle: resource ? "solid" : "none",
|
|
2634
|
+
borderRightWidth: resource ? "1px" : "none",
|
|
2633
2635
|
fontWeight: "bold",
|
|
2634
2636
|
overflow: "hidden",
|
|
2635
2637
|
padding: "1px 8px",
|
|
@@ -3771,8 +3773,8 @@ var ServiceNode = (0, import_react12.memo)(function ServiceNode2({ data, selecte
|
|
|
3771
3773
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
3772
3774
|
ServiceCell,
|
|
3773
3775
|
{
|
|
3774
|
-
borderColor: selected ? "text.primary" :
|
|
3775
|
-
borderWidth: selected ? "1.5px" :
|
|
3776
|
+
borderColor: selected ? "text.primary" : void 0,
|
|
3777
|
+
borderWidth: selected ? "1.5px" : void 0,
|
|
3776
3778
|
height: "32px",
|
|
3777
3779
|
resource: data.event.resource_name,
|
|
3778
3780
|
service: data.event.service_name,
|
|
@@ -4196,72 +4198,23 @@ var StyledDrawer = (0, import_styles.styled)(import_material15.Drawer)(() => ({
|
|
|
4196
4198
|
"position": "relative",
|
|
4197
4199
|
"width": DRAWER_WIDTH
|
|
4198
4200
|
}));
|
|
4199
|
-
var
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
} catch (error) {
|
|
4216
|
-
console.error(error);
|
|
4217
|
-
setFetchError(error instanceof Error ? error : new Error("Unknown error", { cause: error }));
|
|
4218
|
-
} finally {
|
|
4219
|
-
setLoading(false);
|
|
4220
|
-
}
|
|
4221
|
-
}, [api, traceId]);
|
|
4222
|
-
(0, import_react19.useEffect)(() => {
|
|
4223
|
-
void fetchSpans();
|
|
4224
|
-
}, [fetchSpans]);
|
|
4225
|
-
const [open, setOpen] = (0, import_react19.useState)(true);
|
|
4226
|
-
const [selectedEvent, setSelectedEvent] = (0, import_react19.useState)();
|
|
4227
|
-
const [viewPortPixelWidth, setViewPortPixelWidth] = (0, import_react19.useState)(0);
|
|
4228
|
-
const { checkStatus, error: statusError, status } = useStatus();
|
|
4229
|
-
const calculateDrawerWidth = (0, import_react19.useCallback)(() => {
|
|
4230
|
-
const percentageMatch = /(\d+)%/.exec(DRAWER_WIDTH);
|
|
4231
|
-
if (percentageMatch && open) {
|
|
4232
|
-
const percentage = Number.parseInt(percentageMatch[1], 10);
|
|
4233
|
-
return window.innerWidth * percentage / 100;
|
|
4234
|
-
}
|
|
4235
|
-
return 0;
|
|
4236
|
-
}, [open]);
|
|
4237
|
-
(0, import_react19.useEffect)(() => {
|
|
4238
|
-
const updateViewportWidth = () => {
|
|
4239
|
-
const totalWidth = window.innerWidth;
|
|
4240
|
-
const drawerPixelWidth = open ? calculateDrawerWidth() : 0;
|
|
4241
|
-
setViewPortPixelWidth(totalWidth - drawerPixelWidth);
|
|
4242
|
-
};
|
|
4243
|
-
updateViewportWidth();
|
|
4244
|
-
const timeoutId = setTimeout(updateViewportWidth, 50);
|
|
4245
|
-
window.addEventListener("resize", updateViewportWidth);
|
|
4246
|
-
return () => {
|
|
4247
|
-
window.removeEventListener("resize", updateViewportWidth);
|
|
4248
|
-
clearTimeout(timeoutId);
|
|
4249
|
-
};
|
|
4250
|
-
}, [open, calculateDrawerWidth]);
|
|
4251
|
-
const handleEventSelect = (0, import_react19.useCallback)((event) => {
|
|
4252
|
-
setSelectedEvent(event);
|
|
4253
|
-
setOpen(true);
|
|
4254
|
-
}, []);
|
|
4255
|
-
const handleRetry = (0, import_react19.useCallback)(() => {
|
|
4256
|
-
void checkStatus();
|
|
4257
|
-
}, [checkStatus]);
|
|
4201
|
+
var TraceGraphView = ({
|
|
4202
|
+
fetchError,
|
|
4203
|
+
fetchSpans,
|
|
4204
|
+
handleEventSelect,
|
|
4205
|
+
handleRetry,
|
|
4206
|
+
loading,
|
|
4207
|
+
navigateToSpansList,
|
|
4208
|
+
open,
|
|
4209
|
+
selectedEvent,
|
|
4210
|
+
spanId,
|
|
4211
|
+
spans,
|
|
4212
|
+
status,
|
|
4213
|
+
statusError,
|
|
4214
|
+
traceId,
|
|
4215
|
+
viewPortPixelWidth
|
|
4216
|
+
}) => {
|
|
4258
4217
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
4259
|
-
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
4260
|
-
const { resolveLink } = useAppInspector();
|
|
4261
|
-
const navigateToSpansList = (0, import_react19.useCallback)(() => {
|
|
4262
|
-
const url = resolveLink({ to: "spans-list" });
|
|
4263
|
-
navigate(url);
|
|
4264
|
-
}, [navigate, resolveLink]);
|
|
4265
4218
|
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
4266
4219
|
import_material15.Box,
|
|
4267
4220
|
{
|
|
@@ -4312,7 +4265,7 @@ var TraceGraphPage = () => {
|
|
|
4312
4265
|
initialFocusEventId: spanId,
|
|
4313
4266
|
onEventSelect: handleEventSelect,
|
|
4314
4267
|
onRefresh: () => {
|
|
4315
|
-
|
|
4268
|
+
fetchSpans();
|
|
4316
4269
|
},
|
|
4317
4270
|
spans: {
|
|
4318
4271
|
data: spans,
|
|
@@ -4324,9 +4277,7 @@ var TraceGraphPage = () => {
|
|
|
4324
4277
|
) })
|
|
4325
4278
|
}
|
|
4326
4279
|
) }),
|
|
4327
|
-
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetails, {
|
|
4328
|
-
setOpen(false);
|
|
4329
|
-
}, selectedEvent }) })
|
|
4280
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetails, { selectedEvent }) })
|
|
4330
4281
|
] })
|
|
4331
4282
|
}
|
|
4332
4283
|
)
|
|
@@ -4334,6 +4285,91 @@ var TraceGraphPage = () => {
|
|
|
4334
4285
|
}
|
|
4335
4286
|
);
|
|
4336
4287
|
};
|
|
4288
|
+
var TraceGraphPage = () => {
|
|
4289
|
+
const { traceId } = (0, import_react_router_dom2.useParams)();
|
|
4290
|
+
const [searchParameters] = (0, import_react_router_dom2.useSearchParams)();
|
|
4291
|
+
const spanId = searchParameters.get("spanId");
|
|
4292
|
+
const api = useAppInspectorApi();
|
|
4293
|
+
const [spans, setSpans] = (0, import_react19.useState)();
|
|
4294
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
4295
|
+
const [fetchError, setFetchError] = (0, import_react19.useState)();
|
|
4296
|
+
const fetchSpans = (0, import_react19.useCallback)(async () => {
|
|
4297
|
+
setLoading(true);
|
|
4298
|
+
try {
|
|
4299
|
+
const response = await api.getSpans({
|
|
4300
|
+
trace_id: traceId
|
|
4301
|
+
});
|
|
4302
|
+
setSpans(response.spans);
|
|
4303
|
+
setFetchError(void 0);
|
|
4304
|
+
} catch (error) {
|
|
4305
|
+
console.error(error);
|
|
4306
|
+
setFetchError(error instanceof Error ? error : new Error("Unknown error", { cause: error }));
|
|
4307
|
+
} finally {
|
|
4308
|
+
setLoading(false);
|
|
4309
|
+
}
|
|
4310
|
+
}, [api, traceId]);
|
|
4311
|
+
(0, import_react19.useEffect)(() => {
|
|
4312
|
+
void fetchSpans();
|
|
4313
|
+
}, [fetchSpans]);
|
|
4314
|
+
const [open, setOpen] = (0, import_react19.useState)(true);
|
|
4315
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react19.useState)();
|
|
4316
|
+
const [viewPortPixelWidth, setViewPortPixelWidth] = (0, import_react19.useState)(0);
|
|
4317
|
+
const { checkStatus, error: statusError, status } = useStatus();
|
|
4318
|
+
const calculateDrawerWidth = (0, import_react19.useCallback)(() => {
|
|
4319
|
+
const percentageMatch = /(\d+)%/.exec(DRAWER_WIDTH);
|
|
4320
|
+
if (percentageMatch && open) {
|
|
4321
|
+
const percentage = Number.parseInt(percentageMatch[1], 10);
|
|
4322
|
+
return window.innerWidth * percentage / 100;
|
|
4323
|
+
}
|
|
4324
|
+
return 0;
|
|
4325
|
+
}, [open]);
|
|
4326
|
+
(0, import_react19.useEffect)(() => {
|
|
4327
|
+
const updateViewportWidth = () => {
|
|
4328
|
+
const totalWidth = window.innerWidth;
|
|
4329
|
+
const drawerPixelWidth = open ? calculateDrawerWidth() : 0;
|
|
4330
|
+
setViewPortPixelWidth(totalWidth - drawerPixelWidth);
|
|
4331
|
+
};
|
|
4332
|
+
updateViewportWidth();
|
|
4333
|
+
const timeoutId = setTimeout(updateViewportWidth, 50);
|
|
4334
|
+
window.addEventListener("resize", updateViewportWidth);
|
|
4335
|
+
return () => {
|
|
4336
|
+
window.removeEventListener("resize", updateViewportWidth);
|
|
4337
|
+
clearTimeout(timeoutId);
|
|
4338
|
+
};
|
|
4339
|
+
}, [open, calculateDrawerWidth]);
|
|
4340
|
+
const handleEventSelect = (0, import_react19.useCallback)((event) => {
|
|
4341
|
+
setSelectedEvent(event);
|
|
4342
|
+
setOpen(true);
|
|
4343
|
+
}, []);
|
|
4344
|
+
const handleRetry = (0, import_react19.useCallback)(() => {
|
|
4345
|
+
void checkStatus();
|
|
4346
|
+
}, [checkStatus]);
|
|
4347
|
+
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
4348
|
+
const { resolveLink } = useAppInspector();
|
|
4349
|
+
const navigateToSpansList = (0, import_react19.useCallback)(() => {
|
|
4350
|
+
const url = resolveLink({ to: "spans-list" });
|
|
4351
|
+
navigate(url);
|
|
4352
|
+
}, [navigate, resolveLink]);
|
|
4353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
4354
|
+
TraceGraphView,
|
|
4355
|
+
{
|
|
4356
|
+
fetchError,
|
|
4357
|
+
fetchSpans: () => void fetchSpans(),
|
|
4358
|
+
handleEventSelect,
|
|
4359
|
+
handleRetry,
|
|
4360
|
+
loading,
|
|
4361
|
+
navigateToSpansList,
|
|
4362
|
+
open,
|
|
4363
|
+
selectedEvent,
|
|
4364
|
+
spanId: spanId ?? void 0,
|
|
4365
|
+
spans,
|
|
4366
|
+
status,
|
|
4367
|
+
statusError,
|
|
4368
|
+
traceId,
|
|
4369
|
+
viewPortPixelWidth
|
|
4370
|
+
}
|
|
4371
|
+
);
|
|
4372
|
+
};
|
|
4337
4373
|
|
|
4338
4374
|
// src/routes.ts
|
|
4339
4375
|
var routes = {
|