@localstack/appinspector-ui 1.0.77 → 1.0.79
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 +270 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +178 -77
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -488,7 +488,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
488
488
|
|
|
489
489
|
// src/pages/spans-list-page.tsx
|
|
490
490
|
var import_material20 = require("@mui/material");
|
|
491
|
-
var
|
|
491
|
+
var import_react64 = require("react");
|
|
492
492
|
|
|
493
493
|
// src/components/spans-list/spans-list.tsx
|
|
494
494
|
var import_material5 = require("@mui/material");
|
|
@@ -12901,9 +12901,9 @@ var SpansDataGrid = ({
|
|
|
12901
12901
|
)) }, headerGroup.id);
|
|
12902
12902
|
}) }),
|
|
12903
12903
|
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_material4.TableBody, { children: [
|
|
12904
|
-
spans === void 0 && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.TableCell, { colSpan: columnCount, sx: { fontStyle: "italic", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.CircularProgress, { size: 48, sx: { m: 4 } }) }) }),
|
|
12905
|
-
spans?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_NO_SPANS }),
|
|
12906
|
-
order2 === "newest_first" && /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
|
|
12904
|
+
(spans === void 0 || clearingSpans) && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.TableCell, { colSpan: columnCount, sx: { fontStyle: "italic", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.CircularProgress, { size: 48, sx: { m: 4 } }) }) }),
|
|
12905
|
+
!clearingSpans && spans?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_NO_SPANS }),
|
|
12906
|
+
!clearingSpans && order2 === "newest_first" && /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
|
|
12907
12907
|
hasRows && hasMoreForward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(LoadSpansRow, { colSpan: columnCount, fetching: fetchingForward, label: LABEL_LOAD_NEWER, onFetch: onFetchForward }),
|
|
12908
12908
|
hasRows && !hasMoreForward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_END_OF_STREAM }),
|
|
12909
12909
|
hasRows && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(AnimatePresence, { initial: false, children: (() => {
|
|
@@ -12919,7 +12919,7 @@ var SpansDataGrid = ({
|
|
|
12919
12919
|
hasRows && hasMoreBackward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(LoadSpansRow, { colSpan: columnCount, fetching: fetchingBackward, label: LABEL_LOAD_OLDER, onFetch: onFetchBackward }),
|
|
12920
12920
|
hasRows && !hasMoreBackward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_BEGINNING_OF_STREAM })
|
|
12921
12921
|
] }),
|
|
12922
|
-
order2 === "oldest_first" && /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
|
|
12922
|
+
!clearingSpans && order2 === "oldest_first" && /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
|
|
12923
12923
|
hasRows && !hasMoreBackward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_BEGINNING_OF_STREAM }),
|
|
12924
12924
|
hasRows && hasMoreBackward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(LoadSpansRow, { colSpan: columnCount, fetching: fetchingBackward, label: LABEL_LOAD_OLDER, onFetch: onFetchBackward }),
|
|
12925
12925
|
hasRows && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(AnimatePresence, { initial: false, children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SpansDataGridRow, { row }, row.original.span_id)) }),
|
|
@@ -13316,7 +13316,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
13316
13316
|
}
|
|
13317
13317
|
|
|
13318
13318
|
// src/hooks/use-spans.ts
|
|
13319
|
-
var
|
|
13319
|
+
var import_react48 = require("react");
|
|
13320
13320
|
|
|
13321
13321
|
// src/api/use-api.tsx
|
|
13322
13322
|
var import_react42 = require("react");
|
|
@@ -13531,26 +13531,24 @@ var createPaginationBuffer = (options) => {
|
|
|
13531
13531
|
void checkIfThereAreMoreItemsForward();
|
|
13532
13532
|
},
|
|
13533
13533
|
clear: () => {
|
|
13534
|
-
|
|
13535
|
-
items = [];
|
|
13536
|
-
}
|
|
13534
|
+
items = [];
|
|
13537
13535
|
hasMoreBackward = void 0;
|
|
13538
13536
|
nextBackwardToken = void 0;
|
|
13539
13537
|
hasMoreForward = void 0;
|
|
13540
13538
|
nextForwardToken = void 0;
|
|
13541
13539
|
reportDataChange();
|
|
13542
13540
|
},
|
|
13543
|
-
fetchBackward: () => {
|
|
13541
|
+
fetchBackward: async () => {
|
|
13544
13542
|
if (fetchingForward || fetchingBackward) {
|
|
13545
13543
|
return;
|
|
13546
13544
|
}
|
|
13547
|
-
|
|
13545
|
+
await fetchBackward();
|
|
13548
13546
|
},
|
|
13549
|
-
fetchForward: () => {
|
|
13547
|
+
fetchForward: async () => {
|
|
13550
13548
|
if (fetchingForward || fetchingBackward) {
|
|
13551
13549
|
return;
|
|
13552
13550
|
}
|
|
13553
|
-
|
|
13551
|
+
await fetchForward();
|
|
13554
13552
|
}
|
|
13555
13553
|
};
|
|
13556
13554
|
};
|
|
@@ -13842,15 +13840,109 @@ function useSpansWebSocket(options) {
|
|
|
13842
13840
|
return { connected };
|
|
13843
13841
|
}
|
|
13844
13842
|
|
|
13843
|
+
// src/hooks/use-throttled-items.ts
|
|
13844
|
+
var import_react47 = require("react");
|
|
13845
|
+
function useThrottledItems(items, getId, catchUpIncrement = 10) {
|
|
13846
|
+
const [displayedItems, setDisplayedItems] = (0, import_react47.useState)([]);
|
|
13847
|
+
const [isCatchingUpForward, setIsCatchingUpForward] = (0, import_react47.useState)(false);
|
|
13848
|
+
const [isCatchingUpBackward, setIsCatchingUpBackward] = (0, import_react47.useState)(false);
|
|
13849
|
+
const targetRef = (0, import_react47.useRef)([]);
|
|
13850
|
+
const rafRef = (0, import_react47.useRef)(void 0);
|
|
13851
|
+
const leftHiddenRef = (0, import_react47.useRef)(0);
|
|
13852
|
+
const rightHiddenRef = (0, import_react47.useRef)(0);
|
|
13853
|
+
const shrinkRafPendingRef = (0, import_react47.useRef)(false);
|
|
13854
|
+
(0, import_react47.useEffect)(() => {
|
|
13855
|
+
const previousTarget = targetRef.current;
|
|
13856
|
+
const target = items ?? [];
|
|
13857
|
+
targetRef.current = target;
|
|
13858
|
+
if (rafRef.current !== void 0) {
|
|
13859
|
+
cancelAnimationFrame(rafRef.current);
|
|
13860
|
+
rafRef.current = void 0;
|
|
13861
|
+
}
|
|
13862
|
+
if (target.length < previousTarget.length) {
|
|
13863
|
+
leftHiddenRef.current = 0;
|
|
13864
|
+
rightHiddenRef.current = 0;
|
|
13865
|
+
shrinkRafPendingRef.current = true;
|
|
13866
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
13867
|
+
rafRef.current = void 0;
|
|
13868
|
+
shrinkRafPendingRef.current = false;
|
|
13869
|
+
setDisplayedItems(targetRef.current);
|
|
13870
|
+
setIsCatchingUpForward(false);
|
|
13871
|
+
setIsCatchingUpBackward(false);
|
|
13872
|
+
});
|
|
13873
|
+
return;
|
|
13874
|
+
}
|
|
13875
|
+
if (shrinkRafPendingRef.current) {
|
|
13876
|
+
if (target.length === previousTarget.length) {
|
|
13877
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
13878
|
+
rafRef.current = void 0;
|
|
13879
|
+
shrinkRafPendingRef.current = false;
|
|
13880
|
+
setDisplayedItems(targetRef.current);
|
|
13881
|
+
setIsCatchingUpForward(false);
|
|
13882
|
+
setIsCatchingUpBackward(false);
|
|
13883
|
+
});
|
|
13884
|
+
return;
|
|
13885
|
+
}
|
|
13886
|
+
shrinkRafPendingRef.current = false;
|
|
13887
|
+
}
|
|
13888
|
+
let targetGrew = false;
|
|
13889
|
+
if (target.length > previousTarget.length) {
|
|
13890
|
+
targetGrew = true;
|
|
13891
|
+
const previousIds = new Set(previousTarget.map((item) => getId(item)));
|
|
13892
|
+
const firstOldIndex = target.findIndex((item) => previousIds.has(getId(item)));
|
|
13893
|
+
const leftGrowth = Math.max(0, firstOldIndex);
|
|
13894
|
+
const lastOldIndex = target.findLastIndex((item) => previousIds.has(getId(item)));
|
|
13895
|
+
const rightGrowth = lastOldIndex === -1 ? Math.max(0, target.length - previousTarget.length) : target.length - 1 - lastOldIndex;
|
|
13896
|
+
leftHiddenRef.current += leftGrowth;
|
|
13897
|
+
rightHiddenRef.current += rightGrowth;
|
|
13898
|
+
}
|
|
13899
|
+
if (leftHiddenRef.current > 0 || rightHiddenRef.current > 0) {
|
|
13900
|
+
const step = () => {
|
|
13901
|
+
const t2 = targetRef.current;
|
|
13902
|
+
if (leftHiddenRef.current > 0) {
|
|
13903
|
+
const inc = leftHiddenRef.current < catchUpIncrement ? 1 : catchUpIncrement;
|
|
13904
|
+
leftHiddenRef.current = Math.max(0, leftHiddenRef.current - inc);
|
|
13905
|
+
}
|
|
13906
|
+
if (rightHiddenRef.current > 0) {
|
|
13907
|
+
const inc = rightHiddenRef.current < catchUpIncrement ? 1 : catchUpIncrement;
|
|
13908
|
+
rightHiddenRef.current = Math.max(0, rightHiddenRef.current - inc);
|
|
13909
|
+
}
|
|
13910
|
+
const left = leftHiddenRef.current;
|
|
13911
|
+
const right = rightHiddenRef.current;
|
|
13912
|
+
setDisplayedItems(t2.slice(left, right > 0 ? t2.length - right : void 0));
|
|
13913
|
+
setIsCatchingUpForward(right > 0);
|
|
13914
|
+
setIsCatchingUpBackward(left > 0);
|
|
13915
|
+
rafRef.current = left > 0 || right > 0 ? requestAnimationFrame(step) : void 0;
|
|
13916
|
+
};
|
|
13917
|
+
rafRef.current = requestAnimationFrame(step);
|
|
13918
|
+
} else if (targetGrew) {
|
|
13919
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
13920
|
+
rafRef.current = void 0;
|
|
13921
|
+
setDisplayedItems(targetRef.current);
|
|
13922
|
+
});
|
|
13923
|
+
}
|
|
13924
|
+
}, [items, getId, catchUpIncrement]);
|
|
13925
|
+
(0, import_react47.useEffect)(() => {
|
|
13926
|
+
return () => {
|
|
13927
|
+
if (rafRef.current !== void 0) {
|
|
13928
|
+
cancelAnimationFrame(rafRef.current);
|
|
13929
|
+
rafRef.current = void 0;
|
|
13930
|
+
}
|
|
13931
|
+
};
|
|
13932
|
+
}, []);
|
|
13933
|
+
return { isCatchingUpBackward, isCatchingUpForward, items: displayedItems };
|
|
13934
|
+
}
|
|
13935
|
+
|
|
13845
13936
|
// src/hooks/use-spans.ts
|
|
13846
13937
|
var PAGE_SIZE = 30;
|
|
13847
13938
|
var useSpans = () => {
|
|
13848
13939
|
const api = useAppInspectorApi();
|
|
13849
|
-
const [spans, setSpans] = (0,
|
|
13850
|
-
const
|
|
13851
|
-
const [
|
|
13852
|
-
const [
|
|
13853
|
-
const
|
|
13940
|
+
const [spans, setSpans] = (0, import_react48.useState)();
|
|
13941
|
+
const throttledSpans = useThrottledItems(spans, (span) => span.span_id);
|
|
13942
|
+
const [fetchError, setFetchError] = (0, import_react48.useState)();
|
|
13943
|
+
const [fetchingForward, setFetchingForward] = (0, import_react48.useState)(false);
|
|
13944
|
+
const [fetchingBackward, setFetchingBackward] = (0, import_react48.useState)(false);
|
|
13945
|
+
const paginationBufferRef = (0, import_react48.useRef)(createPaginationBuffer({
|
|
13854
13946
|
async fetchPage(token) {
|
|
13855
13947
|
const response = await api.getSpans({
|
|
13856
13948
|
limit: PAGE_SIZE,
|
|
@@ -13884,27 +13976,28 @@ var useSpans = () => {
|
|
|
13884
13976
|
return a3.start_time_unix_nano < b3.start_time_unix_nano ? -1 : 1;
|
|
13885
13977
|
}
|
|
13886
13978
|
}));
|
|
13887
|
-
const [hasMoreBackward, setHasMoreBackward] = (0,
|
|
13888
|
-
const [hasMoreForward, setHasMoreForward] = (0,
|
|
13889
|
-
const fetchForward = (0,
|
|
13890
|
-
|
|
13979
|
+
const [hasMoreBackward, setHasMoreBackward] = (0, import_react48.useState)();
|
|
13980
|
+
const [hasMoreForward, setHasMoreForward] = (0, import_react48.useState)();
|
|
13981
|
+
const fetchForward = (0, import_react48.useCallback)(() => {
|
|
13982
|
+
void paginationBufferRef.current.fetchForward();
|
|
13891
13983
|
}, []);
|
|
13892
|
-
const fetchBackward = (0,
|
|
13893
|
-
|
|
13984
|
+
const fetchBackward = (0, import_react48.useCallback)(() => {
|
|
13985
|
+
void paginationBufferRef.current.fetchBackward();
|
|
13894
13986
|
}, []);
|
|
13895
|
-
(0,
|
|
13987
|
+
(0, import_react48.useEffect)(() => {
|
|
13896
13988
|
fetchForward();
|
|
13897
13989
|
}, [fetchForward]);
|
|
13898
13990
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
13899
|
-
const [clearingSpans, setClearingSpans] = (0,
|
|
13900
|
-
const clearSpans = (0,
|
|
13991
|
+
const [clearingSpans, setClearingSpans] = (0, import_react48.useState)(false);
|
|
13992
|
+
const clearSpans = (0, import_react48.useCallback)(async () => {
|
|
13901
13993
|
if (clearingSpans) {
|
|
13902
13994
|
return;
|
|
13903
13995
|
}
|
|
13904
13996
|
setClearingSpans(true);
|
|
13905
13997
|
try {
|
|
13906
13998
|
await api.deleteSpans();
|
|
13907
|
-
|
|
13999
|
+
paginationBufferRef.current.clear();
|
|
14000
|
+
await paginationBufferRef.current.fetchForward();
|
|
13908
14001
|
} catch (error) {
|
|
13909
14002
|
console.error("Failed to delete spans:", error);
|
|
13910
14003
|
setFetchError(error instanceof Error ? error : new Error("Failed to delete spans", { cause: error }));
|
|
@@ -13912,17 +14005,25 @@ var useSpans = () => {
|
|
|
13912
14005
|
setClearingSpans(false);
|
|
13913
14006
|
}
|
|
13914
14007
|
}, [clearingSpans, api]);
|
|
13915
|
-
const [streamPaused, setStreamPaused] = (0,
|
|
13916
|
-
const toggleStream = (0,
|
|
14008
|
+
const [streamPaused, setStreamPaused] = (0, import_react48.useState)(false);
|
|
14009
|
+
const toggleStream = (0, import_react48.useCallback)(() => {
|
|
13917
14010
|
setStreamPaused((previous) => !previous);
|
|
13918
14011
|
}, []);
|
|
14012
|
+
(0, import_react48.useEffect)(() => {
|
|
14013
|
+
if (hasMoreForward === true && !fetchingForward && !streamPaused) {
|
|
14014
|
+
void paginationBufferRef.current.fetchForward();
|
|
14015
|
+
}
|
|
14016
|
+
}, [hasMoreForward, fetchingForward, streamPaused]);
|
|
13919
14017
|
useSpansWebSocket({
|
|
13920
14018
|
onMessage: () => {
|
|
14019
|
+
if (clearingSpans) {
|
|
14020
|
+
return;
|
|
14021
|
+
}
|
|
13921
14022
|
if (!hasMoreForward) {
|
|
13922
14023
|
if (streamPaused) {
|
|
13923
|
-
|
|
14024
|
+
paginationBufferRef.current.checkIfThereAreMoreItemsForward();
|
|
13924
14025
|
} else {
|
|
13925
|
-
|
|
14026
|
+
void paginationBufferRef.current.fetchForward();
|
|
13926
14027
|
}
|
|
13927
14028
|
}
|
|
13928
14029
|
}
|
|
@@ -13938,7 +14039,7 @@ var useSpans = () => {
|
|
|
13938
14039
|
fetchingForward,
|
|
13939
14040
|
hasMoreBackward,
|
|
13940
14041
|
hasMoreForward,
|
|
13941
|
-
spans,
|
|
14042
|
+
spans: throttledSpans.items,
|
|
13942
14043
|
status,
|
|
13943
14044
|
statusError,
|
|
13944
14045
|
streamPaused,
|
|
@@ -13950,8 +14051,8 @@ var useSpans = () => {
|
|
|
13950
14051
|
var import_icons_material11 = require("@mui/icons-material");
|
|
13951
14052
|
var import_material19 = require("@mui/material");
|
|
13952
14053
|
var import_styles = require("@mui/material/styles");
|
|
13953
|
-
var
|
|
13954
|
-
var
|
|
14054
|
+
var import_react62 = require("@xyflow/react");
|
|
14055
|
+
var import_react63 = require("react");
|
|
13955
14056
|
|
|
13956
14057
|
// src/components/event-details/event-details.tsx
|
|
13957
14058
|
var import_icons_material8 = require("@mui/icons-material");
|
|
@@ -13960,7 +14061,7 @@ var import_material14 = require("@mui/material");
|
|
|
13960
14061
|
// node_modules/@textea/json-viewer/dist/index.mjs
|
|
13961
14062
|
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
13962
14063
|
var import_material7 = require("@mui/material");
|
|
13963
|
-
var
|
|
14064
|
+
var import_react49 = require("react");
|
|
13964
14065
|
var import_zustand = require("zustand");
|
|
13965
14066
|
var import_copy_to_clipboard = __toESM(require_copy_to_clipboard(), 1);
|
|
13966
14067
|
function r(e2) {
|
|
@@ -14077,10 +14178,10 @@ var createJsonViewerStore = (props) => {
|
|
|
14077
14178
|
};
|
|
14078
14179
|
});
|
|
14079
14180
|
};
|
|
14080
|
-
var JsonViewerStoreContext = (0,
|
|
14181
|
+
var JsonViewerStoreContext = (0, import_react49.createContext)(void 0);
|
|
14081
14182
|
JsonViewerStoreContext.Provider;
|
|
14082
14183
|
var useJsonViewerStore = (selector2, equalityFn) => {
|
|
14083
|
-
const store = (0,
|
|
14184
|
+
const store = (0, import_react49.useContext)(JsonViewerStoreContext);
|
|
14084
14185
|
return (0, import_zustand.useStore)(store, selector2, equalityFn);
|
|
14085
14186
|
};
|
|
14086
14187
|
var useTextColor = () => {
|
|
@@ -14205,9 +14306,9 @@ async function copyString(value) {
|
|
|
14205
14306
|
}
|
|
14206
14307
|
function useClipboard() {
|
|
14207
14308
|
let { timeout = 2e3 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
14208
|
-
const [copied, setCopied] = (0,
|
|
14209
|
-
const copyTimeout = (0,
|
|
14210
|
-
const handleCopyResult = (0,
|
|
14309
|
+
const [copied, setCopied] = (0, import_react49.useState)(false);
|
|
14310
|
+
const copyTimeout = (0, import_react49.useRef)(null);
|
|
14311
|
+
const handleCopyResult = (0, import_react49.useCallback)((value) => {
|
|
14211
14312
|
const current = copyTimeout.current;
|
|
14212
14313
|
if (current) {
|
|
14213
14314
|
window.clearTimeout(current);
|
|
@@ -14218,7 +14319,7 @@ function useClipboard() {
|
|
|
14218
14319
|
timeout
|
|
14219
14320
|
]);
|
|
14220
14321
|
const onCopy = useJsonViewerStore((store) => store.onCopy);
|
|
14221
|
-
const copy = (0,
|
|
14322
|
+
const copy = (0, import_react49.useCallback)(async (path, value) => {
|
|
14222
14323
|
if (typeof onCopy === "function") {
|
|
14223
14324
|
try {
|
|
14224
14325
|
await onCopy(path, value, copyString);
|
|
@@ -14239,7 +14340,7 @@ function useClipboard() {
|
|
|
14239
14340
|
handleCopyResult,
|
|
14240
14341
|
onCopy
|
|
14241
14342
|
]);
|
|
14242
|
-
const reset = (0,
|
|
14343
|
+
const reset = (0, import_react49.useCallback)(() => {
|
|
14243
14344
|
setCopied(false);
|
|
14244
14345
|
if (copyTimeout.current) {
|
|
14245
14346
|
clearTimeout(copyTimeout.current);
|
|
@@ -14253,7 +14354,7 @@ function useClipboard() {
|
|
|
14253
14354
|
}
|
|
14254
14355
|
function useIsCycleReference(path, value) {
|
|
14255
14356
|
const rootValue = useJsonViewerStore((store) => store.value);
|
|
14256
|
-
return (0,
|
|
14357
|
+
return (0, import_react49.useMemo)(() => isCycleReference(rootValue, path, value), [
|
|
14257
14358
|
path,
|
|
14258
14359
|
value,
|
|
14259
14360
|
rootValue
|
|
@@ -14266,7 +14367,7 @@ function useInspect(path, value, nestedIndex) {
|
|
|
14266
14367
|
const setInspectCache = useJsonViewerStore((store) => store.setInspectCache);
|
|
14267
14368
|
const defaultInspectDepth = useJsonViewerStore((store) => store.defaultInspectDepth);
|
|
14268
14369
|
const defaultInspectControl = useJsonViewerStore((store) => store.defaultInspectControl);
|
|
14269
|
-
(0,
|
|
14370
|
+
(0, import_react49.useEffect)(() => {
|
|
14270
14371
|
const inspect2 = getInspectCache(path, nestedIndex);
|
|
14271
14372
|
if (inspect2 !== void 0) {
|
|
14272
14373
|
return;
|
|
@@ -14288,7 +14389,7 @@ function useInspect(path, value, nestedIndex) {
|
|
|
14288
14389
|
value,
|
|
14289
14390
|
setInspectCache
|
|
14290
14391
|
]);
|
|
14291
|
-
const [inspect, set] = (0,
|
|
14392
|
+
const [inspect, set] = (0, import_react49.useState)(() => {
|
|
14292
14393
|
const shouldInspect = getInspectCache(path, nestedIndex);
|
|
14293
14394
|
if (shouldInspect !== void 0) {
|
|
14294
14395
|
return shouldInspect;
|
|
@@ -14298,7 +14399,7 @@ function useInspect(path, value, nestedIndex) {
|
|
|
14298
14399
|
}
|
|
14299
14400
|
return isTrap ? false : typeof defaultInspectControl === "function" ? defaultInspectControl(path, value) : depth < defaultInspectDepth;
|
|
14300
14401
|
});
|
|
14301
|
-
const setInspect = (0,
|
|
14402
|
+
const setInspect = (0, import_react49.useCallback)((apply) => {
|
|
14302
14403
|
set((oldState) => {
|
|
14303
14404
|
const newState = typeof apply === "boolean" ? apply : apply(oldState);
|
|
14304
14405
|
setInspectCache(path, newState, nestedIndex);
|
|
@@ -14338,7 +14439,7 @@ var DataTypeLabel = (param) => {
|
|
|
14338
14439
|
};
|
|
14339
14440
|
function defineEasyType(param) {
|
|
14340
14441
|
let { is, serialize, deserialize, type, colorKey, displayTypeLabel = true, Renderer } = param;
|
|
14341
|
-
const Render = /* @__PURE__ */ (0,
|
|
14442
|
+
const Render = /* @__PURE__ */ (0, import_react49.memo)(Renderer);
|
|
14342
14443
|
const EasyType = (props) => {
|
|
14343
14444
|
const storeDisplayDataTypes = useJsonViewerStore((store) => store.displayDataTypes);
|
|
14344
14445
|
const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
|
|
@@ -14375,7 +14476,7 @@ function defineEasyType(param) {
|
|
|
14375
14476
|
const EasyTypeEditor = (param2) => {
|
|
14376
14477
|
let { value, setValue, abortEditing, commitEditing } = param2;
|
|
14377
14478
|
const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
|
|
14378
|
-
const handleKeyDown = (0,
|
|
14479
|
+
const handleKeyDown = (0, import_react49.useCallback)((event) => {
|
|
14379
14480
|
if (event.key === "Enter") {
|
|
14380
14481
|
event.preventDefault();
|
|
14381
14482
|
commitEditing(value);
|
|
@@ -14389,7 +14490,7 @@ function defineEasyType(param) {
|
|
|
14389
14490
|
commitEditing,
|
|
14390
14491
|
value
|
|
14391
14492
|
]);
|
|
14392
|
-
const handleChange = (0,
|
|
14493
|
+
const handleChange = (0, import_react49.useCallback)((event) => {
|
|
14393
14494
|
setValue(event.target.value);
|
|
14394
14495
|
}, [
|
|
14395
14496
|
setValue
|
|
@@ -14714,17 +14815,17 @@ function inspectMetadata(value) {
|
|
|
14714
14815
|
var PreObjectType = (props) => {
|
|
14715
14816
|
const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
|
|
14716
14817
|
const textColor = useTextColor();
|
|
14717
|
-
const isArrayLike = (0,
|
|
14818
|
+
const isArrayLike = (0, import_react49.useMemo)(() => Array.isArray(props.value) || props.value instanceof Set, [
|
|
14718
14819
|
props.value
|
|
14719
14820
|
]);
|
|
14720
|
-
const isEmptyValue = (0,
|
|
14821
|
+
const isEmptyValue = (0, import_react49.useMemo)(() => getValueSize(props.value) === 0, [
|
|
14721
14822
|
props.value
|
|
14722
14823
|
]);
|
|
14723
|
-
const sizeOfValue = (0,
|
|
14824
|
+
const sizeOfValue = (0, import_react49.useMemo)(() => inspectMetadata(props.value), [
|
|
14724
14825
|
props.value
|
|
14725
14826
|
]);
|
|
14726
14827
|
const displaySize = useJsonViewerStore((store) => store.displaySize);
|
|
14727
|
-
const shouldDisplaySize = (0,
|
|
14828
|
+
const shouldDisplaySize = (0, import_react49.useMemo)(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
|
|
14728
14829
|
displaySize,
|
|
14729
14830
|
props.path,
|
|
14730
14831
|
props.value
|
|
@@ -14772,17 +14873,17 @@ var PreObjectType = (props) => {
|
|
|
14772
14873
|
var PostObjectType = (props) => {
|
|
14773
14874
|
const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
|
|
14774
14875
|
const textColor = useTextColor();
|
|
14775
|
-
const isArrayLike = (0,
|
|
14876
|
+
const isArrayLike = (0, import_react49.useMemo)(() => Array.isArray(props.value) || props.value instanceof Set, [
|
|
14776
14877
|
props.value
|
|
14777
14878
|
]);
|
|
14778
|
-
const isEmptyValue = (0,
|
|
14879
|
+
const isEmptyValue = (0, import_react49.useMemo)(() => getValueSize(props.value) === 0, [
|
|
14779
14880
|
props.value
|
|
14780
14881
|
]);
|
|
14781
|
-
const sizeOfValue = (0,
|
|
14882
|
+
const sizeOfValue = (0, import_react49.useMemo)(() => inspectMetadata(props.value), [
|
|
14782
14883
|
props.value
|
|
14783
14884
|
]);
|
|
14784
14885
|
const displaySize = useJsonViewerStore((store) => store.displaySize);
|
|
14785
|
-
const shouldDisplaySize = (0,
|
|
14886
|
+
const shouldDisplaySize = (0, import_react49.useMemo)(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
|
|
14786
14887
|
displaySize,
|
|
14787
14888
|
props.path,
|
|
14788
14889
|
props.value
|
|
@@ -14819,9 +14920,9 @@ var ObjectType = (props) => {
|
|
|
14819
14920
|
const borderColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14820
14921
|
const groupArraysAfterLength = useJsonViewerStore((store) => store.groupArraysAfterLength);
|
|
14821
14922
|
const isTrap = useIsCycleReference(props.path, props.value);
|
|
14822
|
-
const [displayLength, setDisplayLength] = (0,
|
|
14923
|
+
const [displayLength, setDisplayLength] = (0, import_react49.useState)(useJsonViewerStore((store) => store.maxDisplayLength));
|
|
14823
14924
|
const objectSortKeys = useJsonViewerStore((store) => store.objectSortKeys);
|
|
14824
|
-
const elements = (0,
|
|
14925
|
+
const elements = (0, import_react49.useMemo)(() => {
|
|
14825
14926
|
if (!props.inspect) {
|
|
14826
14927
|
return null;
|
|
14827
14928
|
}
|
|
@@ -14982,7 +15083,7 @@ var ObjectType = (props) => {
|
|
|
14982
15083
|
const marginLeft = props.inspect ? 0.6 : 0;
|
|
14983
15084
|
const width = useJsonViewerStore((store) => store.indentWidth);
|
|
14984
15085
|
const indentWidth = props.inspect ? width - marginLeft : width;
|
|
14985
|
-
const isEmptyValue = (0,
|
|
15086
|
+
const isEmptyValue = (0, import_react49.useMemo)(() => getValueSize(props.value) === 0, [
|
|
14986
15087
|
props.value
|
|
14987
15088
|
]);
|
|
14988
15089
|
if (isEmptyValue) {
|
|
@@ -15025,7 +15126,7 @@ var stringType = defineEasyType({
|
|
|
15025
15126
|
serialize: (value) => value,
|
|
15026
15127
|
deserialize: (value) => value,
|
|
15027
15128
|
Renderer: (props) => {
|
|
15028
|
-
const [showRest, setShowRest] = (0,
|
|
15129
|
+
const [showRest, setShowRest] = (0, import_react49.useState)(false);
|
|
15029
15130
|
const collapseStringsAfterLength = useJsonViewerStore((store) => store.collapseStringsAfterLength);
|
|
15030
15131
|
const value = showRest ? props.value : props.value.slice(0, collapseStringsAfterLength);
|
|
15031
15132
|
const hasRest = props.value.length > collapseStringsAfterLength;
|
|
@@ -15082,17 +15183,17 @@ function memorizeDataType(dataType) {
|
|
|
15082
15183
|
var _prevProps_path, _nextProps_path;
|
|
15083
15184
|
return Object.is(prevProps.value, nextProps.value) && prevProps.inspect && nextProps.inspect && ((_prevProps_path = prevProps.path) === null || _prevProps_path === void 0 ? void 0 : _prevProps_path.join(".")) === ((_nextProps_path = nextProps.path) === null || _nextProps_path === void 0 ? void 0 : _nextProps_path.join("."));
|
|
15084
15185
|
}
|
|
15085
|
-
dataType.Component = /* @__PURE__ */ (0,
|
|
15186
|
+
dataType.Component = /* @__PURE__ */ (0, import_react49.memo)(dataType.Component, compare);
|
|
15086
15187
|
if (dataType.Editor) {
|
|
15087
|
-
dataType.Editor = /* @__PURE__ */ (0,
|
|
15188
|
+
dataType.Editor = /* @__PURE__ */ (0, import_react49.memo)(dataType.Editor, function compare2(prevProps, nextProps) {
|
|
15088
15189
|
return Object.is(prevProps.value, nextProps.value);
|
|
15089
15190
|
});
|
|
15090
15191
|
}
|
|
15091
15192
|
if (dataType.PreComponent) {
|
|
15092
|
-
dataType.PreComponent = /* @__PURE__ */ (0,
|
|
15193
|
+
dataType.PreComponent = /* @__PURE__ */ (0, import_react49.memo)(dataType.PreComponent, compare);
|
|
15093
15194
|
}
|
|
15094
15195
|
if (dataType.PostComponent) {
|
|
15095
|
-
dataType.PostComponent = /* @__PURE__ */ (0,
|
|
15196
|
+
dataType.PostComponent = /* @__PURE__ */ (0, import_react49.memo)(dataType.PostComponent, compare);
|
|
15096
15197
|
}
|
|
15097
15198
|
return dataType;
|
|
15098
15199
|
}
|
|
@@ -15118,10 +15219,10 @@ var createTypeRegistryStore = () => {
|
|
|
15118
15219
|
}
|
|
15119
15220
|
}));
|
|
15120
15221
|
};
|
|
15121
|
-
var TypeRegistryStoreContext = /* @__PURE__ */ (0,
|
|
15222
|
+
var TypeRegistryStoreContext = /* @__PURE__ */ (0, import_react49.createContext)(void 0);
|
|
15122
15223
|
TypeRegistryStoreContext.Provider;
|
|
15123
15224
|
var useTypeRegistryStore = (selector2, equalityFn) => {
|
|
15124
|
-
const store = (0,
|
|
15225
|
+
const store = (0, import_react49.useContext)(TypeRegistryStoreContext);
|
|
15125
15226
|
return (0, import_zustand.useStore)(store, selector2, equalityFn);
|
|
15126
15227
|
};
|
|
15127
15228
|
function matchTypeComponents(value, path, registry) {
|
|
@@ -15141,7 +15242,7 @@ function matchTypeComponents(value, path, registry) {
|
|
|
15141
15242
|
}
|
|
15142
15243
|
function useTypeComponents(value, path) {
|
|
15143
15244
|
const registry = useTypeRegistryStore((store) => store.registry);
|
|
15144
|
-
return (0,
|
|
15245
|
+
return (0, import_react49.useMemo)(() => matchTypeComponents(value, path, registry), [
|
|
15145
15246
|
value,
|
|
15146
15247
|
path,
|
|
15147
15248
|
registry
|
|
@@ -15162,7 +15263,7 @@ var DataKeyPair = (props) => {
|
|
|
15162
15263
|
var _props_editable;
|
|
15163
15264
|
const propsEditable = (_props_editable = props.editable) !== null && _props_editable !== void 0 ? _props_editable : void 0;
|
|
15164
15265
|
const storeEditable = useJsonViewerStore((store) => store.editable);
|
|
15165
|
-
const editable = (0,
|
|
15266
|
+
const editable = (0, import_react49.useMemo)(() => {
|
|
15166
15267
|
if (storeEditable === false) {
|
|
15167
15268
|
return false;
|
|
15168
15269
|
}
|
|
@@ -15179,11 +15280,11 @@ var DataKeyPair = (props) => {
|
|
|
15179
15280
|
storeEditable,
|
|
15180
15281
|
value
|
|
15181
15282
|
]);
|
|
15182
|
-
const [tempValue, setTempValue] = (0,
|
|
15283
|
+
const [tempValue, setTempValue] = (0, import_react49.useState)("");
|
|
15183
15284
|
const depth = path.length;
|
|
15184
15285
|
const key = path[depth - 1];
|
|
15185
15286
|
const hoverPath = useJsonViewerStore((store) => store.hoverPath);
|
|
15186
|
-
const isHover = (0,
|
|
15287
|
+
const isHover = (0, import_react49.useMemo)(() => {
|
|
15187
15288
|
return hoverPath && path.every((value2, index) => value2 === hoverPath.path[index] && nestedIndex === hoverPath.nestedIndex);
|
|
15188
15289
|
}, [
|
|
15189
15290
|
hoverPath,
|
|
@@ -15193,7 +15294,7 @@ var DataKeyPair = (props) => {
|
|
|
15193
15294
|
const setHover = useJsonViewerStore((store) => store.setHover);
|
|
15194
15295
|
const root = useJsonViewerStore((store) => store.value);
|
|
15195
15296
|
const [inspect, setInspect] = useInspect(path, value, nestedIndex);
|
|
15196
|
-
const [editing, setEditing] = (0,
|
|
15297
|
+
const [editing, setEditing] = (0, import_react49.useState)(false);
|
|
15197
15298
|
const onChange = useJsonViewerStore((store) => store.onChange);
|
|
15198
15299
|
const keyColor = useTextColor();
|
|
15199
15300
|
const numberKeyColor = useJsonViewerStore((store) => store.colorspace.base0C);
|
|
@@ -15205,7 +15306,7 @@ var DataKeyPair = (props) => {
|
|
|
15205
15306
|
const isNumberKey = Number.isInteger(Number(key));
|
|
15206
15307
|
const storeEnableAdd = useJsonViewerStore((store) => store.enableAdd);
|
|
15207
15308
|
const onAdd = useJsonViewerStore((store) => store.onAdd);
|
|
15208
|
-
const enableAdd = (0,
|
|
15309
|
+
const enableAdd = (0, import_react49.useMemo)(() => {
|
|
15209
15310
|
if (!onAdd || nestedIndex !== void 0) return false;
|
|
15210
15311
|
if (storeEnableAdd === false) {
|
|
15211
15312
|
return false;
|
|
@@ -15230,7 +15331,7 @@ var DataKeyPair = (props) => {
|
|
|
15230
15331
|
]);
|
|
15231
15332
|
const storeEnableDelete = useJsonViewerStore((store) => store.enableDelete);
|
|
15232
15333
|
const onDelete = useJsonViewerStore((store) => store.onDelete);
|
|
15233
|
-
const enableDelete = (0,
|
|
15334
|
+
const enableDelete = (0, import_react49.useMemo)(() => {
|
|
15234
15335
|
if (!onDelete || nestedIndex !== void 0) return false;
|
|
15235
15336
|
if (isRoot) {
|
|
15236
15337
|
return false;
|
|
@@ -15257,7 +15358,7 @@ var DataKeyPair = (props) => {
|
|
|
15257
15358
|
const enableClipboard = useJsonViewerStore((store) => store.enableClipboard);
|
|
15258
15359
|
const { copy, copied } = useClipboard();
|
|
15259
15360
|
const highlightUpdates = useJsonViewerStore((store) => store.highlightUpdates);
|
|
15260
|
-
const isHighlight = (0,
|
|
15361
|
+
const isHighlight = (0, import_react49.useMemo)(() => {
|
|
15261
15362
|
if (!highlightUpdates || prevValue === void 0) return false;
|
|
15262
15363
|
if (typeof value !== typeof prevValue) {
|
|
15263
15364
|
return true;
|
|
@@ -15281,8 +15382,8 @@ var DataKeyPair = (props) => {
|
|
|
15281
15382
|
prevValue,
|
|
15282
15383
|
value
|
|
15283
15384
|
]);
|
|
15284
|
-
const highlightContainer = (0,
|
|
15285
|
-
(0,
|
|
15385
|
+
const highlightContainer = (0, import_react49.useRef)();
|
|
15386
|
+
(0, import_react49.useEffect)(() => {
|
|
15286
15387
|
if (highlightContainer.current && isHighlight && "animate" in highlightContainer.current) {
|
|
15287
15388
|
highlightContainer.current.animate([
|
|
15288
15389
|
{
|
|
@@ -15302,7 +15403,7 @@ var DataKeyPair = (props) => {
|
|
|
15302
15403
|
prevValue,
|
|
15303
15404
|
value
|
|
15304
15405
|
]);
|
|
15305
|
-
const startEditing = (0,
|
|
15406
|
+
const startEditing = (0, import_react49.useCallback)((event) => {
|
|
15306
15407
|
event.preventDefault();
|
|
15307
15408
|
if (serialize) setTempValue(serialize(value));
|
|
15308
15409
|
setEditing(true);
|
|
@@ -15310,14 +15411,14 @@ var DataKeyPair = (props) => {
|
|
|
15310
15411
|
serialize,
|
|
15311
15412
|
value
|
|
15312
15413
|
]);
|
|
15313
|
-
const abortEditing = (0,
|
|
15414
|
+
const abortEditing = (0, import_react49.useCallback)(() => {
|
|
15314
15415
|
setEditing(false);
|
|
15315
15416
|
setTempValue("");
|
|
15316
15417
|
}, [
|
|
15317
15418
|
setEditing,
|
|
15318
15419
|
setTempValue
|
|
15319
15420
|
]);
|
|
15320
|
-
const commitEditing = (0,
|
|
15421
|
+
const commitEditing = (0, import_react49.useCallback)((newValue) => {
|
|
15321
15422
|
setEditing(false);
|
|
15322
15423
|
if (!deserialize) return;
|
|
15323
15424
|
try {
|
|
@@ -15331,7 +15432,7 @@ var DataKeyPair = (props) => {
|
|
|
15331
15432
|
path,
|
|
15332
15433
|
value
|
|
15333
15434
|
]);
|
|
15334
|
-
const actionIcons = (0,
|
|
15435
|
+
const actionIcons = (0, import_react49.useMemo)(() => {
|
|
15335
15436
|
if (editing) {
|
|
15336
15437
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, {
|
|
15337
15438
|
children: [
|
|
@@ -15427,12 +15528,12 @@ var DataKeyPair = (props) => {
|
|
|
15427
15528
|
abortEditing,
|
|
15428
15529
|
commitEditing
|
|
15429
15530
|
]);
|
|
15430
|
-
const isEmptyValue = (0,
|
|
15531
|
+
const isEmptyValue = (0, import_react49.useMemo)(() => getValueSize(value) === 0, [
|
|
15431
15532
|
value
|
|
15432
15533
|
]);
|
|
15433
15534
|
const expandable = !isEmptyValue && !!(PreComponent && PostComponent);
|
|
15434
15535
|
const KeyRenderer = useJsonViewerStore((store) => store.keyRenderer);
|
|
15435
|
-
const downstreamProps = (0,
|
|
15536
|
+
const downstreamProps = (0, import_react49.useMemo)(() => ({
|
|
15436
15537
|
path,
|
|
15437
15538
|
inspect,
|
|
15438
15539
|
setInspect,
|
|
@@ -15453,7 +15554,7 @@ var DataKeyPair = (props) => {
|
|
|
15453
15554
|
sx: {
|
|
15454
15555
|
userSelect: "text"
|
|
15455
15556
|
},
|
|
15456
|
-
onMouseEnter: (0,
|
|
15557
|
+
onMouseEnter: (0, import_react49.useCallback)(() => setHover(path, nestedIndex), [
|
|
15457
15558
|
setHover,
|
|
15458
15559
|
path,
|
|
15459
15560
|
nestedIndex
|
|
@@ -15468,7 +15569,7 @@ var DataKeyPair = (props) => {
|
|
|
15468
15569
|
letterSpacing: 0.5,
|
|
15469
15570
|
opacity: 0.8
|
|
15470
15571
|
},
|
|
15471
|
-
onClick: (0,
|
|
15572
|
+
onClick: (0, import_react49.useCallback)((event) => {
|
|
15472
15573
|
if (event.isDefaultPrevented()) {
|
|
15473
15574
|
return;
|
|
15474
15575
|
}
|
|
@@ -15578,8 +15679,8 @@ var DataKeyPair = (props) => {
|
|
|
15578
15679
|
};
|
|
15579
15680
|
var query = "(prefers-color-scheme: dark)";
|
|
15580
15681
|
function useThemeDetector() {
|
|
15581
|
-
const [isDark, setIsDark] = (0,
|
|
15582
|
-
(0,
|
|
15682
|
+
const [isDark, setIsDark] = (0, import_react49.useState)(false);
|
|
15683
|
+
(0, import_react49.useEffect)(() => {
|
|
15583
15684
|
const listener = (e2) => setIsDark(e2.matches);
|
|
15584
15685
|
setIsDark(window.matchMedia(query).matches);
|
|
15585
15686
|
const queryMedia = window.matchMedia(query);
|
|
@@ -15589,8 +15690,8 @@ function useThemeDetector() {
|
|
|
15589
15690
|
return isDark;
|
|
15590
15691
|
}
|
|
15591
15692
|
function useSetIfNotUndefinedEffect(key, value) {
|
|
15592
|
-
const { setState } = (0,
|
|
15593
|
-
(0,
|
|
15693
|
+
const { setState } = (0, import_react49.useContext)(JsonViewerStoreContext);
|
|
15694
|
+
(0, import_react49.useEffect)(() => {
|
|
15594
15695
|
if (value !== void 0) {
|
|
15595
15696
|
setState({
|
|
15596
15697
|
[key]: value
|
|
@@ -15603,8 +15704,8 @@ function useSetIfNotUndefinedEffect(key, value) {
|
|
|
15603
15704
|
]);
|
|
15604
15705
|
}
|
|
15605
15706
|
var JsonViewerInner = (props) => {
|
|
15606
|
-
const { setState } = (0,
|
|
15607
|
-
(0,
|
|
15707
|
+
const { setState } = (0, import_react49.useContext)(JsonViewerStoreContext);
|
|
15708
|
+
(0, import_react49.useEffect)(() => {
|
|
15608
15709
|
setState((state) => ({
|
|
15609
15710
|
prevValue: state.value,
|
|
15610
15711
|
value: props.value
|
|
@@ -15632,7 +15733,7 @@ var JsonViewerInner = (props) => {
|
|
|
15632
15733
|
useSetIfNotUndefinedEffect("displaySize", props.displaySize);
|
|
15633
15734
|
useSetIfNotUndefinedEffect("displayComma", props.displayComma);
|
|
15634
15735
|
useSetIfNotUndefinedEffect("highlightUpdates", props.highlightUpdates);
|
|
15635
|
-
(0,
|
|
15736
|
+
(0, import_react49.useEffect)(() => {
|
|
15636
15737
|
if (props.theme === "light") {
|
|
15637
15738
|
setState({
|
|
15638
15739
|
colorspace: lightColorspace
|
|
@@ -15650,13 +15751,13 @@ var JsonViewerInner = (props) => {
|
|
|
15650
15751
|
setState,
|
|
15651
15752
|
props.theme
|
|
15652
15753
|
]);
|
|
15653
|
-
const themeCls = (0,
|
|
15754
|
+
const themeCls = (0, import_react49.useMemo)(() => {
|
|
15654
15755
|
if (typeof props.theme === "object") return "json-viewer-theme-custom";
|
|
15655
15756
|
return props.theme === "dark" ? "json-viewer-theme-dark" : "json-viewer-theme-light";
|
|
15656
15757
|
}, [
|
|
15657
15758
|
props.theme
|
|
15658
15759
|
]);
|
|
15659
|
-
const onceRef = (0,
|
|
15760
|
+
const onceRef = (0, import_react49.useRef)(true);
|
|
15660
15761
|
const registerTypes = useTypeRegistryStore((store) => store.registerTypes);
|
|
15661
15762
|
if (onceRef.current) {
|
|
15662
15763
|
const allTypes = props.valueTypes ? [
|
|
@@ -15668,7 +15769,7 @@ var JsonViewerInner = (props) => {
|
|
|
15668
15769
|
registerTypes(allTypes);
|
|
15669
15770
|
onceRef.current = false;
|
|
15670
15771
|
}
|
|
15671
|
-
(0,
|
|
15772
|
+
(0, import_react49.useEffect)(() => {
|
|
15672
15773
|
const allTypes = props.valueTypes ? [
|
|
15673
15774
|
...predefinedTypes,
|
|
15674
15775
|
...props.valueTypes
|
|
@@ -15682,9 +15783,9 @@ var JsonViewerInner = (props) => {
|
|
|
15682
15783
|
]);
|
|
15683
15784
|
const value = useJsonViewerStore((store) => store.value);
|
|
15684
15785
|
const prevValue = useJsonViewerStore((store) => store.prevValue);
|
|
15685
|
-
const emptyPath = (0,
|
|
15786
|
+
const emptyPath = (0, import_react49.useMemo)(() => [], []);
|
|
15686
15787
|
const setHover = useJsonViewerStore((store) => store.setHover);
|
|
15687
|
-
const onMouseLeave = (0,
|
|
15788
|
+
const onMouseLeave = (0, import_react49.useCallback)(() => setHover(null), [
|
|
15688
15789
|
setHover
|
|
15689
15790
|
]);
|
|
15690
15791
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Paper, {
|
|
@@ -15713,14 +15814,14 @@ var JsonViewer = function JsonViewer2(props) {
|
|
|
15713
15814
|
}
|
|
15714
15815
|
}
|
|
15715
15816
|
const isAutoDarkTheme = useThemeDetector();
|
|
15716
|
-
const themeType = (0,
|
|
15817
|
+
const themeType = (0, import_react49.useMemo)(() => {
|
|
15717
15818
|
var _props_theme;
|
|
15718
15819
|
return props.theme === "auto" ? isAutoDarkTheme ? "dark" : "light" : (_props_theme = props.theme) !== null && _props_theme !== void 0 ? _props_theme : "light";
|
|
15719
15820
|
}, [
|
|
15720
15821
|
isAutoDarkTheme,
|
|
15721
15822
|
props.theme
|
|
15722
15823
|
]);
|
|
15723
|
-
const theme = (0,
|
|
15824
|
+
const theme = (0, import_react49.useMemo)(() => {
|
|
15724
15825
|
const backgroundColor = typeof themeType === "object" ? themeType.base00 : themeType === "dark" ? darkColorspace.base00 : lightColorspace.base00;
|
|
15725
15826
|
const foregroundColor = typeof themeType === "object" ? themeType.base07 : themeType === "dark" ? darkColorspace.base07 : lightColorspace.base07;
|
|
15726
15827
|
return (0, import_material7.createTheme)({
|
|
@@ -15748,8 +15849,8 @@ var JsonViewer = function JsonViewer2(props) {
|
|
|
15748
15849
|
...props,
|
|
15749
15850
|
theme: themeType
|
|
15750
15851
|
};
|
|
15751
|
-
const jsonViewerStore = (0,
|
|
15752
|
-
const typeRegistryStore = (0,
|
|
15852
|
+
const jsonViewerStore = (0, import_react49.useMemo)(() => createJsonViewerStore(props), []);
|
|
15853
|
+
const typeRegistryStore = (0, import_react49.useMemo)(() => createTypeRegistryStore(), []);
|
|
15753
15854
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.ThemeProvider, {
|
|
15754
15855
|
theme,
|
|
15755
15856
|
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(TypeRegistryStoreContext.Provider, {
|
|
@@ -15765,7 +15866,7 @@ var JsonViewer = function JsonViewer2(props) {
|
|
|
15765
15866
|
};
|
|
15766
15867
|
|
|
15767
15868
|
// src/components/event-details/event-details.tsx
|
|
15768
|
-
var
|
|
15869
|
+
var import_react54 = require("react");
|
|
15769
15870
|
|
|
15770
15871
|
// src/utils/iam-utils.ts
|
|
15771
15872
|
function determinePermissionStatus(payload) {
|
|
@@ -15964,7 +16065,7 @@ var getEventGroupsByType = (events) => {
|
|
|
15964
16065
|
// src/components/event-details/event-detail.tsx
|
|
15965
16066
|
var import_icons_material6 = require("@mui/icons-material");
|
|
15966
16067
|
var import_material11 = require("@mui/material");
|
|
15967
|
-
var
|
|
16068
|
+
var import_react51 = require("react");
|
|
15968
16069
|
|
|
15969
16070
|
// src/components/status-icon.tsx
|
|
15970
16071
|
var import_icons_material3 = require("@mui/icons-material");
|
|
@@ -16115,7 +16216,7 @@ var IAMEventDetail = ({ event }) => {
|
|
|
16115
16216
|
// src/components/event-details/iam-permission-detail.tsx
|
|
16116
16217
|
var import_icons_material5 = require("@mui/icons-material");
|
|
16117
16218
|
var import_material10 = require("@mui/material");
|
|
16118
|
-
var
|
|
16219
|
+
var import_react50 = require("react");
|
|
16119
16220
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
16120
16221
|
var getChipColors = (status) => {
|
|
16121
16222
|
const isAllowed = status === "explicitly_allowed" || status === "implicitly_allowed";
|
|
@@ -16125,8 +16226,8 @@ var getChipColors = (status) => {
|
|
|
16125
16226
|
};
|
|
16126
16227
|
};
|
|
16127
16228
|
var IAMPermissionItem = ({ event }) => {
|
|
16128
|
-
const [isOpen, setIsOpen] = (0,
|
|
16129
|
-
const parsedData = (0,
|
|
16229
|
+
const [isOpen, setIsOpen] = (0, import_react50.useState)(false);
|
|
16230
|
+
const parsedData = (0, import_react50.useMemo)(() => {
|
|
16130
16231
|
const payloadString = event.attributes?.payload;
|
|
16131
16232
|
if (!payloadString) {
|
|
16132
16233
|
return;
|
|
@@ -16196,15 +16297,15 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime1
|
|
|
16196
16297
|
) : content })
|
|
16197
16298
|
] });
|
|
16198
16299
|
var EventMessage = ({ event }) => {
|
|
16199
|
-
const [isOpen, setIsOpen] = (0,
|
|
16200
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
16201
|
-
const textReference = (0,
|
|
16202
|
-
const parsedMessage = (0,
|
|
16203
|
-
const isIAMPolicyEvent = (0,
|
|
16300
|
+
const [isOpen, setIsOpen] = (0, import_react51.useState)(false);
|
|
16301
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react51.useState)(false);
|
|
16302
|
+
const textReference = (0, import_react51.useRef)(null);
|
|
16303
|
+
const parsedMessage = (0, import_react51.useMemo)(() => parseEventMessage(event), [event]);
|
|
16304
|
+
const isIAMPolicyEvent = (0, import_react51.useMemo)(
|
|
16204
16305
|
() => event.event_type === "iam.policy_evaluation" && event.attributes?.payload && typeof event.attributes.payload === "string",
|
|
16205
16306
|
[event]
|
|
16206
16307
|
);
|
|
16207
|
-
(0,
|
|
16308
|
+
(0, import_react51.useEffect)(() => {
|
|
16208
16309
|
const checkOverflow = () => {
|
|
16209
16310
|
const element = textReference.current;
|
|
16210
16311
|
if (element) {
|
|
@@ -16217,11 +16318,11 @@ var EventMessage = ({ event }) => {
|
|
|
16217
16318
|
window.removeEventListener("resize", checkOverflow);
|
|
16218
16319
|
};
|
|
16219
16320
|
}, [parsedMessage.headline]);
|
|
16220
|
-
const hasAdditionalContent = (0,
|
|
16321
|
+
const hasAdditionalContent = (0, import_react51.useMemo)(
|
|
16221
16322
|
() => parsedMessage.message || parsedMessage.details || isIAMPolicyEvent,
|
|
16222
16323
|
[parsedMessage.message, parsedMessage.details, isIAMPolicyEvent]
|
|
16223
16324
|
);
|
|
16224
|
-
const shouldShowToggle = (0,
|
|
16325
|
+
const shouldShowToggle = (0, import_react51.useMemo)(
|
|
16225
16326
|
() => isOverflowing || hasAdditionalContent,
|
|
16226
16327
|
[isOverflowing, hasAdditionalContent]
|
|
16227
16328
|
);
|
|
@@ -26048,7 +26149,7 @@ var QueryStatus = {
|
|
|
26048
26149
|
|
|
26049
26150
|
// src/components/event-details/lambda-invoke-logs-section.tsx
|
|
26050
26151
|
var import_material12 = require("@mui/material");
|
|
26051
|
-
var
|
|
26152
|
+
var import_react52 = require("react");
|
|
26052
26153
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
26053
26154
|
var POLL_INTERVAL_MS = 1e3;
|
|
26054
26155
|
async function pollQueryResults(client, queryId) {
|
|
@@ -26066,7 +26167,7 @@ async function startLambdaLogsQuery(client, functionName2, requestId, startTimeS
|
|
|
26066
26167
|
}
|
|
26067
26168
|
function useCloudWatchLogsClient(region) {
|
|
26068
26169
|
const { localstackEndpoint } = useAppInspector();
|
|
26069
|
-
const client = (0,
|
|
26170
|
+
const client = (0, import_react52.useMemo)(() => new CloudWatchLogsClient({
|
|
26070
26171
|
credentials: {
|
|
26071
26172
|
accessKeyId: "test",
|
|
26072
26173
|
secretAccessKey: "test"
|
|
@@ -26077,12 +26178,12 @@ function useCloudWatchLogsClient(region) {
|
|
|
26077
26178
|
return client;
|
|
26078
26179
|
}
|
|
26079
26180
|
function useLambdaInvokeLogs(functionName2, requestId, region, startTimeNano, endTimeNano) {
|
|
26080
|
-
const [loading, setLoading] = (0,
|
|
26081
|
-
const [logs, setLogs] = (0,
|
|
26082
|
-
const [error, setError] = (0,
|
|
26083
|
-
const pollTimerRef = (0,
|
|
26181
|
+
const [loading, setLoading] = (0, import_react52.useState)(true);
|
|
26182
|
+
const [logs, setLogs] = (0, import_react52.useState)([]);
|
|
26183
|
+
const [error, setError] = (0, import_react52.useState)();
|
|
26184
|
+
const pollTimerRef = (0, import_react52.useRef)(null);
|
|
26084
26185
|
const cloudWatchLogs = useCloudWatchLogsClient(region);
|
|
26085
|
-
(0,
|
|
26186
|
+
(0, import_react52.useEffect)(() => {
|
|
26086
26187
|
let cancelled = false;
|
|
26087
26188
|
const startTimeSec = Math.floor(Number(BigInt(startTimeNano) / BigInt(1e9)));
|
|
26088
26189
|
const endTimeSec = Math.ceil(Number(BigInt(endTimeNano) / BigInt(1e9)));
|
|
@@ -26156,10 +26257,10 @@ var LambdaInvokeLogsSection = ({ endTimeNano, functionName: functionName2, regio
|
|
|
26156
26257
|
// src/components/event-details/toggle-section.tsx
|
|
26157
26258
|
var import_icons_material7 = require("@mui/icons-material");
|
|
26158
26259
|
var import_material13 = require("@mui/material");
|
|
26159
|
-
var
|
|
26260
|
+
var import_react53 = require("react");
|
|
26160
26261
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
26161
26262
|
var ToggleSection = ({ action, children, headline, initialOpen = true }) => {
|
|
26162
|
-
const [isOpen, setIsOpen] = (0,
|
|
26263
|
+
const [isOpen, setIsOpen] = (0, import_react53.useState)(initialOpen);
|
|
26163
26264
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { sx: { mt: 4 }, children: [
|
|
26164
26265
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
26165
26266
|
import_material13.Box,
|
|
@@ -26226,11 +26327,11 @@ var checkIsSqsSendMessage = (span) => {
|
|
|
26226
26327
|
return span.operation_name.startsWith("SendMessage");
|
|
26227
26328
|
};
|
|
26228
26329
|
var EventDetails = ({ onClose, selectedEvent }) => {
|
|
26229
|
-
const eventGroups = (0,
|
|
26330
|
+
const eventGroups = (0, import_react54.useMemo)(
|
|
26230
26331
|
() => getEventGroupsByType(selectedEvent?.events ?? []),
|
|
26231
26332
|
[selectedEvent?.events]
|
|
26232
26333
|
);
|
|
26233
|
-
const [parseNestedJson, setParseNestedJson] = (0,
|
|
26334
|
+
const [parseNestedJson, setParseNestedJson] = (0, import_react54.useState)(true);
|
|
26234
26335
|
if (!selectedEvent) {
|
|
26235
26336
|
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { sx: { p: 3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { color: "text.secondary", variant: "body2", children: "Select an event to view details" }) });
|
|
26236
26337
|
}
|
|
@@ -26399,7 +26500,7 @@ var EventDetails = ({ onClose, selectedEvent }) => {
|
|
|
26399
26500
|
] }) })
|
|
26400
26501
|
] });
|
|
26401
26502
|
};
|
|
26402
|
-
var PayloadViewer = (0,
|
|
26503
|
+
var PayloadViewer = (0, import_react54.memo)(({ value }) => {
|
|
26403
26504
|
const theme = (0, import_material14.useTheme)();
|
|
26404
26505
|
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
26405
26506
|
JsonViewer,
|
|
@@ -26417,22 +26518,22 @@ var PayloadViewer = (0, import_react53.memo)(({ value }) => {
|
|
|
26417
26518
|
// src/components/trace-graph/trace-graph.tsx
|
|
26418
26519
|
var import_base = require("@xyflow/react/dist/base.css");
|
|
26419
26520
|
var import_material18 = require("@mui/material");
|
|
26420
|
-
var
|
|
26421
|
-
var
|
|
26521
|
+
var import_react60 = require("@xyflow/react");
|
|
26522
|
+
var import_react61 = require("react");
|
|
26422
26523
|
|
|
26423
26524
|
// src/components/trace-graph/service-node.tsx
|
|
26424
26525
|
var import_material16 = require("@mui/material");
|
|
26425
26526
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
26426
|
-
var
|
|
26427
|
-
var
|
|
26527
|
+
var import_react56 = require("@xyflow/react");
|
|
26528
|
+
var import_react57 = require("react");
|
|
26428
26529
|
|
|
26429
26530
|
// src/components/trace-graph/problem-indicator.tsx
|
|
26430
26531
|
var import_icons_material9 = require("@mui/icons-material");
|
|
26431
26532
|
var import_material15 = require("@mui/material");
|
|
26432
|
-
var
|
|
26533
|
+
var import_react55 = require("react");
|
|
26433
26534
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
26434
26535
|
var ProblemIndicator = ({ error }) => {
|
|
26435
|
-
const icon = (0,
|
|
26536
|
+
const icon = (0, import_react55.useMemo)(() => {
|
|
26436
26537
|
switch (error.level) {
|
|
26437
26538
|
case "error": {
|
|
26438
26539
|
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Error, { sx: { color: "#d32f2f", fontSize: "14px" } });
|
|
@@ -26445,7 +26546,7 @@ var ProblemIndicator = ({ error }) => {
|
|
|
26445
26546
|
}
|
|
26446
26547
|
}
|
|
26447
26548
|
}, [error.level]);
|
|
26448
|
-
const color2 = (0,
|
|
26549
|
+
const color2 = (0, import_react55.useMemo)(() => {
|
|
26449
26550
|
switch (error.level) {
|
|
26450
26551
|
case "error": {
|
|
26451
26552
|
return "#d32f2f";
|
|
@@ -26484,7 +26585,7 @@ var handleStyle = {
|
|
|
26484
26585
|
borderColor: "lightgray",
|
|
26485
26586
|
opacity: 0
|
|
26486
26587
|
};
|
|
26487
|
-
var ServiceNode = (0,
|
|
26588
|
+
var ServiceNode = (0, import_react57.memo)(({ data, selected }) => {
|
|
26488
26589
|
const hasErrors = (data.event.errors && data.event.errors.length > 0) ?? false;
|
|
26489
26590
|
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { sx: { maxWidth: 200 }, children: [
|
|
26490
26591
|
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
@@ -26508,8 +26609,8 @@ var ServiceNode = (0, import_react56.memo)(({ data, selected }) => {
|
|
|
26508
26609
|
},
|
|
26509
26610
|
tabIndex: 0,
|
|
26510
26611
|
children: [
|
|
26511
|
-
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
26512
|
-
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
26612
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_react56.Handle, { position: import_react56.Position.Left, style: handleStyle, type: "target" }),
|
|
26613
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_react56.Handle, { position: import_react56.Position.Right, style: handleStyle, type: "source" }),
|
|
26513
26614
|
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
26514
26615
|
ServiceCell,
|
|
26515
26616
|
{
|
|
@@ -26599,8 +26700,8 @@ var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
|
|
|
26599
26700
|
// src/components/trace-graph/xyflow/controls.tsx
|
|
26600
26701
|
var import_icons_material10 = require("@mui/icons-material");
|
|
26601
26702
|
var import_material17 = require("@mui/material");
|
|
26602
|
-
var
|
|
26603
|
-
var
|
|
26703
|
+
var import_react58 = require("@xyflow/react");
|
|
26704
|
+
var import_react59 = require("react");
|
|
26604
26705
|
var import_shallow = require("zustand/shallow");
|
|
26605
26706
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
26606
26707
|
var selector = (s2) => ({
|
|
@@ -26608,9 +26709,9 @@ var selector = (s2) => ({
|
|
|
26608
26709
|
maxZoomReached: s2.transform[2] >= s2.maxZoom,
|
|
26609
26710
|
minZoomReached: s2.transform[2] <= s2.minZoom
|
|
26610
26711
|
});
|
|
26611
|
-
var Controls = (0,
|
|
26612
|
-
const { maxZoomReached, minZoomReached } = (0,
|
|
26613
|
-
const { fitView, zoomIn, zoomOut } = (0,
|
|
26712
|
+
var Controls = (0, import_react59.memo)(() => {
|
|
26713
|
+
const { maxZoomReached, minZoomReached } = (0, import_react58.useStore)(selector, import_shallow.shallow);
|
|
26714
|
+
const { fitView, zoomIn, zoomOut } = (0, import_react58.useReactFlow)();
|
|
26614
26715
|
const onZoomInHandler = () => {
|
|
26615
26716
|
void zoomIn();
|
|
26616
26717
|
};
|
|
@@ -26679,9 +26780,9 @@ var TraceGraph = ({
|
|
|
26679
26780
|
onRefresh,
|
|
26680
26781
|
spans
|
|
26681
26782
|
}) => {
|
|
26682
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
26683
|
-
const [edges, setEdges] = (0,
|
|
26684
|
-
(0,
|
|
26783
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react60.useNodesState)([]);
|
|
26784
|
+
const [edges, setEdges] = (0, import_react60.useEdgesState)([]);
|
|
26785
|
+
(0, import_react61.useEffect)(() => {
|
|
26685
26786
|
const allNodes = [];
|
|
26686
26787
|
const allEdges = [];
|
|
26687
26788
|
for (const span of spans.data ?? []) {
|
|
@@ -26696,15 +26797,15 @@ var TraceGraph = ({
|
|
|
26696
26797
|
},
|
|
26697
26798
|
id: span.span_id,
|
|
26698
26799
|
position: { x: 0, y: 0 },
|
|
26699
|
-
sourcePosition:
|
|
26700
|
-
targetPosition:
|
|
26800
|
+
sourcePosition: import_react60.Position.Right,
|
|
26801
|
+
targetPosition: import_react60.Position.Left,
|
|
26701
26802
|
type: "service"
|
|
26702
26803
|
});
|
|
26703
26804
|
if (span.parent_span_id !== null) {
|
|
26704
26805
|
allEdges.push({
|
|
26705
26806
|
animated: false,
|
|
26706
26807
|
id: `e-${span.parent_span_id}-${span.span_id}`,
|
|
26707
|
-
markerEnd: { color: "lightgray", height: 16, type:
|
|
26808
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react60.MarkerType.Arrow, width: 16 },
|
|
26708
26809
|
source: span.parent_span_id,
|
|
26709
26810
|
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
26710
26811
|
target: span.span_id
|
|
@@ -26713,7 +26814,7 @@ var TraceGraph = ({
|
|
|
26713
26814
|
for (const linkedSpanId of span.linked_span_ids ?? []) {
|
|
26714
26815
|
allEdges.push({
|
|
26715
26816
|
id: `e-link-${linkedSpanId}-${span.span_id}`,
|
|
26716
|
-
markerEnd: { color: "lightgray", height: 16, type:
|
|
26817
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react60.MarkerType.Arrow, width: 16 },
|
|
26717
26818
|
source: linkedSpanId,
|
|
26718
26819
|
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
26719
26820
|
// animated: true,
|
|
@@ -26748,7 +26849,7 @@ var TraceGraph = ({
|
|
|
26748
26849
|
}
|
|
26749
26850
|
),
|
|
26750
26851
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
|
|
26751
|
-
|
|
26852
|
+
import_react60.ReactFlow,
|
|
26752
26853
|
{
|
|
26753
26854
|
"data-testid": "trace-graph",
|
|
26754
26855
|
edges,
|
|
@@ -26767,7 +26868,7 @@ var TraceGraph = ({
|
|
|
26767
26868
|
children: [
|
|
26768
26869
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Controls, {}),
|
|
26769
26870
|
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
26770
|
-
|
|
26871
|
+
import_react60.Background,
|
|
26771
26872
|
{
|
|
26772
26873
|
bgColor: theme.palette.background.paper,
|
|
26773
26874
|
color: theme.palette.text.disabled
|
|
@@ -26872,7 +26973,7 @@ var TraceGraphView = ({
|
|
|
26872
26973
|
height: "100%",
|
|
26873
26974
|
overflow: "auto"
|
|
26874
26975
|
},
|
|
26875
|
-
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
26976
|
+
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_react62.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
26876
26977
|
TraceGraph,
|
|
26877
26978
|
{
|
|
26878
26979
|
initialFocusEventId: spanId,
|
|
@@ -26933,10 +27034,10 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
|
|
|
26933
27034
|
}
|
|
26934
27035
|
var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
26935
27036
|
const api = useAppInspectorApi();
|
|
26936
|
-
const [spans, setSpans] = (0,
|
|
26937
|
-
const [loading, setLoading] = (0,
|
|
26938
|
-
const [fetchError, setFetchError] = (0,
|
|
26939
|
-
const fetchSpans = (0,
|
|
27037
|
+
const [spans, setSpans] = (0, import_react63.useState)();
|
|
27038
|
+
const [loading, setLoading] = (0, import_react63.useState)(false);
|
|
27039
|
+
const [fetchError, setFetchError] = (0, import_react63.useState)();
|
|
27040
|
+
const fetchSpans = (0, import_react63.useCallback)(async () => {
|
|
26940
27041
|
setLoading(true);
|
|
26941
27042
|
try {
|
|
26942
27043
|
const spans2 = await fetchConnectedTraces(api, [traceId]);
|
|
@@ -26949,28 +27050,28 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
26949
27050
|
setLoading(false);
|
|
26950
27051
|
}
|
|
26951
27052
|
}, [api, traceId]);
|
|
26952
|
-
(0,
|
|
27053
|
+
(0, import_react63.useEffect)(() => {
|
|
26953
27054
|
void fetchSpans();
|
|
26954
27055
|
}, [fetchSpans]);
|
|
26955
|
-
const [open, setOpen] = (0,
|
|
26956
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
26957
|
-
const spansReference = (0,
|
|
26958
|
-
(0,
|
|
27056
|
+
const [open, setOpen] = (0, import_react63.useState)(true);
|
|
27057
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react63.useState)(() => spans?.find((span) => span.span_id === spanId));
|
|
27058
|
+
const spansReference = (0, import_react63.useRef)();
|
|
27059
|
+
(0, import_react63.useEffect)(() => {
|
|
26959
27060
|
if (!spansReference.current && spans) {
|
|
26960
27061
|
setSelectedEvent(spans.find((span) => span.span_id === spanId));
|
|
26961
27062
|
spansReference.current = spans;
|
|
26962
27063
|
}
|
|
26963
27064
|
}, [spans, setSelectedEvent, spanId]);
|
|
26964
27065
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
26965
|
-
const handleEventSelect = (0,
|
|
27066
|
+
const handleEventSelect = (0, import_react63.useCallback)((spanId2) => {
|
|
26966
27067
|
const span = spans?.find((s2) => s2.span_id === spanId2);
|
|
26967
27068
|
setSelectedEvent(span);
|
|
26968
27069
|
setOpen(true);
|
|
26969
27070
|
}, [spans]);
|
|
26970
|
-
const handleRetry = (0,
|
|
27071
|
+
const handleRetry = (0, import_react63.useCallback)(() => {
|
|
26971
27072
|
void checkStatus();
|
|
26972
27073
|
}, [checkStatus]);
|
|
26973
|
-
const navigateToSpansList = (0,
|
|
27074
|
+
const navigateToSpansList = (0, import_react63.useCallback)(() => {
|
|
26974
27075
|
onClose?.();
|
|
26975
27076
|
}, [onClose]);
|
|
26976
27077
|
return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
@@ -27016,17 +27117,17 @@ var SpansListPage = () => {
|
|
|
27016
27117
|
streamPaused,
|
|
27017
27118
|
toggleStream
|
|
27018
27119
|
} = useSpans();
|
|
27019
|
-
const clearSpansSync = (0,
|
|
27120
|
+
const clearSpansSync = (0, import_react64.useCallback)(() => {
|
|
27020
27121
|
void clearSpans();
|
|
27021
27122
|
}, [clearSpans]);
|
|
27022
27123
|
const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
|
|
27023
|
-
const [selectedTraceId, setSelectedTraceId] = (0,
|
|
27024
|
-
const [selectedSpanId, setSelectedSpanId] = (0,
|
|
27025
|
-
const navigateToSpan = (0,
|
|
27124
|
+
const [selectedTraceId, setSelectedTraceId] = (0, import_react64.useState)();
|
|
27125
|
+
const [selectedSpanId, setSelectedSpanId] = (0, import_react64.useState)();
|
|
27126
|
+
const navigateToSpan = (0, import_react64.useCallback)((span) => {
|
|
27026
27127
|
setSelectedTraceId(span.trace_id);
|
|
27027
27128
|
setSelectedSpanId(span.span_id);
|
|
27028
27129
|
}, []);
|
|
27029
|
-
const handleRetry = (0,
|
|
27130
|
+
const handleRetry = (0, import_react64.useCallback)(() => {
|
|
27030
27131
|
void checkStatus();
|
|
27031
27132
|
}, [checkStatus]);
|
|
27032
27133
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|