@skyhook-io/radar-app 1.9.2 → 1.9.3
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/package.json
CHANGED
|
@@ -24,6 +24,8 @@ import type {
|
|
|
24
24
|
} from "@skyhook-io/k8s-ui";
|
|
25
25
|
import { CapacityView } from "./CapacityView";
|
|
26
26
|
import { updateDemandSearchParam } from "./CapacityDemand";
|
|
27
|
+
import { integrationBlock } from "./shared";
|
|
28
|
+
import { ApiError } from "../../api/client";
|
|
27
29
|
|
|
28
30
|
vi.mock("../../context/ConnectionContext", () => ({
|
|
29
31
|
useConnection: () => ({ connection: { state: "connected" } }),
|
|
@@ -2285,3 +2287,22 @@ describe("CapacityView activity", () => {
|
|
|
2285
2287
|
expect(html).not.toContain("All · ≥3");
|
|
2286
2288
|
});
|
|
2287
2289
|
});
|
|
2290
|
+
|
|
2291
|
+
describe("integrationBlock version skew", () => {
|
|
2292
|
+
it("maps a top-level 404 to the pre-v1.9.0 upgrade message, never 'Unknown error'", () => {
|
|
2293
|
+
const html = renderToString(
|
|
2294
|
+
<>{integrationBlock(undefined, new ApiError("404 page not found", 404), false, "Loading")}</>,
|
|
2295
|
+
);
|
|
2296
|
+
expect(html).toContain("Capacity needs a newer Radar");
|
|
2297
|
+
expect(html).toContain("v1.9.0");
|
|
2298
|
+
expect(html).not.toContain("Capacity unavailable");
|
|
2299
|
+
});
|
|
2300
|
+
|
|
2301
|
+
it("keeps ordinary failures on the generic error state", () => {
|
|
2302
|
+
const html = renderToString(
|
|
2303
|
+
<>{integrationBlock(undefined, new ApiError("boom", 500), false, "Loading")}</>,
|
|
2304
|
+
);
|
|
2305
|
+
expect(html).toContain("Capacity unavailable");
|
|
2306
|
+
expect(html).not.toContain("needs a newer Radar");
|
|
2307
|
+
});
|
|
2308
|
+
});
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
import {
|
|
52
52
|
isCapacityCursorInvalidError,
|
|
53
53
|
isForbiddenError,
|
|
54
|
+
isNotFoundError,
|
|
54
55
|
useCapacityPools,
|
|
55
56
|
} from "../../api/client";
|
|
56
57
|
import type { SelectedResource } from "../../types";
|
|
@@ -1517,9 +1518,20 @@ export function integrationBlock(
|
|
|
1517
1518
|
if (!response && isLoading)
|
|
1518
1519
|
return <PaneLoader label={loadingLabel} className="min-h-0 flex-1" />;
|
|
1519
1520
|
if (!response && error) {
|
|
1520
|
-
|
|
1521
|
-
<DeniedCapacityState detail={errorMessage(error)}
|
|
1522
|
-
|
|
1521
|
+
if (isForbiddenError(error))
|
|
1522
|
+
return <DeniedCapacityState detail={errorMessage(error)} />;
|
|
1523
|
+
// A 404 on the top-level capacity routes means the route doesn't exist on
|
|
1524
|
+
// this Radar — a pre-v1.9.0 binary behind a version-skewed host (Radar
|
|
1525
|
+
// Cloud), not a failure. The embedded OSS binary can never hit this.
|
|
1526
|
+
if (isNotFoundError(error))
|
|
1527
|
+
return (
|
|
1528
|
+
<EmptyState
|
|
1529
|
+
icon={Gauge}
|
|
1530
|
+
title="Capacity needs a newer Radar"
|
|
1531
|
+
detail="This cluster's Radar predates the Capacity view (added in Radar v1.9.0). Upgrade the in-cluster Radar to enable it."
|
|
1532
|
+
/>
|
|
1533
|
+
);
|
|
1534
|
+
return (
|
|
1523
1535
|
<EmptyState
|
|
1524
1536
|
icon={AlertTriangle}
|
|
1525
1537
|
title="Capacity unavailable"
|