@skyhook-io/radar-app 1.22.2 → 1.23.1
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 +8 -8
- package/src/App.tsx +49 -13
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +151 -27
- package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/poll.ts +78 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +16 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +315 -0
- package/src/api/workloadSource.ts +128 -12
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +128 -32
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
- package/src/components/helm/HelmView.tsx +4 -3
- package/src/components/helm/ObservedHelmNotice.tsx +39 -17
- package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +3 -3
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +4 -4
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/issues/uncheckedSources.test.ts +8 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/nudges/activeNudges.test.ts +39 -0
- package/src/components/nudges/activeNudges.ts +76 -0
- package/src/components/poll/OssPoll.tsx +871 -0
- package/src/components/poll/mount.test.ts +12 -0
- package/src/components/poll/pollCloud.test.ts +23 -0
- package/src/components/poll/pollCloud.ts +6 -0
- package/src/components/poll/pollDefinition.ts +93 -0
- package/src/components/poll/pollFlow.test.ts +140 -0
- package/src/components/poll/pollFlow.ts +137 -0
- package/src/components/poll/pollSender.test.ts +137 -0
- package/src/components/poll/pollSender.ts +76 -0
- package/src/components/poll/pollStorage.test.ts +53 -0
- package/src/components/poll/pollStorage.ts +77 -0
- package/src/components/poll/round.json +350 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
- package/src/components/resources/ImageFilesystemModal.tsx +42 -3
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +24 -11
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/ui/UpdateNotification.tsx +2 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/whats-new/WhatsNew.tsx +2 -0
- package/src/components/whats-new/releaseNotes.ts +75 -1
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +52 -13
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, useEffect } from "react";
|
|
3
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
4
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
|
|
7
|
+
import type { RunSummary } from "../../api/diagnose";
|
|
8
|
+
import {
|
|
9
|
+
DiagnoseProvider,
|
|
10
|
+
useDiagnose,
|
|
11
|
+
useDiagnoseLayout,
|
|
12
|
+
} from "./DiagnoseContext";
|
|
13
|
+
import { DiagnoseSurface } from "./DiagnoseSurface";
|
|
14
|
+
|
|
15
|
+
const api = vi.hoisted(() => ({ runs: [] as RunSummary[] }));
|
|
16
|
+
|
|
17
|
+
vi.mock("../../api/usage-data", async (importOriginal) => ({
|
|
18
|
+
...(await importOriginal<object>()),
|
|
19
|
+
recordUsageEvent: vi.fn(),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
vi.mock("../../api/diagnose", async (importOriginal) => ({
|
|
23
|
+
...(await importOriginal<object>()),
|
|
24
|
+
fetchAgents: async () => ({
|
|
25
|
+
enabled: true,
|
|
26
|
+
eligible: true,
|
|
27
|
+
consented: { "claude:safeguarded": true },
|
|
28
|
+
agents: [
|
|
29
|
+
{
|
|
30
|
+
name: "claude",
|
|
31
|
+
label: "Claude Code",
|
|
32
|
+
path: "/bin/claude",
|
|
33
|
+
version: "",
|
|
34
|
+
present: true,
|
|
35
|
+
supported: true,
|
|
36
|
+
hosted: false,
|
|
37
|
+
targetQuestions: true,
|
|
38
|
+
profiles: ["safeguarded"],
|
|
39
|
+
consentSurfaces: { safeguarded: "claude:safeguarded" },
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
listRuns: async () => ({ runs: api.runs }),
|
|
44
|
+
getRun: vi.fn(() => new Promise(() => {})),
|
|
45
|
+
subscribeRun: () => () => {},
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
vi.mock("../../api/client", async (importOriginal) => ({
|
|
49
|
+
...(await importOriginal<object>()),
|
|
50
|
+
useContexts: () => ({ data: [{ name: "cluster-a", isCurrent: true }] }),
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
Object.assign(globalThis, {
|
|
54
|
+
IS_REACT_ACT_ENVIRONMENT: true,
|
|
55
|
+
ResizeObserver: class {
|
|
56
|
+
observe() {}
|
|
57
|
+
unobserve() {}
|
|
58
|
+
disconnect() {}
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
let root: Root;
|
|
62
|
+
const probe = {} as {
|
|
63
|
+
d: ReturnType<typeof useDiagnose>;
|
|
64
|
+
layout: ReturnType<typeof useDiagnoseLayout>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
function Probe() {
|
|
68
|
+
const d = useDiagnose();
|
|
69
|
+
const layout = useDiagnoseLayout();
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
probe.d = d;
|
|
72
|
+
probe.layout = layout;
|
|
73
|
+
});
|
|
74
|
+
return layout.open ? <DiagnoseSurface /> : null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const flush = () =>
|
|
78
|
+
act(async () => {
|
|
79
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const surface = () =>
|
|
83
|
+
document.querySelector<HTMLElement>('[aria-label="AI investigations"]');
|
|
84
|
+
const button = (label: string) =>
|
|
85
|
+
surface()!.querySelector<HTMLButtonElement>(`button[aria-label="${label}"]`)!;
|
|
86
|
+
|
|
87
|
+
function pressEscape(target: Element) {
|
|
88
|
+
const event = new KeyboardEvent("keydown", {
|
|
89
|
+
key: "Escape",
|
|
90
|
+
bubbles: true,
|
|
91
|
+
cancelable: true,
|
|
92
|
+
});
|
|
93
|
+
act(() => {
|
|
94
|
+
target.dispatchEvent(event);
|
|
95
|
+
});
|
|
96
|
+
return event;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function openPanel(open: () => void) {
|
|
100
|
+
await act(async () =>
|
|
101
|
+
root.render(
|
|
102
|
+
<QueryClientProvider
|
|
103
|
+
client={
|
|
104
|
+
new QueryClient({ defaultOptions: { queries: { enabled: false } } })
|
|
105
|
+
}
|
|
106
|
+
>
|
|
107
|
+
<DiagnoseProvider browserURLState={false}>
|
|
108
|
+
<Probe />
|
|
109
|
+
</DiagnoseProvider>
|
|
110
|
+
</QueryClientProvider>,
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
await flush();
|
|
114
|
+
await act(async () => open());
|
|
115
|
+
await flush();
|
|
116
|
+
expect(surface()).not.toBeNull();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
beforeEach(() => {
|
|
120
|
+
api.runs = [];
|
|
121
|
+
localStorage.clear();
|
|
122
|
+
const element = document.createElement("div");
|
|
123
|
+
document.body.appendChild(element);
|
|
124
|
+
root = createRoot(element);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
afterEach(async () => {
|
|
128
|
+
await act(async () => root.unmount());
|
|
129
|
+
document.body.replaceChildren();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe("Escape in the docked investigation panel", () => {
|
|
133
|
+
it("moves focus into the docked panel on launch, closes on immediate Escape, and restores opener focus", async () => {
|
|
134
|
+
api.runs = [
|
|
135
|
+
{
|
|
136
|
+
id: "run-cart",
|
|
137
|
+
kind: "Deployment",
|
|
138
|
+
group: "apps",
|
|
139
|
+
namespace: "shop",
|
|
140
|
+
name: "cart",
|
|
141
|
+
context: "cluster-a",
|
|
142
|
+
status: "running",
|
|
143
|
+
createdAt: "2026-01-01T00:00:00Z",
|
|
144
|
+
updatedAt: "2026-01-01T00:00:00Z",
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
const launcher = document.createElement("button");
|
|
148
|
+
launcher.textContent = "Investigate";
|
|
149
|
+
document.body.appendChild(launcher);
|
|
150
|
+
launcher.focus();
|
|
151
|
+
expect(document.activeElement).toBe(launcher);
|
|
152
|
+
|
|
153
|
+
await openPanel(() => probe.d.openRun("run-cart"));
|
|
154
|
+
expect(surface()!.contains(document.activeElement)).toBe(true);
|
|
155
|
+
|
|
156
|
+
const event = pressEscape(document.activeElement!);
|
|
157
|
+
expect(event.defaultPrevented).toBe(true);
|
|
158
|
+
expect(probe.layout.open).toBe(false);
|
|
159
|
+
expect(surface()).toBeNull();
|
|
160
|
+
expect(document.activeElement).toBe(launcher);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("closes the panel when focus is inside it", async () => {
|
|
164
|
+
await openPanel(() => probe.d.openHome());
|
|
165
|
+
const close = button("Close");
|
|
166
|
+
close.focus();
|
|
167
|
+
const event = pressEscape(close);
|
|
168
|
+
expect(event.defaultPrevented).toBe(true);
|
|
169
|
+
expect(probe.layout.open).toBe(false);
|
|
170
|
+
expect(surface()).toBeNull();
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("closes the history overlay first, then the panel", async () => {
|
|
174
|
+
api.runs = [
|
|
175
|
+
{
|
|
176
|
+
id: "run-cart",
|
|
177
|
+
kind: "Deployment",
|
|
178
|
+
group: "apps",
|
|
179
|
+
namespace: "shop",
|
|
180
|
+
name: "cart",
|
|
181
|
+
context: "cluster-a",
|
|
182
|
+
status: "running",
|
|
183
|
+
createdAt: "2026-01-01T00:00:00Z",
|
|
184
|
+
updatedAt: "2026-01-01T00:00:00Z",
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
await openPanel(() => probe.d.openRun("run-cart"));
|
|
188
|
+
const history = button("Investigations");
|
|
189
|
+
expect(history.getAttribute("aria-expanded")).toBe("false");
|
|
190
|
+
await act(async () => history.click());
|
|
191
|
+
expect(history.getAttribute("aria-expanded")).toBe("true");
|
|
192
|
+
|
|
193
|
+
pressEscape(history);
|
|
194
|
+
expect(history.getAttribute("aria-expanded")).toBe("false");
|
|
195
|
+
expect(probe.layout.open).toBe(true);
|
|
196
|
+
|
|
197
|
+
pressEscape(history);
|
|
198
|
+
expect(probe.layout.open).toBe(false);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it("leaves the panel open when something inside it consumed the Escape", async () => {
|
|
202
|
+
await openPanel(() => probe.d.openHome());
|
|
203
|
+
const close = button("Close");
|
|
204
|
+
close.addEventListener("keydown", (event) => event.preventDefault());
|
|
205
|
+
pressEscape(close);
|
|
206
|
+
expect(probe.layout.open).toBe(true);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it("does not close the maximized workspace surface", async () => {
|
|
210
|
+
await openPanel(() => probe.d.openHome());
|
|
211
|
+
await act(async () => probe.layout.setMaximized(true));
|
|
212
|
+
pressEscape(button("Close"));
|
|
213
|
+
expect(probe.layout.open).toBe(true);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
@@ -51,6 +51,8 @@ import {
|
|
|
51
51
|
statusWord,
|
|
52
52
|
} from "./Home";
|
|
53
53
|
import { AgentSetupNotice } from "./AgentSetupNotice";
|
|
54
|
+
import { AgentSetupCloudRow } from "../cloudHints/AgentSetupCloudRow";
|
|
55
|
+
import { useCloudHintsEnabled } from "../cloudHints/cloudHints";
|
|
54
56
|
import {
|
|
55
57
|
EXAMPLE_INVESTIGATION_ID,
|
|
56
58
|
EXAMPLE_INVESTIGATION_RUN,
|
|
@@ -464,6 +466,7 @@ export function DiagnoseSurface({
|
|
|
464
466
|
// Feature is eligible here but not runnable yet (no agent installed, or one
|
|
465
467
|
// found that investigations couldn't start with): Home leads with the setup
|
|
466
468
|
// notice instead of an empty list.
|
|
469
|
+
const cloudHints = useCloudHintsEnabled();
|
|
467
470
|
const setupPending =
|
|
468
471
|
d.setupState === "needs-install" || d.setupState === "needs-restart";
|
|
469
472
|
|
|
@@ -620,6 +623,7 @@ export function DiagnoseSurface({
|
|
|
620
623
|
<div className="flex-1 overflow-y-auto">
|
|
621
624
|
<AgentSetupNotice
|
|
622
625
|
setupState={d.setupState}
|
|
626
|
+
cloudOption={cloudHints ? <AgentSetupCloudRow /> : undefined}
|
|
623
627
|
cliOverride={d.cliOverride}
|
|
624
628
|
checkingAgents={d.checkingAgents}
|
|
625
629
|
agentsCheckFailed={d.agentsCheckFailed}
|
|
@@ -652,6 +656,7 @@ export function DiagnoseSurface({
|
|
|
652
656
|
<div className="mx-auto w-full max-w-3xl px-4 py-8 sm:px-6">
|
|
653
657
|
<AgentSetupNotice
|
|
654
658
|
setupState={d.setupState}
|
|
659
|
+
cloudOption={cloudHints ? <AgentSetupCloudRow /> : undefined}
|
|
655
660
|
cliOverride={d.cliOverride}
|
|
656
661
|
checkingAgents={d.checkingAgents}
|
|
657
662
|
agentsCheckFailed={d.agentsCheckFailed}
|
|
@@ -680,6 +685,39 @@ export function DiagnoseSurface({
|
|
|
680
685
|
? d.view === "home" || !historyCollapsed
|
|
681
686
|
: historyOverlay);
|
|
682
687
|
|
|
688
|
+
// Capture the opener before child layout effects can move focus, so closing
|
|
689
|
+
// the docked panel restores focus cleanly instead of dropping it to body.
|
|
690
|
+
const openerRef = useRef<HTMLElement | null>(
|
|
691
|
+
typeof document !== "undefined" &&
|
|
692
|
+
document.activeElement instanceof HTMLElement
|
|
693
|
+
? document.activeElement
|
|
694
|
+
: null,
|
|
695
|
+
);
|
|
696
|
+
const maximizedRef = useRef(maximized);
|
|
697
|
+
|
|
698
|
+
useLayoutEffect(() => {
|
|
699
|
+
maximizedRef.current = maximized;
|
|
700
|
+
if (maximized) return;
|
|
701
|
+
const surface = surfaceRef.current;
|
|
702
|
+
if (surface && !surface.contains(document.activeElement)) {
|
|
703
|
+
surface.focus({ preventScroll: true });
|
|
704
|
+
}
|
|
705
|
+
}, [maximized]);
|
|
706
|
+
|
|
707
|
+
useLayoutEffect(() => {
|
|
708
|
+
const surface = surfaceRef.current;
|
|
709
|
+
const opener = openerRef.current;
|
|
710
|
+
return () => {
|
|
711
|
+
if (maximizedRef.current) return;
|
|
712
|
+
if (
|
|
713
|
+
opener?.isConnected &&
|
|
714
|
+
surface?.contains(document.activeElement)
|
|
715
|
+
) {
|
|
716
|
+
opener.focus({ preventScroll: true });
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
}, []);
|
|
720
|
+
|
|
683
721
|
useLayoutEffect(() => {
|
|
684
722
|
if (
|
|
685
723
|
!historyVisible &&
|
|
@@ -692,6 +730,7 @@ export function DiagnoseSurface({
|
|
|
692
730
|
return (
|
|
693
731
|
<div
|
|
694
732
|
ref={surfaceRef}
|
|
733
|
+
tabIndex={-1}
|
|
695
734
|
role="dialog"
|
|
696
735
|
aria-label="AI investigations"
|
|
697
736
|
onKeyDownCapture={(event) => {
|
|
@@ -701,7 +740,24 @@ export function DiagnoseSurface({
|
|
|
701
740
|
dismissHistory();
|
|
702
741
|
}
|
|
703
742
|
}}
|
|
704
|
-
|
|
743
|
+
// Bubble phase, so a menu or picker inside the panel that consumes its
|
|
744
|
+
// own Escape keeps the panel open. React also bubbles events from
|
|
745
|
+
// portaled children (dialogs), which the DOM check leaves to them. The
|
|
746
|
+
// maximized surface is the workspace page, where close() navigates away.
|
|
747
|
+
onKeyDown={(event) => {
|
|
748
|
+
if (
|
|
749
|
+
event.key !== "Escape" ||
|
|
750
|
+
event.defaultPrevented ||
|
|
751
|
+
event.nativeEvent.isComposing ||
|
|
752
|
+
maximized ||
|
|
753
|
+
!surfaceRef.current?.contains(event.target as Node)
|
|
754
|
+
)
|
|
755
|
+
return;
|
|
756
|
+
event.preventDefault();
|
|
757
|
+
event.stopPropagation();
|
|
758
|
+
d.close();
|
|
759
|
+
}}
|
|
760
|
+
className={`${DIAGNOSE_SURFACE_FRAME_CLASS} focus:outline-none`}
|
|
705
761
|
style={{
|
|
706
762
|
...positionStyle,
|
|
707
763
|
animation: "slide-in-from-right 0.22s cubic-bezier(0.32,0.72,0,1)",
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { openCloudFunnel } from '../CloudFunnelButton'
|
|
1
|
+
import { CloudHintLink } from '../cloudHints/CloudHintLink'
|
|
2
|
+
import { useCloudHintsEnabled } from '../cloudHints/cloudHints'
|
|
4
3
|
|
|
5
4
|
// The one sentence a standalone Radar adds for a remote destination: what Radar Cloud
|
|
6
5
|
// does. "Radar Cloud" opens the same dialog as the top-right button, so
|
|
7
6
|
// there is one pitch and one connect flow. That dialog connects THIS
|
|
8
7
|
// cluster; the destination is a second connect from Cloud, which is why the
|
|
9
|
-
// copy says "both clusters" and promises the view in Cloud, not here.
|
|
10
|
-
// is: the server decides whether there is anything to pitch (cloudConnect
|
|
11
|
-
// capability), and embedded hosts (Radar Cloud itself) mount neither.
|
|
8
|
+
// copy says "both clusters" and promises the view in Cloud, not here.
|
|
12
9
|
export function RemoteDestinationCloudHint() {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
if (embedded || !capabilities.data?.cloudConnect) return null
|
|
10
|
+
const enabled = useCloudHintsEnabled()
|
|
11
|
+
if (!enabled) return null
|
|
16
12
|
return (
|
|
17
13
|
<>
|
|
18
|
-
For resources on another cluster, connect both clusters to
|
|
19
|
-
<button type="button" onClick={openCloudFunnel} className="underline decoration-theme-border underline-offset-2 hover:text-theme-text-primary">
|
|
20
|
-
Radar Cloud
|
|
21
|
-
</button>{' '}
|
|
22
|
-
to see this app's resources together.
|
|
14
|
+
For resources on another cluster, connect both clusters to <CloudHintLink entry="gitops-remote" /> to see this app's resources together.
|
|
23
15
|
</>
|
|
24
16
|
)
|
|
25
17
|
}
|
|
@@ -19,7 +19,9 @@ vi.mock('../../api/client', async (importOriginal) => ({
|
|
|
19
19
|
useRadarFeature: () => ({ support: state.support }),
|
|
20
20
|
}))
|
|
21
21
|
vi.mock('./HelmDrawerFrame', () => ({ HelmDrawerFrame: ({ children }: { children: unknown }) => children }))
|
|
22
|
-
vi.mock('./ObservedHelmReleaseDrawer', () => ({
|
|
22
|
+
vi.mock('./ObservedHelmReleaseDrawer', () => ({
|
|
23
|
+
ObservedHelmReleaseDrawer: ({ notCollected }: { notCollected?: boolean }) => (notCollected ? 'observed drawer, not collected' : 'observed drawer'),
|
|
24
|
+
}))
|
|
23
25
|
|
|
24
26
|
;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
|
|
25
27
|
|
|
@@ -58,6 +60,17 @@ const denied = async () => {
|
|
|
58
60
|
return { ApiError, read: new ApiError('no', 403, { error_code: 'release_read_denied' }), other: new ApiError('no', 403) }
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
// The body Radar sends for a release read made as itself with
|
|
64
|
+
// --secret-access=none, as fetchJSON turns it into an error.
|
|
65
|
+
const notCollected = async () => {
|
|
66
|
+
const { ApiError } = await vi.importActual<typeof import('../../api/client')>('../../api/client')
|
|
67
|
+
const body = {
|
|
68
|
+
error: "failed to get release: Radar doesn't collect Secrets on this cluster: a cluster admin turned off its access to Secrets (rbac.secretAccess: none)",
|
|
69
|
+
error_code: 'radar_kind_not_collected',
|
|
70
|
+
}
|
|
71
|
+
return { policy: new ApiError(body.error, 503, body), outage: new ApiError('cluster unreachable', 503, { error: 'cluster unreachable' }) }
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
describe('HelmReleaseDrawer', () => {
|
|
62
75
|
it('opens an observed row without asking for the release', () => {
|
|
63
76
|
expect(render({ namespace: 'apps', name: 'api', observed: true })).toBe('observed drawer')
|
|
@@ -80,6 +93,26 @@ describe('HelmReleaseDrawer', () => {
|
|
|
80
93
|
expect(render({ namespace: 'apps', name: 'api' })).toBe('full drawer')
|
|
81
94
|
})
|
|
82
95
|
|
|
96
|
+
it('follows a shared link to the observed view, marked not collected, when Radar does not collect Secrets', async () => {
|
|
97
|
+
state.error = (await notCollected()).policy
|
|
98
|
+
expect(render({ namespace: 'apps', name: 'api' })).toBe('observed drawer, not collected')
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('opens a row from a list Radar did not collect as not collected, without asking for the release', () => {
|
|
102
|
+
expect(render({ namespace: 'apps', name: 'api', observed: true, storageNotCollected: true })).toBe('observed drawer, not collected')
|
|
103
|
+
expect(state.detailEnabled.every((enabled) => enabled === false)).toBe(true)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('keeps a denied caller on the denied view', async () => {
|
|
107
|
+
state.error = (await denied()).read
|
|
108
|
+
expect(render({ namespace: 'apps', name: 'api' })).not.toContain('not collected')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('leaves any other 503 to the full drawer, which reports it', async () => {
|
|
112
|
+
state.error = (await notCollected()).outage
|
|
113
|
+
expect(render({ namespace: 'apps', name: 'api' })).toBe('full drawer')
|
|
114
|
+
})
|
|
115
|
+
|
|
83
116
|
it('shows the full drawer to someone who can read the release', () => {
|
|
84
117
|
expect(render({ namespace: 'apps', name: 'api' })).toBe('full drawer')
|
|
85
118
|
})
|
|
@@ -8,7 +8,7 @@ import { X, Copy, Check, RefreshCw, Package, Code, History, Settings, Link2, Anc
|
|
|
8
8
|
import yaml from 'yaml'
|
|
9
9
|
import { useNavigate } from 'react-router-dom'
|
|
10
10
|
import { clsx } from 'clsx'
|
|
11
|
-
import { useHelmRelease, useHelmManifest, useHelmValues, useHelmUpgradeInfo, useHelmReleaseVersions, useHelmUninstall, upgradeWithProgress, rollbackWithProgress, useHelmPreviewValues, useHelmSourceVersions, useRadarFeature, HelmSourceSelectionError, isHelmReleaseReadDenied } from '../../api/client'
|
|
11
|
+
import { useHelmRelease, useHelmManifest, useHelmValues, useHelmUpgradeInfo, useHelmReleaseVersions, useHelmUninstall, upgradeWithProgress, rollbackWithProgress, useHelmPreviewValues, useHelmSourceVersions, useRadarFeature, HelmSourceSelectionError, isHelmReleaseReadDenied, isHelmReleaseNotCollected } from '../../api/client'
|
|
12
12
|
import { ValuesDiffPreview } from './ValuesDiffPreview'
|
|
13
13
|
import { useQueryClient } from '@tanstack/react-query'
|
|
14
14
|
import { ConfirmDialog } from '../ui/ConfirmDialog'
|
|
@@ -149,14 +149,16 @@ export const DEFAULT_SHOW_EFFECTIVE_VALUES = false
|
|
|
149
149
|
|
|
150
150
|
export function HelmReleaseDrawer({ release, onClose, onNavigateToResource, isOpen = true, rightInset = 0 }: HelmReleaseDrawerProps) {
|
|
151
151
|
// A row built without Helm's storage says so, which spares a read that would
|
|
152
|
-
// only be refused. A shared link doesn't, so it learns from the refusal
|
|
152
|
+
// only be refused. A shared link doesn't, so it learns from the refusal:
|
|
153
|
+
// the caller's own denial, or Radar not collecting Secrets at all.
|
|
153
154
|
const { error } = useHelmRelease(effectiveHelmStorageNamespace(release), release.name, { enabled: !release.observed })
|
|
154
155
|
const { support } = useRadarFeature('helmInventory')
|
|
155
|
-
const
|
|
156
|
+
const notCollected = Boolean(release.storageNotCollected) || (support === 'supported' && isHelmReleaseNotCollected(error))
|
|
157
|
+
const observed = release.observed || notCollected || (support === 'supported' && isHelmReleaseReadDenied(error))
|
|
156
158
|
return (
|
|
157
159
|
<HelmDrawerFrame onClose={onClose} isOpen={isOpen} rightInset={rightInset}>
|
|
158
160
|
{observed ? (
|
|
159
|
-
<ObservedHelmReleaseDrawer release={release} onClose={onClose} onNavigateToResource={onNavigateToResource} />
|
|
161
|
+
<ObservedHelmReleaseDrawer release={release} notCollected={notCollected} onClose={onClose} onNavigateToResource={onNavigateToResource} />
|
|
160
162
|
) : (
|
|
161
163
|
<FullHelmRelease release={release} onClose={onClose} onNavigateToResource={onNavigateToResource} />
|
|
162
164
|
)}
|
|
@@ -25,7 +25,7 @@ type ViewTab = 'releases' | 'charts'
|
|
|
25
25
|
interface HelmViewProps {
|
|
26
26
|
namespaces: string[]
|
|
27
27
|
selectedRelease?: SelectedHelmRelease | null
|
|
28
|
-
onReleaseClick?: (namespace: string, name: string, storageNamespace?: string, observed?: boolean) => void
|
|
28
|
+
onReleaseClick?: (namespace: string, name: string, storageNamespace?: string, observed?: boolean, storageNotCollected?: boolean) => void
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmViewProps) {
|
|
@@ -37,6 +37,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
37
37
|
const releases = inventory?.releases
|
|
38
38
|
const observed = inventory?.observed
|
|
39
39
|
const degraded = Boolean(inventory?.storageDenied)
|
|
40
|
+
const storageNotCollected = Boolean(inventory?.storageNotCollected)
|
|
40
41
|
// Revision and update time exist only on rows from Helm's storage.
|
|
41
42
|
const showHelmColumns = !degraded || Boolean(releases?.length)
|
|
42
43
|
const rowCount = inventory ? inventory.releases.length + inventory.observed.length : undefined
|
|
@@ -173,7 +174,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
173
174
|
scope: 'helm',
|
|
174
175
|
handler: () => {
|
|
175
176
|
const row = getHighlightedRelease()
|
|
176
|
-
if (row) onReleaseClick?.(row.release.namespace, row.release.name, row.release.storageNamespace, row.observed)
|
|
177
|
+
if (row) onReleaseClick?.(row.release.namespace, row.release.name, row.release.storageNamespace, row.observed, row.observed && storageNotCollected)
|
|
177
178
|
},
|
|
178
179
|
enabled: highlightedIndex >= 0,
|
|
179
180
|
},
|
|
@@ -356,7 +357,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
356
357
|
selectedRelease?.name === release.name &&
|
|
357
358
|
(selectedRelease?.storageNamespace || selectedRelease?.namespace) === (release.storageNamespace || release.namespace),
|
|
358
359
|
isHighlighted: index === highlightedIndex,
|
|
359
|
-
onClick: () => onReleaseClick?.(release.namespace, release.name, release.storageNamespace, row.observed),
|
|
360
|
+
onClick: () => onReleaseClick?.(release.namespace, release.name, release.storageNamespace, row.observed, row.observed && storageNotCollected),
|
|
360
361
|
onMouseEnter: () => setHighlightedIndex(-1),
|
|
361
362
|
}
|
|
362
363
|
return row.observed ? (
|
|
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react'
|
|
|
2
2
|
import { Info } from 'lucide-react'
|
|
3
3
|
import { Disclosure } from '@skyhook-io/k8s-ui/components/ui/Disclosure'
|
|
4
4
|
import { gapReasonText } from '@skyhook-io/k8s-ui/utils/read-actions'
|
|
5
|
+
import { SECRETS_NOT_COLLECTED_BODY, SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
|
|
5
6
|
import type { HelmInventory, ObservedHelmReleaseDetail } from '../../types'
|
|
6
7
|
|
|
7
8
|
const TITLE = 'Built from labels and annotations, not Helm’s own records'
|
|
@@ -82,13 +83,13 @@ function coverageSentence(coverage: HelmInventory['objectCoverage'], subject: st
|
|
|
82
83
|
return `Some objects weren’t read (${reasons.join(', ')}), so ${subject} may be missing more than usual.`
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
function NoticeCard({ children }: { children: ReactNode }) {
|
|
86
|
+
function NoticeCard({ title = TITLE, children }: { title?: string; children: ReactNode }) {
|
|
86
87
|
return (
|
|
87
|
-
<section aria-label={
|
|
88
|
+
<section aria-label={title} className="mx-4 mt-4 rounded-xl border border-theme-border bg-theme-surface p-4 shadow-theme-sm [contain:inline-size]">
|
|
88
89
|
<div className="flex items-start gap-3">
|
|
89
90
|
<Info className="mt-0.5 h-4 w-4 shrink-0 text-accent" aria-hidden />
|
|
90
91
|
<div className="min-w-0 flex-1">
|
|
91
|
-
<h2 className="text-sm font-semibold text-theme-text-primary">{
|
|
92
|
+
<h2 className="text-sm font-semibold text-theme-text-primary">{title}</h2>
|
|
92
93
|
<div className="mt-1 text-sm text-theme-text-secondary">{children}</div>
|
|
93
94
|
</div>
|
|
94
95
|
</div>
|
|
@@ -97,21 +98,33 @@ function NoticeCard({ children }: { children: ReactNode }) {
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
/** The callout above a Helm list that isn't entirely from Helm's storage. */
|
|
101
|
+
// Radar not collecting Secrets is an admin's chart setting, so more access for
|
|
102
|
+
// the reader wouldn't help: the notice says so instead of how to get access.
|
|
100
103
|
export function ObservedHelmNotice({ inventory }: { inventory: HelmInventory }) {
|
|
101
104
|
const coverage = coverageSentence(inventory.objectCoverage, 'this list')
|
|
102
105
|
const mixed = inventory.releases.length > 0
|
|
106
|
+
const notCollected = Boolean(inventory.storageNotCollected)
|
|
103
107
|
return (
|
|
104
|
-
<NoticeCard>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
<NoticeCard title={notCollected ? SECRETS_NOT_COLLECTED_TITLE : TITLE}>
|
|
109
|
+
{notCollected ? (
|
|
110
|
+
<p>
|
|
111
|
+
{SECRETS_NOT_COLLECTED_BODY} Helm keeps its releases in Secrets, so this list comes from labels and annotations on deployed
|
|
112
|
+
objects. It can miss releases, and a failed release can look fine.
|
|
113
|
+
</p>
|
|
114
|
+
) : (
|
|
115
|
+
<p>
|
|
116
|
+
{deniedScope(inventory)}, so {mixed ? 'releases there come' : 'this list comes'} from labels and annotations on deployed
|
|
117
|
+
objects. Those Secrets are the source of truth Helm itself uses, so this view can miss things, and a failed release can look fine.
|
|
118
|
+
</p>
|
|
119
|
+
)}
|
|
109
120
|
{coverage && <p className="mt-1">{coverage}</p>}
|
|
110
|
-
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
{!notCollected && (
|
|
122
|
+
<p className="mt-2">
|
|
123
|
+
<span className="font-medium text-theme-text-primary">How to get the full view:</span> get and list access to Secrets in the
|
|
124
|
+
namespace where Helm stores a release, usually the release’s namespace. That opens every Secret there to whoever holds it. Without
|
|
125
|
+
sign-in, Radar’s own identity holds it, so it reaches everyone who can open Radar.
|
|
126
|
+
</p>
|
|
127
|
+
)}
|
|
115
128
|
<Disclosure summary="What’s affected" className="mt-3" summaryClassName="font-medium text-accent-text">
|
|
116
129
|
<div className="mt-3 grid grid-cols-[repeat(auto-fit,minmax(15rem,1fr))] gap-x-8 gap-y-5 border-t border-theme-border pt-3">
|
|
117
130
|
{AFFECTED.map(({ heading, items }) => (
|
|
@@ -133,12 +146,21 @@ export function ObservedHelmNotice({ inventory }: { inventory: HelmInventory })
|
|
|
133
146
|
}
|
|
134
147
|
|
|
135
148
|
/** The drawer's short form: the list carries the detail. */
|
|
136
|
-
export function ObservedHelmDrawerNote({ coverage, refreshFailed }: { coverage?: ObservedHelmReleaseDetail['objectCoverage']; refreshFailed?: boolean }) {
|
|
149
|
+
export function ObservedHelmDrawerNote({ coverage, notCollected, refreshFailed }: { coverage?: ObservedHelmReleaseDetail['objectCoverage']; notCollected?: boolean; refreshFailed?: boolean }) {
|
|
137
150
|
const gaps = coverageSentence(coverage, 'this release')
|
|
138
151
|
return (
|
|
139
|
-
<NoticeCard>
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
<NoticeCard title={notCollected ? SECRETS_NOT_COLLECTED_TITLE : TITLE}>
|
|
153
|
+
{notCollected ? (
|
|
154
|
+
<>
|
|
155
|
+
{SECRETS_NOT_COLLECTED_BODY} Helm keeps this release in a Secret, so it comes from labels and annotations on its objects, and a
|
|
156
|
+
failed release can look fine. Helm’s history, manifest, values and hooks aren’t available.
|
|
157
|
+
</>
|
|
158
|
+
) : (
|
|
159
|
+
<>
|
|
160
|
+
Radar can’t read Helm’s release Secrets here, Helm’s source of truth, so this view can miss things, and a failed release can look
|
|
161
|
+
fine. Helm’s history, manifest, values and hooks aren’t available.
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
142
164
|
{gaps && <p className="mt-1">{gaps}</p>}
|
|
143
165
|
{refreshFailed && <p className="mt-1">Radar couldn’t refresh this, so it shows the last read.</p>}
|
|
144
166
|
</NoticeCard>
|
|
@@ -5,7 +5,8 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
|
5
5
|
import { MemoryRouter } from 'react-router-dom'
|
|
6
6
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
7
7
|
import type { HelmInventory, ObservedHelmRelease } from '../../types'
|
|
8
|
-
import { ApiError, isHelmReleaseReadDenied } from '../../api/client'
|
|
8
|
+
import { ApiError, fetchJSON, isHelmReleaseNotCollected, isHelmReleaseReadDenied } from '../../api/client'
|
|
9
|
+
import { SECRETS_NOT_COLLECTED_BODY, SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
|
|
9
10
|
import { compareRows, HelmView } from './HelmView'
|
|
10
11
|
import { ObservedHelmNotice } from './ObservedHelmNotice'
|
|
11
12
|
|
|
@@ -52,12 +53,18 @@ function denied(rows: ObservedHelmRelease[]): HelmInventory {
|
|
|
52
53
|
return { releases: [], observed: rows, storageDenied: { count: 2, names: ['team-a', 'team-b'] }, objectCoverage: { status: 'complete', gaps: [] } }
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
// /api/helm/inventory when Radar runs with --secret-access=none and reads as
|
|
57
|
+
// itself: no rows from Helm, every namespace unread, and the reason.
|
|
58
|
+
function notCollected(rows: ObservedHelmRelease[]): HelmInventory {
|
|
59
|
+
return { releases: [], observed: rows, storageDenied: { extent: 'all' }, storageNotCollected: true, objectCoverage: { status: 'complete', gaps: [] } }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function renderView(state: Partial<typeof inventoryState.current>, onReleaseClick?: Parameters<typeof HelmView>[0]['onReleaseClick']) {
|
|
56
63
|
inventoryState.current = { data: undefined, isPending: false, error: null, ...state }
|
|
57
64
|
return mount(
|
|
58
65
|
<QueryClientProvider client={new QueryClient()}>
|
|
59
66
|
<MemoryRouter>
|
|
60
|
-
<HelmView namespaces={[]} />
|
|
67
|
+
<HelmView namespaces={[]} onReleaseClick={onReleaseClick} />
|
|
61
68
|
</MemoryRouter>
|
|
62
69
|
</QueryClientProvider>,
|
|
63
70
|
)
|
|
@@ -229,6 +236,58 @@ describe('ObservedHelmNotice', () => {
|
|
|
229
236
|
})
|
|
230
237
|
})
|
|
231
238
|
|
|
239
|
+
describe('Helm list when Radar does not collect Secrets', () => {
|
|
240
|
+
it('says Secrets are not collected instead of how to get access', () => {
|
|
241
|
+
const container = renderView({ data: notCollected([observed]) })
|
|
242
|
+
const callout = container.querySelector(`section[aria-label="${SECRETS_NOT_COLLECTED_TITLE}"]`)
|
|
243
|
+
expect(callout).not.toBeNull()
|
|
244
|
+
expect(callout!.textContent).toContain(SECRETS_NOT_COLLECTED_BODY)
|
|
245
|
+
expect(callout!.textContent).toContain('this list comes from labels and annotations on deployed objects')
|
|
246
|
+
expect(callout!.textContent).not.toContain('How to get the full view')
|
|
247
|
+
expect(callout!.textContent).not.toContain('Radar can’t read Helm’s release Secrets')
|
|
248
|
+
expect(row(container, 'api')).toContain('api-1.2.3')
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
it('opens a row as not collected', () => {
|
|
252
|
+
const onReleaseClick = vi.fn()
|
|
253
|
+
const container = renderView({ data: notCollected([observed]) }, onReleaseClick)
|
|
254
|
+
act(() => (container.querySelector('tbody tr') as HTMLElement).click())
|
|
255
|
+
expect(onReleaseClick).toHaveBeenCalledWith('team-b', 'api', undefined, true, true)
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
it('keeps the access wording for a denied caller', () => {
|
|
259
|
+
const onReleaseClick = vi.fn()
|
|
260
|
+
const container = renderView({ data: denied([observed]) }, onReleaseClick)
|
|
261
|
+
expect(container.textContent).toContain('How to get the full view')
|
|
262
|
+
expect(container.textContent).not.toContain(SECRETS_NOT_COLLECTED_TITLE)
|
|
263
|
+
act(() => (container.querySelector('tbody tr') as HTMLElement).click())
|
|
264
|
+
expect(onReleaseClick).toHaveBeenCalledWith('team-b', 'api', undefined, true, false)
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
describe('isHelmReleaseNotCollected', () => {
|
|
269
|
+
afterEach(() => vi.unstubAllGlobals())
|
|
270
|
+
|
|
271
|
+
const respond = (status: number, body: unknown) =>
|
|
272
|
+
vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } })))
|
|
273
|
+
const readError = () => fetchJSON('/helm/releases/apps/api').then(() => undefined, (error: unknown) => error)
|
|
274
|
+
|
|
275
|
+
it('matches the answer Radar sends when it does not collect Secrets', async () => {
|
|
276
|
+
respond(503, {
|
|
277
|
+
error: "failed to get release: Radar doesn't collect Secrets on this cluster: a cluster admin turned off its access to Secrets (rbac.secretAccess: none)",
|
|
278
|
+
error_code: 'radar_kind_not_collected',
|
|
279
|
+
})
|
|
280
|
+
expect(isHelmReleaseNotCollected(await readError())).toBe(true)
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
it('leaves other failures alone', async () => {
|
|
284
|
+
respond(503, { error: 'cluster unreachable' })
|
|
285
|
+
expect(isHelmReleaseNotCollected(await readError())).toBe(false)
|
|
286
|
+
respond(403, { error: 'no', error_code: 'release_read_denied' })
|
|
287
|
+
expect(isHelmReleaseNotCollected(await readError())).toBe(false)
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
|
|
232
291
|
describe('compareRows', () => {
|
|
233
292
|
const full = (name: string, status: string, revision: number) => ({
|
|
234
293
|
observed: false as const,
|