@localstack/appinspector-ui 1.0.37 → 1.0.38
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 +220 -262
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +185 -227
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
|
|
38
38
|
// src/pages/spans-list-page.tsx
|
|
39
39
|
var import_material20 = require("@mui/material");
|
|
40
|
-
var
|
|
40
|
+
var import_react25 = require("react");
|
|
41
41
|
|
|
42
42
|
// src/api/use-api.tsx
|
|
43
43
|
var import_react = require("react");
|
|
@@ -61,101 +61,114 @@ var import_material5 = require("@mui/material");
|
|
|
61
61
|
var import_icons_material = require("@mui/icons-material");
|
|
62
62
|
var import_material4 = require("@mui/material");
|
|
63
63
|
var import_x_data_grid = require("@mui/x-data-grid");
|
|
64
|
-
var
|
|
64
|
+
var import_react8 = require("react");
|
|
65
65
|
|
|
66
66
|
// src/components/cells/responsive-timestamp-cell.tsx
|
|
67
67
|
var import_react2 = require("react");
|
|
68
|
-
|
|
69
|
-
// src/utils/time.ts
|
|
70
|
-
function unixNanoToDate(unixNanoString) {
|
|
71
|
-
if (!unixNanoString) return void 0;
|
|
72
|
-
const milliseconds = Number(BigInt(unixNanoString) / BigInt("1000000"));
|
|
73
|
-
return new Date(milliseconds);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/components/cells/responsive-timestamp-cell.tsx
|
|
77
68
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
78
|
-
var ResponsiveTimestampCell = ({
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
var ResponsiveTimestampCell = (0, import_react2.memo)(({ date, locale }) => {
|
|
70
|
+
const format = new Intl.DateTimeFormat(locale, {
|
|
71
|
+
day: "2-digit",
|
|
72
|
+
fractionalSecondDigits: 3,
|
|
73
|
+
hour: "2-digit",
|
|
74
|
+
hour12: false,
|
|
75
|
+
minute: "2-digit",
|
|
76
|
+
month: "2-digit",
|
|
77
|
+
second: "2-digit",
|
|
78
|
+
year: "numeric"
|
|
79
|
+
});
|
|
80
|
+
const formattedTime = format.format(date);
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { width: "100%" }, children: formattedTime });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// src/utils/logger.ts
|
|
85
|
+
var getIsDevelopment = () => {
|
|
86
|
+
try {
|
|
87
|
+
return false;
|
|
88
|
+
} catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var isDevelopment = getIsDevelopment();
|
|
93
|
+
var logger = {
|
|
94
|
+
debug: (message, data) => {
|
|
95
|
+
if (isDevelopment) {
|
|
96
|
+
console.debug(`[DEBUG] ${message}`, data === void 0 ? "" : data);
|
|
97
97
|
}
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
if (!date) return;
|
|
103
|
-
if (columnWidth < 100) {
|
|
104
|
-
const formatter = new Intl.DateTimeFormat(locale, {
|
|
105
|
-
hour: "2-digit",
|
|
106
|
-
hour12: false,
|
|
107
|
-
minute: "2-digit",
|
|
108
|
-
second: "2-digit"
|
|
109
|
-
});
|
|
110
|
-
return formatter.format(date);
|
|
111
|
-
} else if (columnWidth < 160) {
|
|
112
|
-
const formatter = new Intl.DateTimeFormat(locale, {
|
|
113
|
-
hour: "2-digit",
|
|
114
|
-
hour12: false,
|
|
115
|
-
minute: "2-digit",
|
|
116
|
-
second: "2-digit"
|
|
117
|
-
});
|
|
118
|
-
const timeString = formatter.format(date);
|
|
119
|
-
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
120
|
-
return `${timeString}:${ms}`;
|
|
121
|
-
} else {
|
|
122
|
-
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
123
|
-
day: "2-digit",
|
|
124
|
-
month: "2-digit",
|
|
125
|
-
year: "numeric"
|
|
126
|
-
});
|
|
127
|
-
const timeFormatter = new Intl.DateTimeFormat(locale, {
|
|
128
|
-
hour: "2-digit",
|
|
129
|
-
hour12: false,
|
|
130
|
-
minute: "2-digit",
|
|
131
|
-
second: "2-digit"
|
|
132
|
-
});
|
|
133
|
-
const dateString = dateFormatter.format(date);
|
|
134
|
-
const timeString = timeFormatter.format(date);
|
|
135
|
-
const ms = date.getMilliseconds().toString().padStart(3, "0");
|
|
136
|
-
return `${dateString} - ${timeString}:${ms}`;
|
|
98
|
+
},
|
|
99
|
+
error: (message, data) => {
|
|
100
|
+
if (isDevelopment) {
|
|
101
|
+
console.error(`[ERROR] ${message}`, data === void 0 ? "" : data);
|
|
137
102
|
}
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
|
|
103
|
+
},
|
|
104
|
+
info: (message, data) => {
|
|
105
|
+
if (isDevelopment) {
|
|
106
|
+
console.info(`[INFO] ${message}`, data === void 0 ? "" : data);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
warn: (message, data) => {
|
|
110
|
+
if (isDevelopment) {
|
|
111
|
+
console.warn(`[WARN] ${message}`, data === void 0 ? "" : data);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
var createScopedLogger = (scope) => ({
|
|
116
|
+
debug: (message, data) => {
|
|
117
|
+
logger.debug(`[${scope}] ${message}`, data);
|
|
118
|
+
},
|
|
119
|
+
error: (message, data) => {
|
|
120
|
+
logger.error(`[${scope}] ${message}`, data);
|
|
121
|
+
},
|
|
122
|
+
info: (message, data) => {
|
|
123
|
+
logger.info(`[${scope}] ${message}`, data);
|
|
124
|
+
},
|
|
125
|
+
warn: (message, data) => {
|
|
126
|
+
logger.warn(`[${scope}] ${message}`, data);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// src/utils/search-in-object.ts
|
|
131
|
+
var searchInObject = (object, searchTerm, skipKeys = []) => {
|
|
132
|
+
if (!object) return false;
|
|
133
|
+
if (!searchTerm || searchTerm.trim() === "") return true;
|
|
134
|
+
const normalizedSearchTerm = searchTerm.toLowerCase().trim();
|
|
135
|
+
if (typeof object === "string") {
|
|
136
|
+
return object.toLowerCase().includes(normalizedSearchTerm);
|
|
137
|
+
}
|
|
138
|
+
if (typeof object === "number") {
|
|
139
|
+
return String(object).toLowerCase().includes(normalizedSearchTerm);
|
|
140
|
+
}
|
|
141
|
+
if (typeof object === "boolean") {
|
|
142
|
+
return String(object).toLowerCase().includes(normalizedSearchTerm);
|
|
143
|
+
}
|
|
144
|
+
if (Array.isArray(object)) {
|
|
145
|
+
return object.some((item) => searchInObject(item, searchTerm, skipKeys));
|
|
146
|
+
}
|
|
147
|
+
if (typeof object === "object") {
|
|
148
|
+
return Object.entries(object).filter(([key]) => !skipKeys.includes(key)).some(([, value]) => searchInObject(value, searchTerm, skipKeys));
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
141
151
|
};
|
|
142
152
|
|
|
143
153
|
// src/components/cells/service-cell.tsx
|
|
144
154
|
var import_material3 = require("@mui/material");
|
|
155
|
+
var import_react7 = require("react");
|
|
145
156
|
|
|
146
157
|
// src/components/aws-service-icon/aws-service-icon.tsx
|
|
147
158
|
var import_material = require("@mui/material");
|
|
159
|
+
var import_react5 = require("react");
|
|
148
160
|
|
|
149
161
|
// src/utils/wrap-in-component.tsx
|
|
150
|
-
var
|
|
162
|
+
var import_react3 = require("react");
|
|
163
|
+
var WrapInComponent = (0, import_react3.memo)(({ children, wrap, wrapperFn }) => {
|
|
151
164
|
if (wrap) {
|
|
152
165
|
return wrapperFn(children);
|
|
153
166
|
}
|
|
154
167
|
return children;
|
|
155
|
-
};
|
|
168
|
+
});
|
|
156
169
|
|
|
157
170
|
// src/components/aws-service-icon/icons/index.tsx
|
|
158
|
-
var
|
|
171
|
+
var import_react4 = require("react");
|
|
159
172
|
|
|
160
173
|
// src/types/service-names.ts
|
|
161
174
|
var SERVICE_NAME = {
|
|
@@ -2470,7 +2483,7 @@ var ICONS_MAP = {
|
|
|
2470
2483
|
[SERVICE_NAME.WAFV2]: wafv2_default,
|
|
2471
2484
|
[SERVICE_NAME.XRAY]: xray_default
|
|
2472
2485
|
};
|
|
2473
|
-
var AwsServiceIconBase = (0,
|
|
2486
|
+
var AwsServiceIconBase = (0, import_react4.memo)((props) => {
|
|
2474
2487
|
const Icon = ICONS_MAP[props.service] ?? ICONS_MAP.infrastructure;
|
|
2475
2488
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Icon, { ...props });
|
|
2476
2489
|
});
|
|
@@ -2479,7 +2492,7 @@ var supportedServiceNames = Object.keys(ICONS_MAP);
|
|
|
2479
2492
|
// src/components/aws-service-icon/aws-service-icon.tsx
|
|
2480
2493
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
2481
2494
|
var sizes = { large: [32, 32], medium: [22, 22], small: [11, 11] };
|
|
2482
|
-
var AwsServiceIcon = ({ hideTooltip, service, size = "medium", title }) => {
|
|
2495
|
+
var AwsServiceIcon = (0, import_react5.memo)(({ hideTooltip, service, size = "medium", title }) => {
|
|
2483
2496
|
const [width, height] = sizes[size];
|
|
2484
2497
|
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
2485
2498
|
WrapInComponent,
|
|
@@ -2489,12 +2502,13 @@ var AwsServiceIcon = ({ hideTooltip, service, size = "medium", title }) => {
|
|
|
2489
2502
|
children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(AwsServiceIconBase, { height, service, style: { display: "block" }, width })
|
|
2490
2503
|
}
|
|
2491
2504
|
);
|
|
2492
|
-
};
|
|
2505
|
+
});
|
|
2493
2506
|
|
|
2494
2507
|
// src/components/cells/pill-cell.tsx
|
|
2495
2508
|
var import_material2 = require("@mui/material");
|
|
2509
|
+
var import_react6 = require("react");
|
|
2496
2510
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
2497
|
-
var PillCell = ({
|
|
2511
|
+
var PillCell = (0, import_react6.memo)(({
|
|
2498
2512
|
backgroundColor,
|
|
2499
2513
|
children,
|
|
2500
2514
|
height = "24px",
|
|
@@ -2523,11 +2537,11 @@ var PillCell = ({
|
|
|
2523
2537
|
children
|
|
2524
2538
|
}
|
|
2525
2539
|
);
|
|
2526
|
-
};
|
|
2540
|
+
});
|
|
2527
2541
|
|
|
2528
2542
|
// src/components/cells/service-cell.tsx
|
|
2529
2543
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
2530
|
-
var ServiceCell = ({
|
|
2544
|
+
var ServiceCell = (0, import_react7.memo)(({
|
|
2531
2545
|
height = "24px",
|
|
2532
2546
|
resource,
|
|
2533
2547
|
selected,
|
|
@@ -2600,77 +2614,8 @@ var ServiceCell = ({
|
|
|
2600
2614
|
)
|
|
2601
2615
|
] }) : void 0
|
|
2602
2616
|
] }) });
|
|
2603
|
-
};
|
|
2604
|
-
ServiceCell.displayName = "ServiceCell";
|
|
2605
|
-
|
|
2606
|
-
// src/utils/logger.ts
|
|
2607
|
-
var getIsDevelopment = () => {
|
|
2608
|
-
try {
|
|
2609
|
-
return false;
|
|
2610
|
-
} catch {
|
|
2611
|
-
return false;
|
|
2612
|
-
}
|
|
2613
|
-
};
|
|
2614
|
-
var isDevelopment = getIsDevelopment();
|
|
2615
|
-
var logger = {
|
|
2616
|
-
debug: (message, data) => {
|
|
2617
|
-
if (isDevelopment) {
|
|
2618
|
-
console.debug(`[DEBUG] ${message}`, data === void 0 ? "" : data);
|
|
2619
|
-
}
|
|
2620
|
-
},
|
|
2621
|
-
error: (message, data) => {
|
|
2622
|
-
if (isDevelopment) {
|
|
2623
|
-
console.error(`[ERROR] ${message}`, data === void 0 ? "" : data);
|
|
2624
|
-
}
|
|
2625
|
-
},
|
|
2626
|
-
info: (message, data) => {
|
|
2627
|
-
if (isDevelopment) {
|
|
2628
|
-
console.info(`[INFO] ${message}`, data === void 0 ? "" : data);
|
|
2629
|
-
}
|
|
2630
|
-
},
|
|
2631
|
-
warn: (message, data) => {
|
|
2632
|
-
if (isDevelopment) {
|
|
2633
|
-
console.warn(`[WARN] ${message}`, data === void 0 ? "" : data);
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
};
|
|
2637
|
-
var createScopedLogger = (scope) => ({
|
|
2638
|
-
debug: (message, data) => {
|
|
2639
|
-
logger.debug(`[${scope}] ${message}`, data);
|
|
2640
|
-
},
|
|
2641
|
-
error: (message, data) => {
|
|
2642
|
-
logger.error(`[${scope}] ${message}`, data);
|
|
2643
|
-
},
|
|
2644
|
-
info: (message, data) => {
|
|
2645
|
-
logger.info(`[${scope}] ${message}`, data);
|
|
2646
|
-
},
|
|
2647
|
-
warn: (message, data) => {
|
|
2648
|
-
logger.warn(`[${scope}] ${message}`, data);
|
|
2649
|
-
}
|
|
2650
2617
|
});
|
|
2651
|
-
|
|
2652
|
-
// src/utils/search-in-object.ts
|
|
2653
|
-
var searchInObject = (object, searchTerm, skipKeys = []) => {
|
|
2654
|
-
if (!object) return false;
|
|
2655
|
-
if (!searchTerm || searchTerm.trim() === "") return true;
|
|
2656
|
-
const normalizedSearchTerm = searchTerm.toLowerCase().trim();
|
|
2657
|
-
if (typeof object === "string") {
|
|
2658
|
-
return object.toLowerCase().includes(normalizedSearchTerm);
|
|
2659
|
-
}
|
|
2660
|
-
if (typeof object === "number") {
|
|
2661
|
-
return String(object).toLowerCase().includes(normalizedSearchTerm);
|
|
2662
|
-
}
|
|
2663
|
-
if (typeof object === "boolean") {
|
|
2664
|
-
return String(object).toLowerCase().includes(normalizedSearchTerm);
|
|
2665
|
-
}
|
|
2666
|
-
if (Array.isArray(object)) {
|
|
2667
|
-
return object.some((item) => searchInObject(item, searchTerm, skipKeys));
|
|
2668
|
-
}
|
|
2669
|
-
if (typeof object === "object") {
|
|
2670
|
-
return Object.entries(object).filter(([key]) => !skipKeys.includes(key)).some(([, value]) => searchInObject(value, searchTerm, skipKeys));
|
|
2671
|
-
}
|
|
2672
|
-
return false;
|
|
2673
|
-
};
|
|
2618
|
+
ServiceCell.displayName = "ServiceCell";
|
|
2674
2619
|
|
|
2675
2620
|
// src/components/spans-list/spans-data-grid.tsx
|
|
2676
2621
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
@@ -2678,12 +2623,6 @@ var resourceNameComparator = (v1 = "", v2 = "") => {
|
|
|
2678
2623
|
return v1.localeCompare(v2);
|
|
2679
2624
|
};
|
|
2680
2625
|
var columns = [
|
|
2681
|
-
// {
|
|
2682
|
-
// field: 'status',
|
|
2683
|
-
// renderHeader: () => null,
|
|
2684
|
-
// width: 50,
|
|
2685
|
-
// renderCell: (parameters) => <StatusCell span={parameters.row} />,
|
|
2686
|
-
// },
|
|
2687
2626
|
{
|
|
2688
2627
|
field: "trace_id",
|
|
2689
2628
|
headerName: "Trace",
|
|
@@ -2707,7 +2646,7 @@ var columns = [
|
|
|
2707
2646
|
{
|
|
2708
2647
|
field: "start_time_unix_nano",
|
|
2709
2648
|
headerName: "Time",
|
|
2710
|
-
renderCell: (parameters) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ResponsiveTimestampCell, {
|
|
2649
|
+
renderCell: (parameters) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ResponsiveTimestampCell, { date: parameters.value?.startTime }),
|
|
2711
2650
|
type: "string",
|
|
2712
2651
|
width: 180
|
|
2713
2652
|
},
|
|
@@ -2759,8 +2698,8 @@ var SpansDataGrid = ({
|
|
|
2759
2698
|
// setRows,
|
|
2760
2699
|
sortingOption = defaultSortingOption
|
|
2761
2700
|
}) => {
|
|
2762
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2763
|
-
const [sortModel, setSortModel] = (0,
|
|
2701
|
+
const [searchTerm, setSearchTerm] = (0, import_react8.useState)(() => localStorage.getItem("spansSearchTerm") ?? "");
|
|
2702
|
+
const [sortModel, setSortModel] = (0, import_react8.useState)(() => {
|
|
2764
2703
|
const savedSorting = localStorage.getItem("spansSortModel");
|
|
2765
2704
|
if (savedSorting) {
|
|
2766
2705
|
try {
|
|
@@ -2776,27 +2715,27 @@ var SpansDataGrid = ({
|
|
|
2776
2715
|
}
|
|
2777
2716
|
];
|
|
2778
2717
|
});
|
|
2779
|
-
const handleRowClick = (0,
|
|
2718
|
+
const handleRowClick = (0, import_react8.useCallback)((parameters) => {
|
|
2780
2719
|
onSpanClick(parameters.row);
|
|
2781
2720
|
}, [onSpanClick]);
|
|
2782
|
-
const handleSearchTermChange = (0,
|
|
2721
|
+
const handleSearchTermChange = (0, import_react8.useCallback)((span) => {
|
|
2783
2722
|
const newValue = span.target.value;
|
|
2784
2723
|
setSearchTerm(newValue);
|
|
2785
2724
|
localStorage.setItem("spansSearchTerm", newValue);
|
|
2786
2725
|
}, []);
|
|
2787
|
-
const handleSortModelChange = (0,
|
|
2726
|
+
const handleSortModelChange = (0, import_react8.useCallback)((newSortModel) => {
|
|
2788
2727
|
setSortModel(newSortModel);
|
|
2789
2728
|
localStorage.setItem("spansSortModel", JSON.stringify(newSortModel));
|
|
2790
2729
|
}, []);
|
|
2791
|
-
const filterSpansBySearchTerm = (0,
|
|
2730
|
+
const filterSpansBySearchTerm = (0, import_react8.useCallback)(
|
|
2792
2731
|
(span) => {
|
|
2793
2732
|
if (searchTerm.length === 0) return true;
|
|
2794
2733
|
return searchInObject(span, searchTerm);
|
|
2795
2734
|
},
|
|
2796
2735
|
[searchTerm]
|
|
2797
2736
|
);
|
|
2798
|
-
const filtersToApply = (0,
|
|
2799
|
-
const filteredRows = (0,
|
|
2737
|
+
const filtersToApply = (0, import_react8.useMemo)(() => [filterSpansBySearchTerm], [filterSpansBySearchTerm]);
|
|
2738
|
+
const filteredRows = (0, import_react8.useMemo)(
|
|
2800
2739
|
() => rows.filter((row) => filtersToApply.every((filter) => filter(row))),
|
|
2801
2740
|
[filtersToApply, rows]
|
|
2802
2741
|
);
|
|
@@ -3218,9 +3157,9 @@ var StatusMessage = ({
|
|
|
3218
3157
|
};
|
|
3219
3158
|
|
|
3220
3159
|
// src/hooks/use-local-storage.tsx
|
|
3221
|
-
var
|
|
3160
|
+
var import_react9 = require("react");
|
|
3222
3161
|
function useLocalStorage(key, initialValue) {
|
|
3223
|
-
const [storedValue, setStoredValue] = (0,
|
|
3162
|
+
const [storedValue, setStoredValue] = (0, import_react9.useState)(() => {
|
|
3224
3163
|
try {
|
|
3225
3164
|
const item = globalThis.localStorage.getItem(key);
|
|
3226
3165
|
return item ? JSON.parse(item) : initialValue;
|
|
@@ -3229,7 +3168,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
3229
3168
|
return initialValue;
|
|
3230
3169
|
}
|
|
3231
3170
|
});
|
|
3232
|
-
const setValue = (0,
|
|
3171
|
+
const setValue = (0, import_react9.useCallback)((value) => {
|
|
3233
3172
|
try {
|
|
3234
3173
|
setStoredValue(value);
|
|
3235
3174
|
globalThis.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -3241,7 +3180,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
3241
3180
|
console.error(`Error setting localStorage key "${key}":`, error);
|
|
3242
3181
|
}
|
|
3243
3182
|
}, [key]);
|
|
3244
|
-
(0,
|
|
3183
|
+
(0, import_react9.useEffect)(() => {
|
|
3245
3184
|
const handleStorageChange = (event) => {
|
|
3246
3185
|
if (event.key === key && event.newValue !== null) {
|
|
3247
3186
|
try {
|
|
@@ -3260,15 +3199,15 @@ function useLocalStorage(key, initialValue) {
|
|
|
3260
3199
|
}
|
|
3261
3200
|
|
|
3262
3201
|
// src/hooks/use-status.tsx
|
|
3263
|
-
var
|
|
3202
|
+
var import_react10 = require("react");
|
|
3264
3203
|
var useStatus = () => {
|
|
3265
3204
|
const api = useAppInspectorApi();
|
|
3266
|
-
const [checking, setChecking] = (0,
|
|
3267
|
-
const [status, setStatus] = (0,
|
|
3268
|
-
const [error, setError] = (0,
|
|
3269
|
-
const hasFetchedReference = (0,
|
|
3270
|
-
const abortControllerReference = (0,
|
|
3271
|
-
const checkStatus = (0,
|
|
3205
|
+
const [checking, setChecking] = (0, import_react10.useState)(true);
|
|
3206
|
+
const [status, setStatus] = (0, import_react10.useState)();
|
|
3207
|
+
const [error, setError] = (0, import_react10.useState)();
|
|
3208
|
+
const hasFetchedReference = (0, import_react10.useRef)(false);
|
|
3209
|
+
const abortControllerReference = (0, import_react10.useRef)(null);
|
|
3210
|
+
const checkStatus = (0, import_react10.useCallback)(async () => {
|
|
3272
3211
|
if (abortControllerReference.current) {
|
|
3273
3212
|
abortControllerReference.current.abort();
|
|
3274
3213
|
}
|
|
@@ -3292,7 +3231,7 @@ var useStatus = () => {
|
|
|
3292
3231
|
}
|
|
3293
3232
|
}
|
|
3294
3233
|
}, [api]);
|
|
3295
|
-
(0,
|
|
3234
|
+
(0, import_react10.useEffect)(() => {
|
|
3296
3235
|
if (!hasFetchedReference.current) {
|
|
3297
3236
|
hasFetchedReference.current = true;
|
|
3298
3237
|
void checkStatus();
|
|
@@ -3305,12 +3244,12 @@ var useStatus = () => {
|
|
|
3305
3244
|
var import_icons_material11 = require("@mui/icons-material");
|
|
3306
3245
|
var import_material19 = require("@mui/material");
|
|
3307
3246
|
var import_styles = require("@mui/material/styles");
|
|
3308
|
-
var
|
|
3309
|
-
var
|
|
3247
|
+
var import_react23 = require("@xyflow/react");
|
|
3248
|
+
var import_react24 = require("react");
|
|
3310
3249
|
|
|
3311
3250
|
// src/components/event-details/event-details.tsx
|
|
3312
3251
|
var import_material14 = require("@mui/material");
|
|
3313
|
-
var
|
|
3252
|
+
var import_react14 = require("react");
|
|
3314
3253
|
|
|
3315
3254
|
// src/utils/iam-utils.ts
|
|
3316
3255
|
function determinePermissionStatus(payload) {
|
|
@@ -3506,6 +3445,17 @@ var getEventGroupsByType = (events) => {
|
|
|
3506
3445
|
return groups;
|
|
3507
3446
|
};
|
|
3508
3447
|
|
|
3448
|
+
// src/utils/time.ts
|
|
3449
|
+
function unixNanoToDate(unixNanoString) {
|
|
3450
|
+
const milliseconds = unixNanoToMilliseconds(unixNanoString);
|
|
3451
|
+
if (!milliseconds) return void 0;
|
|
3452
|
+
return new Date(milliseconds);
|
|
3453
|
+
}
|
|
3454
|
+
function unixNanoToMilliseconds(unixNanoString) {
|
|
3455
|
+
if (!unixNanoString) return void 0;
|
|
3456
|
+
return Number(BigInt(unixNanoString) / BigInt("1000000"));
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3509
3459
|
// src/components/event-details/event-details-header.tsx
|
|
3510
3460
|
var import_icons_material3 = require("@mui/icons-material");
|
|
3511
3461
|
var import_material7 = require("@mui/material");
|
|
@@ -3544,7 +3494,7 @@ var import_material13 = require("@mui/material");
|
|
|
3544
3494
|
// src/components/event-details/event-detail.tsx
|
|
3545
3495
|
var import_icons_material7 = require("@mui/icons-material");
|
|
3546
3496
|
var import_material11 = require("@mui/material");
|
|
3547
|
-
var
|
|
3497
|
+
var import_react12 = require("react");
|
|
3548
3498
|
|
|
3549
3499
|
// src/components/status-icon.tsx
|
|
3550
3500
|
var import_icons_material4 = require("@mui/icons-material");
|
|
@@ -3695,7 +3645,7 @@ var IAMEventDetail = ({ event }) => {
|
|
|
3695
3645
|
// src/components/event-details/iam-permission-detail.tsx
|
|
3696
3646
|
var import_icons_material6 = require("@mui/icons-material");
|
|
3697
3647
|
var import_material10 = require("@mui/material");
|
|
3698
|
-
var
|
|
3648
|
+
var import_react11 = require("react");
|
|
3699
3649
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
3700
3650
|
var getChipColors = (status) => {
|
|
3701
3651
|
const isAllowed = status === "explicitly_allowed" || status === "implicitly_allowed";
|
|
@@ -3705,8 +3655,8 @@ var getChipColors = (status) => {
|
|
|
3705
3655
|
};
|
|
3706
3656
|
};
|
|
3707
3657
|
var IAMPermissionItem = ({ event }) => {
|
|
3708
|
-
const [isOpen, setIsOpen] = (0,
|
|
3709
|
-
const parsedData = (0,
|
|
3658
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
3659
|
+
const parsedData = (0, import_react11.useMemo)(() => {
|
|
3710
3660
|
const payloadString = event.attributes?.payload;
|
|
3711
3661
|
if (!payloadString) {
|
|
3712
3662
|
return;
|
|
@@ -3776,15 +3726,15 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime1
|
|
|
3776
3726
|
) : content })
|
|
3777
3727
|
] });
|
|
3778
3728
|
var EventMessage = ({ event }) => {
|
|
3779
|
-
const [isOpen, setIsOpen] = (0,
|
|
3780
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
3781
|
-
const textReference = (0,
|
|
3782
|
-
const parsedMessage = (0,
|
|
3783
|
-
const isIAMPolicyEvent = (0,
|
|
3729
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
3730
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react12.useState)(false);
|
|
3731
|
+
const textReference = (0, import_react12.useRef)(null);
|
|
3732
|
+
const parsedMessage = (0, import_react12.useMemo)(() => parseEventMessage(event), [event]);
|
|
3733
|
+
const isIAMPolicyEvent = (0, import_react12.useMemo)(
|
|
3784
3734
|
() => event.event_type === "iam.policy_evaluation" && event.attributes?.payload && typeof event.attributes.payload === "string",
|
|
3785
3735
|
[event]
|
|
3786
3736
|
);
|
|
3787
|
-
(0,
|
|
3737
|
+
(0, import_react12.useEffect)(() => {
|
|
3788
3738
|
const checkOverflow = () => {
|
|
3789
3739
|
const element = textReference.current;
|
|
3790
3740
|
if (element) {
|
|
@@ -3797,11 +3747,11 @@ var EventMessage = ({ event }) => {
|
|
|
3797
3747
|
window.removeEventListener("resize", checkOverflow);
|
|
3798
3748
|
};
|
|
3799
3749
|
}, [parsedMessage.headline]);
|
|
3800
|
-
const hasAdditionalContent = (0,
|
|
3750
|
+
const hasAdditionalContent = (0, import_react12.useMemo)(
|
|
3801
3751
|
() => parsedMessage.message || parsedMessage.details || isIAMPolicyEvent,
|
|
3802
3752
|
[parsedMessage.message, parsedMessage.details, isIAMPolicyEvent]
|
|
3803
3753
|
);
|
|
3804
|
-
const shouldShowToggle = (0,
|
|
3754
|
+
const shouldShowToggle = (0, import_react12.useMemo)(
|
|
3805
3755
|
() => isOverflowing || hasAdditionalContent,
|
|
3806
3756
|
[isOverflowing, hasAdditionalContent]
|
|
3807
3757
|
);
|
|
@@ -3943,10 +3893,10 @@ var EventDetail = ({
|
|
|
3943
3893
|
// src/components/event-details/toggle-section.tsx
|
|
3944
3894
|
var import_icons_material8 = require("@mui/icons-material");
|
|
3945
3895
|
var import_material12 = require("@mui/material");
|
|
3946
|
-
var
|
|
3896
|
+
var import_react13 = require("react");
|
|
3947
3897
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
3948
3898
|
var ToggleSection = ({ children, headline, initialOpen = true }) => {
|
|
3949
|
-
const [isOpen, setIsOpen] = (0,
|
|
3899
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(initialOpen);
|
|
3950
3900
|
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material12.Box, { sx: { mt: 4 }, children: [
|
|
3951
3901
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
3952
3902
|
import_material12.Box,
|
|
@@ -4022,7 +3972,7 @@ var EventSection = ({
|
|
|
4022
3972
|
// src/components/event-details/event-details.tsx
|
|
4023
3973
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
4024
3974
|
var EventDetails = ({ onClose, selectedEvent }) => {
|
|
4025
|
-
const attributes = (0,
|
|
3975
|
+
const attributes = (0, import_react14.useMemo)(() => {
|
|
4026
3976
|
const attributes2 = Object.entries(selectedEvent?.attributes ?? {});
|
|
4027
3977
|
return attributes2.filter(([key]) => key !== "localstack.aws.account_id" && key !== "localstack.aws.service");
|
|
4028
3978
|
}, [selectedEvent?.attributes]);
|
|
@@ -4121,22 +4071,22 @@ function renderKeyValue(key, value) {
|
|
|
4121
4071
|
// src/components/trace-graph/trace-graph.tsx
|
|
4122
4072
|
var import_base = require("@xyflow/react/dist/base.css");
|
|
4123
4073
|
var import_material18 = require("@mui/material");
|
|
4124
|
-
var
|
|
4125
|
-
var
|
|
4074
|
+
var import_react21 = require("@xyflow/react");
|
|
4075
|
+
var import_react22 = require("react");
|
|
4126
4076
|
|
|
4127
4077
|
// src/components/trace-graph/service-node.tsx
|
|
4128
4078
|
var import_material16 = require("@mui/material");
|
|
4129
4079
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
4130
|
-
var
|
|
4131
|
-
var
|
|
4080
|
+
var import_react16 = require("@xyflow/react");
|
|
4081
|
+
var import_react17 = require("react");
|
|
4132
4082
|
|
|
4133
4083
|
// src/components/trace-graph/problem-indicator.tsx
|
|
4134
4084
|
var import_icons_material9 = require("@mui/icons-material");
|
|
4135
4085
|
var import_material15 = require("@mui/material");
|
|
4136
|
-
var
|
|
4086
|
+
var import_react15 = require("react");
|
|
4137
4087
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
4138
4088
|
var ProblemIndicator = ({ error }) => {
|
|
4139
|
-
const icon = (0,
|
|
4089
|
+
const icon = (0, import_react15.useMemo)(() => {
|
|
4140
4090
|
switch (error.level) {
|
|
4141
4091
|
case "error": {
|
|
4142
4092
|
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons_material9.Error, { sx: { color: "#d32f2f", fontSize: "14px" } });
|
|
@@ -4149,7 +4099,7 @@ var ProblemIndicator = ({ error }) => {
|
|
|
4149
4099
|
}
|
|
4150
4100
|
}
|
|
4151
4101
|
}, [error.level]);
|
|
4152
|
-
const color = (0,
|
|
4102
|
+
const color = (0, import_react15.useMemo)(() => {
|
|
4153
4103
|
switch (error.level) {
|
|
4154
4104
|
case "error": {
|
|
4155
4105
|
return "#d32f2f";
|
|
@@ -4188,7 +4138,7 @@ var handleStyle = {
|
|
|
4188
4138
|
borderColor: "lightgray",
|
|
4189
4139
|
opacity: 0
|
|
4190
4140
|
};
|
|
4191
|
-
var ServiceNode = (0,
|
|
4141
|
+
var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
|
|
4192
4142
|
const hasErrors = (data.event.errors && data.event.errors.length > 0) ?? false;
|
|
4193
4143
|
return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_material16.Box, { sx: { maxWidth: 200 }, children: [
|
|
4194
4144
|
/* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
|
|
@@ -4212,8 +4162,8 @@ var ServiceNode = (0, import_react13.memo)(({ data, selected }) => {
|
|
|
4212
4162
|
},
|
|
4213
4163
|
tabIndex: 0,
|
|
4214
4164
|
children: [
|
|
4215
|
-
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
4216
|
-
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_react16.Handle, { position: import_react16.Position.Left, style: handleStyle, type: "target" }),
|
|
4166
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_react16.Handle, { position: import_react16.Position.Right, style: handleStyle, type: "source" }),
|
|
4217
4167
|
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
4218
4168
|
ServiceCell,
|
|
4219
4169
|
{
|
|
@@ -4273,7 +4223,7 @@ var ServiceNode = (0, import_react13.memo)(({ data, selected }) => {
|
|
|
4273
4223
|
|
|
4274
4224
|
// src/components/trace-graph/utils.ts
|
|
4275
4225
|
var import_dagre = __toESM(require("@dagrejs/dagre"), 1);
|
|
4276
|
-
var
|
|
4226
|
+
var import_react18 = require("@xyflow/react");
|
|
4277
4227
|
var generateNodesAndEdges = (event, parentId) => {
|
|
4278
4228
|
const nodes = [];
|
|
4279
4229
|
const edges = [];
|
|
@@ -4289,8 +4239,8 @@ var generateNodesAndEdges = (event, parentId) => {
|
|
|
4289
4239
|
id: event.span_id,
|
|
4290
4240
|
position: { x: 0, y: 0 },
|
|
4291
4241
|
// Will be set by layout
|
|
4292
|
-
sourcePosition:
|
|
4293
|
-
targetPosition:
|
|
4242
|
+
sourcePosition: import_react18.Position.Right,
|
|
4243
|
+
targetPosition: import_react18.Position.Left,
|
|
4294
4244
|
type: "service"
|
|
4295
4245
|
});
|
|
4296
4246
|
if (parentId) {
|
|
@@ -4300,7 +4250,7 @@ var generateNodesAndEdges = (event, parentId) => {
|
|
|
4300
4250
|
markerEnd: {
|
|
4301
4251
|
color: "lightgray",
|
|
4302
4252
|
height: 16,
|
|
4303
|
-
type:
|
|
4253
|
+
type: import_react18.MarkerType.Arrow,
|
|
4304
4254
|
width: 16
|
|
4305
4255
|
},
|
|
4306
4256
|
source: parentId,
|
|
@@ -4368,8 +4318,8 @@ var calculateCenterX = (focusNodeX, viewPortPixelWidth, minX, maxX) => {
|
|
|
4368
4318
|
// src/components/trace-graph/xyflow/controls.tsx
|
|
4369
4319
|
var import_icons_material10 = require("@mui/icons-material");
|
|
4370
4320
|
var import_material17 = require("@mui/material");
|
|
4371
|
-
var
|
|
4372
|
-
var
|
|
4321
|
+
var import_react19 = require("@xyflow/react");
|
|
4322
|
+
var import_react20 = require("react");
|
|
4373
4323
|
|
|
4374
4324
|
// node_modules/zustand/esm/shallow.mjs
|
|
4375
4325
|
function shallow$1(objA, objB) {
|
|
@@ -4416,9 +4366,9 @@ var selector = (s) => ({
|
|
|
4416
4366
|
maxZoomReached: s.transform[2] >= s.maxZoom,
|
|
4417
4367
|
minZoomReached: s.transform[2] <= s.minZoom
|
|
4418
4368
|
});
|
|
4419
|
-
var Controls = (0,
|
|
4420
|
-
const { maxZoomReached, minZoomReached } = (0,
|
|
4421
|
-
const { fitView, zoomIn, zoomOut } = (0,
|
|
4369
|
+
var Controls = (0, import_react20.memo)(() => {
|
|
4370
|
+
const { maxZoomReached, minZoomReached } = (0, import_react19.useStore)(selector, shallow$1);
|
|
4371
|
+
const { fitView, zoomIn, zoomOut } = (0, import_react19.useReactFlow)();
|
|
4422
4372
|
const onZoomInHandler = () => {
|
|
4423
4373
|
void zoomIn();
|
|
4424
4374
|
};
|
|
@@ -4488,11 +4438,11 @@ var TraceGraph = ({
|
|
|
4488
4438
|
spans,
|
|
4489
4439
|
viewPortPixelWidth
|
|
4490
4440
|
}) => {
|
|
4491
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
4492
|
-
const [edges, setEdges] = (0,
|
|
4493
|
-
const [initialViewSet, setInitialViewSet] = (0,
|
|
4494
|
-
const { fitView, setCenter } = (0,
|
|
4495
|
-
(0,
|
|
4441
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react21.useNodesState)([]);
|
|
4442
|
+
const [edges, setEdges] = (0, import_react22.useState)([]);
|
|
4443
|
+
const [initialViewSet, setInitialViewSet] = (0, import_react22.useState)(false);
|
|
4444
|
+
const { fitView, setCenter } = (0, import_react21.useReactFlow)();
|
|
4445
|
+
(0, import_react22.useEffect)(() => {
|
|
4496
4446
|
const spansMap = /* @__PURE__ */ new Map();
|
|
4497
4447
|
const rootSpans = [];
|
|
4498
4448
|
for (const span of spans.data ?? []) {
|
|
@@ -4527,7 +4477,7 @@ var TraceGraph = ({
|
|
|
4527
4477
|
setNodes(layoutedNodes);
|
|
4528
4478
|
setEdges(layoutedEdges);
|
|
4529
4479
|
}, [spans.data, initialFocusEventId, setNodes]);
|
|
4530
|
-
(0,
|
|
4480
|
+
(0, import_react22.useEffect)(() => {
|
|
4531
4481
|
const shouldSetInitialView = !spans.loading && nodes.length > 0 && !initialViewSet;
|
|
4532
4482
|
if (shouldSetInitialView) {
|
|
4533
4483
|
if (initialFocusEventId) {
|
|
@@ -4564,7 +4514,7 @@ var TraceGraph = ({
|
|
|
4564
4514
|
}
|
|
4565
4515
|
),
|
|
4566
4516
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
4567
|
-
|
|
4517
|
+
import_react21.ReactFlow,
|
|
4568
4518
|
{
|
|
4569
4519
|
"data-testid": "trace-graph",
|
|
4570
4520
|
defaultViewport: { x: 0, y: 0, zoom: 1 },
|
|
@@ -4582,7 +4532,7 @@ var TraceGraph = ({
|
|
|
4582
4532
|
children: [
|
|
4583
4533
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Controls, {}),
|
|
4584
4534
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
4585
|
-
|
|
4535
|
+
import_react21.Background,
|
|
4586
4536
|
{
|
|
4587
4537
|
bgColor: theme.palette.background.paper,
|
|
4588
4538
|
color: theme.palette.text.disabled
|
|
@@ -4688,7 +4638,7 @@ var TraceGraphView = ({
|
|
|
4688
4638
|
height: "100%",
|
|
4689
4639
|
overflow: "auto"
|
|
4690
4640
|
},
|
|
4691
|
-
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
4641
|
+
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_react23.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
4692
4642
|
TraceGraph,
|
|
4693
4643
|
{
|
|
4694
4644
|
initialFocusEventId: spanId,
|
|
@@ -4716,11 +4666,11 @@ var TraceGraphView = ({
|
|
|
4716
4666
|
};
|
|
4717
4667
|
var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
4718
4668
|
const api = useAppInspectorApi();
|
|
4719
|
-
const [spans, setSpans] = (0,
|
|
4720
|
-
const [loading, setLoading] = (0,
|
|
4669
|
+
const [spans, setSpans] = (0, import_react24.useState)();
|
|
4670
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
4721
4671
|
const [includeReadOperations] = useLocalStorage("includeReadOperations", false);
|
|
4722
|
-
const [fetchError, setFetchError] = (0,
|
|
4723
|
-
const fetchSpans = (0,
|
|
4672
|
+
const [fetchError, setFetchError] = (0, import_react24.useState)();
|
|
4673
|
+
const fetchSpans = (0, import_react24.useCallback)(async () => {
|
|
4724
4674
|
setLoading(true);
|
|
4725
4675
|
try {
|
|
4726
4676
|
const response = await api.getSpans({
|
|
@@ -4736,14 +4686,14 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
4736
4686
|
setLoading(false);
|
|
4737
4687
|
}
|
|
4738
4688
|
}, [api, includeReadOperations, traceId]);
|
|
4739
|
-
(0,
|
|
4689
|
+
(0, import_react24.useEffect)(() => {
|
|
4740
4690
|
void fetchSpans();
|
|
4741
4691
|
}, [fetchSpans]);
|
|
4742
|
-
const [open, setOpen] = (0,
|
|
4743
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
4744
|
-
const [viewPortPixelWidth, setViewPortPixelWidth] = (0,
|
|
4692
|
+
const [open, setOpen] = (0, import_react24.useState)(true);
|
|
4693
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react24.useState)();
|
|
4694
|
+
const [viewPortPixelWidth, setViewPortPixelWidth] = (0, import_react24.useState)(0);
|
|
4745
4695
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
4746
|
-
const calculateDrawerWidth = (0,
|
|
4696
|
+
const calculateDrawerWidth = (0, import_react24.useCallback)(() => {
|
|
4747
4697
|
const percentageMatch = /(\d+)%/.exec(DRAWER_WIDTH);
|
|
4748
4698
|
if (percentageMatch && open) {
|
|
4749
4699
|
const percentage = Number.parseInt(percentageMatch[1], 10);
|
|
@@ -4751,7 +4701,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
4751
4701
|
}
|
|
4752
4702
|
return 0;
|
|
4753
4703
|
}, [open]);
|
|
4754
|
-
(0,
|
|
4704
|
+
(0, import_react24.useEffect)(() => {
|
|
4755
4705
|
const updateViewportWidth = () => {
|
|
4756
4706
|
const totalWidth = window.innerWidth;
|
|
4757
4707
|
const drawerPixelWidth = open ? calculateDrawerWidth() : 0;
|
|
@@ -4765,14 +4715,14 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
4765
4715
|
clearTimeout(timeoutId);
|
|
4766
4716
|
};
|
|
4767
4717
|
}, [open, calculateDrawerWidth]);
|
|
4768
|
-
const handleEventSelect = (0,
|
|
4718
|
+
const handleEventSelect = (0, import_react24.useCallback)((event) => {
|
|
4769
4719
|
setSelectedEvent(event);
|
|
4770
4720
|
setOpen(true);
|
|
4771
4721
|
}, []);
|
|
4772
|
-
const handleRetry = (0,
|
|
4722
|
+
const handleRetry = (0, import_react24.useCallback)(() => {
|
|
4773
4723
|
void checkStatus();
|
|
4774
4724
|
}, [checkStatus]);
|
|
4775
|
-
const navigateToSpansList = (0,
|
|
4725
|
+
const navigateToSpansList = (0, import_react24.useCallback)(() => {
|
|
4776
4726
|
onClose?.();
|
|
4777
4727
|
}, [onClose]);
|
|
4778
4728
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
@@ -4804,24 +4754,24 @@ var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
|
4804
4754
|
var spansPerPageOptions = [25, 50, 100];
|
|
4805
4755
|
var SpansListPage = () => {
|
|
4806
4756
|
const api = useAppInspectorApi();
|
|
4807
|
-
const [spans, setSpans] = (0,
|
|
4808
|
-
const [loading, setLoading] = (0,
|
|
4809
|
-
const hasFetched = (0,
|
|
4757
|
+
const [spans, setSpans] = (0, import_react25.useState)();
|
|
4758
|
+
const [loading, setLoading] = (0, import_react25.useState)(false);
|
|
4759
|
+
const hasFetched = (0, import_react25.useRef)(false);
|
|
4810
4760
|
const [includeReadOperations, setIncludeReadOperations] = useLocalStorage("includeReadOperations", false);
|
|
4811
|
-
const mapPageToNextCursor = (0,
|
|
4812
|
-
const [page, setPage] = (0,
|
|
4813
|
-
const [pageSize, setPageSize] = (0,
|
|
4814
|
-
const [spanCount, setSpanCount] = (0,
|
|
4815
|
-
const queryOptions = (0,
|
|
4761
|
+
const mapPageToNextCursor = (0, import_react25.useRef)({});
|
|
4762
|
+
const [page, setPage] = (0, import_react25.useState)(0);
|
|
4763
|
+
const [pageSize, setPageSize] = (0, import_react25.useState)(100);
|
|
4764
|
+
const [spanCount, setSpanCount] = (0, import_react25.useState)(0);
|
|
4765
|
+
const queryOptions = (0, import_react25.useMemo)(() => {
|
|
4816
4766
|
return {
|
|
4817
4767
|
is_write_operation: includeReadOperations ? void 0 : true,
|
|
4818
4768
|
limit: pageSize,
|
|
4819
4769
|
pagination_token: mapPageToNextCursor.current[page - 1]
|
|
4820
4770
|
};
|
|
4821
4771
|
}, [includeReadOperations, pageSize, page]);
|
|
4822
|
-
const [fetchError, setFetchError] = (0,
|
|
4772
|
+
const [fetchError, setFetchError] = (0, import_react25.useState)();
|
|
4823
4773
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
4824
|
-
const fetchSpans = (0,
|
|
4774
|
+
const fetchSpans = (0, import_react25.useCallback)(async () => {
|
|
4825
4775
|
setLoading(true);
|
|
4826
4776
|
try {
|
|
4827
4777
|
const response = await api.getSpans(queryOptions);
|
|
@@ -4838,26 +4788,26 @@ var SpansListPage = () => {
|
|
|
4838
4788
|
setLoading(false);
|
|
4839
4789
|
}
|
|
4840
4790
|
}, [api, page, queryOptions]);
|
|
4841
|
-
const fetchSpansSync = (0,
|
|
4791
|
+
const fetchSpansSync = (0, import_react25.useCallback)(() => {
|
|
4842
4792
|
void fetchSpans();
|
|
4843
4793
|
}, [fetchSpans]);
|
|
4844
|
-
(0,
|
|
4794
|
+
(0, import_react25.useEffect)(() => {
|
|
4845
4795
|
if (hasFetched.current) return;
|
|
4846
4796
|
if (status?.status !== "ENABLED") return;
|
|
4847
4797
|
hasFetched.current = true;
|
|
4848
4798
|
void fetchSpans();
|
|
4849
4799
|
}, [fetchSpans, status]);
|
|
4850
|
-
(0,
|
|
4800
|
+
(0, import_react25.useEffect)(() => {
|
|
4851
4801
|
if (!hasFetched.current) return;
|
|
4852
4802
|
void fetchSpans();
|
|
4853
4803
|
}, [fetchSpans]);
|
|
4854
|
-
const [selectedTraceId, setSelectedTraceId] = (0,
|
|
4855
|
-
const [selectedSpanId, setSelectedSpanId] = (0,
|
|
4856
|
-
const navigateToSpan = (0,
|
|
4804
|
+
const [selectedTraceId, setSelectedTraceId] = (0, import_react25.useState)();
|
|
4805
|
+
const [selectedSpanId, setSelectedSpanId] = (0, import_react25.useState)();
|
|
4806
|
+
const navigateToSpan = (0, import_react25.useCallback)((span) => {
|
|
4857
4807
|
setSelectedTraceId(span.trace_id);
|
|
4858
4808
|
setSelectedSpanId(span.span_id);
|
|
4859
4809
|
}, []);
|
|
4860
|
-
const clearSpans = (0,
|
|
4810
|
+
const clearSpans = (0, import_react25.useCallback)(async () => {
|
|
4861
4811
|
setLoading(true);
|
|
4862
4812
|
try {
|
|
4863
4813
|
await api.deleteSpans();
|
|
@@ -4871,7 +4821,7 @@ var SpansListPage = () => {
|
|
|
4871
4821
|
setLoading(false);
|
|
4872
4822
|
}
|
|
4873
4823
|
}, [api, fetchSpans]);
|
|
4874
|
-
const handleRetry = (0,
|
|
4824
|
+
const handleRetry = (0, import_react25.useCallback)(() => {
|
|
4875
4825
|
void checkStatus();
|
|
4876
4826
|
}, [checkStatus]);
|
|
4877
4827
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
@@ -4941,8 +4891,8 @@ var routes = {
|
|
|
4941
4891
|
};
|
|
4942
4892
|
|
|
4943
4893
|
// src/context.tsx
|
|
4944
|
-
var
|
|
4945
|
-
var
|
|
4894
|
+
var import_react26 = require("react");
|
|
4895
|
+
var import_react27 = require("react");
|
|
4946
4896
|
|
|
4947
4897
|
// src/constants/error-messages.ts
|
|
4948
4898
|
var ERROR_MESSAGES = {
|
|
@@ -5051,7 +5001,15 @@ var createApiClient = ({ localstackEndpoint }) => {
|
|
|
5051
5001
|
},
|
|
5052
5002
|
getSpans: async (request) => {
|
|
5053
5003
|
const endpoint = buildSpansEndpoint(request);
|
|
5054
|
-
|
|
5004
|
+
const response = await makeRequest({ endpoint, localstackEndpoint });
|
|
5005
|
+
return {
|
|
5006
|
+
...response,
|
|
5007
|
+
spans: response.spans.map((span) => ({
|
|
5008
|
+
...span,
|
|
5009
|
+
endTime: unixNanoToDate(span.end_time_unix_nano),
|
|
5010
|
+
startTime: unixNanoToDate(span.start_time_unix_nano)
|
|
5011
|
+
}))
|
|
5012
|
+
};
|
|
5055
5013
|
},
|
|
5056
5014
|
getStatus: async () => {
|
|
5057
5015
|
return makeRequest({
|
|
@@ -5064,12 +5022,12 @@ var createApiClient = ({ localstackEndpoint }) => {
|
|
|
5064
5022
|
|
|
5065
5023
|
// src/context.tsx
|
|
5066
5024
|
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
5067
|
-
var AppInspectorContext = (0,
|
|
5025
|
+
var AppInspectorContext = (0, import_react26.createContext)(void 0);
|
|
5068
5026
|
var AppInspectorContextProvider = (props) => {
|
|
5069
|
-
const api = (0,
|
|
5027
|
+
const api = (0, import_react27.useMemo)(() => {
|
|
5070
5028
|
return false ? createApiClientMock() : createApiClient({ localstackEndpoint: props.localstackEndpoint });
|
|
5071
5029
|
}, [props.localstackEndpoint]);
|
|
5072
|
-
const resolveLink = (0,
|
|
5030
|
+
const resolveLink = (0, import_react27.useCallback)(
|
|
5073
5031
|
(options) => {
|
|
5074
5032
|
if (options.to === "settings") {
|
|
5075
5033
|
return `${props.routePrefix}/settings`;
|
|
@@ -5081,7 +5039,7 @@ var AppInspectorContextProvider = (props) => {
|
|
|
5081
5039
|
},
|
|
5082
5040
|
[props.routePrefix]
|
|
5083
5041
|
);
|
|
5084
|
-
const contextValue = (0,
|
|
5042
|
+
const contextValue = (0, import_react27.useMemo)(
|
|
5085
5043
|
() => ({
|
|
5086
5044
|
linkComponent: props.linkComponent,
|
|
5087
5045
|
localstackEndpoint: props.localstackEndpoint,
|