@localstack/appinspector-ui 1.0.112 → 1.0.113
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 +32 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +69 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2421,6 +2421,13 @@ var import_material23 = require("@mui/material");
|
|
|
2421
2421
|
var import_react69 = require("react");
|
|
2422
2422
|
|
|
2423
2423
|
// src/api/errors.ts
|
|
2424
|
+
var AppInspectorDisabledError = class extends Error {
|
|
2425
|
+
constructor(message, cause) {
|
|
2426
|
+
super(message);
|
|
2427
|
+
this.name = "AppInspectorDisabledError";
|
|
2428
|
+
this.cause = cause;
|
|
2429
|
+
}
|
|
2430
|
+
};
|
|
2424
2431
|
var AppInspectorNotFoundError = class extends Error {
|
|
2425
2432
|
localstackVersion;
|
|
2426
2433
|
constructor(message, cause, localstackVersion) {
|
|
@@ -15510,7 +15517,7 @@ var StatusMessage = ({
|
|
|
15510
15517
|
}
|
|
15511
15518
|
);
|
|
15512
15519
|
}
|
|
15513
|
-
if (status?.status === "DISABLED") {
|
|
15520
|
+
if (error instanceof AppInspectorDisabledError || status?.status === "DISABLED") {
|
|
15514
15521
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
15515
15522
|
import_material8.Box,
|
|
15516
15523
|
{
|
|
@@ -15666,9 +15673,12 @@ var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
|
15666
15673
|
var AppInspectorStatusContext = (0, import_react45.createContext)(void 0);
|
|
15667
15674
|
var StatusProvider = ({ children }) => {
|
|
15668
15675
|
const { checking, checkStatus, error, status } = useStatus();
|
|
15676
|
+
const reportDisabled = (0, import_react45.useCallback)(() => {
|
|
15677
|
+
void checkStatus();
|
|
15678
|
+
}, [checkStatus]);
|
|
15669
15679
|
const value = (0, import_react45.useMemo)(
|
|
15670
|
-
() => ({ checking, checkStatus, status, statusError: error }),
|
|
15671
|
-
[checking, checkStatus, status, error]
|
|
15680
|
+
() => ({ checking, checkStatus, reportDisabled, status, statusError: error }),
|
|
15681
|
+
[checking, checkStatus, reportDisabled, status, error]
|
|
15672
15682
|
);
|
|
15673
15683
|
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(AppInspectorStatusContext.Provider, { value, children });
|
|
15674
15684
|
};
|
|
@@ -16026,17 +16036,19 @@ var makeRequest = async (options) => {
|
|
|
16026
16036
|
new Error(`404 from ${url}: ${response.statusText}`)
|
|
16027
16037
|
);
|
|
16028
16038
|
}
|
|
16039
|
+
if (response.status === 503) {
|
|
16040
|
+
throw new AppInspectorDisabledError(
|
|
16041
|
+
ERROR_MESSAGES.APP_INSPECTOR_DISABLED,
|
|
16042
|
+
new Error(`503 from ${url}: ${response.statusText}`)
|
|
16043
|
+
);
|
|
16044
|
+
}
|
|
16029
16045
|
throw new Error(`API request failed: ${response.status.toString()} ${response.statusText}`);
|
|
16030
16046
|
}
|
|
16031
16047
|
options.captureHeaders?.(response.headers);
|
|
16032
16048
|
return await response.json();
|
|
16033
16049
|
} catch (error) {
|
|
16034
16050
|
if (error instanceof TypeError) {
|
|
16035
|
-
|
|
16036
|
-
const isNetworkError = message.includes("fetch") || message.includes("network") || message.includes("failed to fetch");
|
|
16037
|
-
if (isNetworkError) {
|
|
16038
|
-
throw new ConnectionError(ERROR_MESSAGES.CONNECTION_FAILED, error);
|
|
16039
|
-
}
|
|
16051
|
+
throw new ConnectionError(ERROR_MESSAGES.CONNECTION_FAILED, error);
|
|
16040
16052
|
}
|
|
16041
16053
|
if (error instanceof Error) {
|
|
16042
16054
|
throw error;
|
|
@@ -18283,6 +18295,7 @@ function useThrottledItems(items, getId, catchUpIncrement = 10) {
|
|
|
18283
18295
|
var PAGE_SIZE = 30;
|
|
18284
18296
|
var useSpans = () => {
|
|
18285
18297
|
const api = useAppInspectorApi();
|
|
18298
|
+
const { reportDisabled } = useAppInspectorStatus();
|
|
18286
18299
|
const [spans, setSpans] = (0, import_react52.useState)();
|
|
18287
18300
|
const throttledSpans = useThrottledItems(spans, (span) => span.span_id);
|
|
18288
18301
|
const [fetchError, setFetchError] = (0, import_react52.useState)();
|
|
@@ -18387,6 +18400,11 @@ var useSpans = () => {
|
|
|
18387
18400
|
const clearFetchError = (0, import_react52.useCallback)(() => {
|
|
18388
18401
|
setFetchError(void 0);
|
|
18389
18402
|
}, []);
|
|
18403
|
+
(0, import_react52.useEffect)(() => {
|
|
18404
|
+
if (fetchError instanceof AppInspectorDisabledError || fetchError instanceof ConnectionError) {
|
|
18405
|
+
reportDisabled();
|
|
18406
|
+
}
|
|
18407
|
+
}, [fetchError, reportDisabled]);
|
|
18390
18408
|
return {
|
|
18391
18409
|
clearFetchError,
|
|
18392
18410
|
clearingSpans,
|
|
@@ -31362,7 +31380,12 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
31362
31380
|
spansReference.current = spans;
|
|
31363
31381
|
}
|
|
31364
31382
|
}, [spans, setSelectedEvent, spanId]);
|
|
31365
|
-
const { checkStatus, status, statusError } = useAppInspectorStatus();
|
|
31383
|
+
const { checkStatus, reportDisabled, status, statusError } = useAppInspectorStatus();
|
|
31384
|
+
(0, import_react68.useEffect)(() => {
|
|
31385
|
+
if (fetchError instanceof AppInspectorDisabledError || fetchError instanceof ConnectionError) {
|
|
31386
|
+
reportDisabled();
|
|
31387
|
+
}
|
|
31388
|
+
}, [fetchError, reportDisabled]);
|
|
31366
31389
|
const handleEnable = (0, import_react68.useCallback)(async () => {
|
|
31367
31390
|
await api.setStatus({ status: "ENABLED" });
|
|
31368
31391
|
void checkStatus();
|