@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Info, LineChart, Loader2, Lock, Wifi } from 'lucide-react'
|
|
2
2
|
import { clsx } from 'clsx'
|
|
3
|
-
import { AlertBanner, RadarUpgradeNote, Section, Tooltip, toneTextClass } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { AlertBanner, RadarUpgradeNote, Section, Tooltip, WorkspaceCard, toneTextClass } from '@skyhook-io/k8s-ui'
|
|
4
4
|
import { AreaChart, SeriesLegend, formatMetricValue, formatTimestamp, type TimeSeries, type TimeSeriesPoint } from '@skyhook-io/k8s-ui/components/charts'
|
|
5
5
|
import { isForbiddenError, useAutoPromConnect, usePrometheusConnect, usePrometheusStatus } from '../../api/client'
|
|
6
6
|
import { SUBSTRATE_RANGE, useSubstrateHealth, type SubstrateChart, type SubstrateHealth, type SubstrateTarget } from '../../api/substrateHealth'
|
|
@@ -27,17 +27,17 @@ export function SubstrateHealthCharts({ target, standalone = false, collapsible
|
|
|
27
27
|
workerPods?: number
|
|
28
28
|
}) {
|
|
29
29
|
useAutoPromConnect()
|
|
30
|
-
const { data: status } = usePrometheusStatus()
|
|
30
|
+
const { data: status, error: statusError } = usePrometheusStatus()
|
|
31
31
|
const connect = usePrometheusConnect()
|
|
32
32
|
const connected = status?.connected === true
|
|
33
33
|
const { data, error, upgrade, blockedReason, support } = useSubstrateHealth(target, connected && Boolean(target.name))
|
|
34
34
|
|
|
35
35
|
if (!connected) {
|
|
36
|
-
if (!standalone
|
|
36
|
+
if (!standalone) return null
|
|
37
37
|
return (
|
|
38
38
|
<Frame collapsible={collapsible}>
|
|
39
|
-
<Muted>{status.discovering ? 'Discovering Prometheus…' : status.error || 'Connect Prometheus to chart this pool\'s workers, resumes and crashes.'}</Muted>
|
|
40
|
-
{!status.discovering && (
|
|
39
|
+
<Muted>{statusError ? `Couldn’t read Prometheus connection status: ${statusError.message}` : !status ? 'Checking Prometheus connection…' : status.discovering ? 'Discovering Prometheus…' : status.error || 'Connect Prometheus to chart this pool\'s workers, resumes and crashes.'}</Muted>
|
|
40
|
+
{status && !status.discovering && (
|
|
41
41
|
<button type="button" onClick={() => connect.mutate()} disabled={connect.isPending} className="btn-brand mt-3 inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-medium">
|
|
42
42
|
{connect.isPending ? <Loader2 className="h-3.5 w-3.5 animate-spin" /> : <Wifi className="h-3.5 w-3.5" />}
|
|
43
43
|
Discover Prometheus
|
|
@@ -61,7 +61,7 @@ export function SubstrateHealthCharts({ target, standalone = false, collapsible
|
|
|
61
61
|
icon={Lock}
|
|
62
62
|
title="You don't have access to these metrics"
|
|
63
63
|
message={target.kind === 'workerpool'
|
|
64
|
-
?
|
|
64
|
+
? `Requires get on workerpools.ate.dev in namespace ${target.namespace}.`
|
|
65
65
|
: 'Agent Substrate charts for a node are available to users who can read Nodes.'}
|
|
66
66
|
/>
|
|
67
67
|
</Frame>
|
|
@@ -70,11 +70,11 @@ export function SubstrateHealthCharts({ target, standalone = false, collapsible
|
|
|
70
70
|
if (error) {
|
|
71
71
|
return <Frame collapsible={collapsible}><Muted tone="warning">Agent Substrate metrics could not be read: {error.message}</Muted></Frame>
|
|
72
72
|
}
|
|
73
|
-
if (!data) return null
|
|
73
|
+
if (!data) return standalone ? <Frame collapsible={collapsible}><Muted>Reading Agent Substrate metrics…</Muted></Frame> : null
|
|
74
74
|
|
|
75
75
|
switch (data.status) {
|
|
76
76
|
case 'notOnNode':
|
|
77
|
-
return null
|
|
77
|
+
return standalone ? <Frame collapsible={collapsible}><Muted>No Agent Substrate series were found.</Muted></Frame> : null
|
|
78
78
|
case 'notFound':
|
|
79
79
|
if (target.kind !== 'workerpool') return null
|
|
80
80
|
return <Frame collapsible={collapsible}><Muted>{workerPods === 0 ? NO_WORKERS : NOT_FOUND.workerpool}</Muted></Frame>
|
|
@@ -95,13 +95,7 @@ function Frame({ children, collapsible }: { children: React.ReactNode; collapsib
|
|
|
95
95
|
{collapsible ? (
|
|
96
96
|
<Section title={title} icon={LineChart}>{children}</Section>
|
|
97
97
|
) : (
|
|
98
|
-
|
|
99
|
-
<h3 className="mb-2 flex items-center gap-2 text-sm font-medium text-theme-text-secondary">
|
|
100
|
-
<LineChart className="h-4 w-4" />
|
|
101
|
-
{title}
|
|
102
|
-
</h3>
|
|
103
|
-
{children}
|
|
104
|
-
</>
|
|
98
|
+
<WorkspaceCard title={title}>{children}</WorkspaceCard>
|
|
105
99
|
)}
|
|
106
100
|
</section>
|
|
107
101
|
)
|
|
@@ -22,7 +22,7 @@ vi.mock('../../api/client', () => ({
|
|
|
22
22
|
useImageMetadata: () => state.showMetadata ? ({
|
|
23
23
|
data: { image: state.metadataImage, digest: 'sha256:abc', platform: 'linux/amd64', totalSize: 1024, layerCount: 1, authMethod: 'google', cached: false },
|
|
24
24
|
refetch: state.refetch,
|
|
25
|
-
}) : ({ error: new ApiError('Authentication required',
|
|
25
|
+
}) : ({ error: new ApiError(typeof state.errorData.error === 'string' ? state.errorData.error : 'Authentication required', state.errorStatus), refetch: state.refetch }),
|
|
26
26
|
}))
|
|
27
27
|
|
|
28
28
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
@@ -107,6 +107,26 @@ it.each(['node_only', 'registry_unreachable'])('explains a %s image instead of a
|
|
|
107
107
|
}
|
|
108
108
|
})
|
|
109
109
|
|
|
110
|
+
it('explains pull Secrets Radar may not read, with the server message and no registry sign-in help', async () => {
|
|
111
|
+
// The body writeAuthError sends with --secret-access=none.
|
|
112
|
+
const message = "Authentication required for this image. Radar couldn't use the Pod's image pull Secrets: a cluster admin turned off its access to Secrets (rbac.secretAccess: none)"
|
|
113
|
+
state.errorData = { error: message, registryType: 'google', reason: 'radar_kind_not_collected' }
|
|
114
|
+
const text = await renderModal({ onSwitchToPodFiles: () => {} })
|
|
115
|
+
expect(text).toContain("Secrets aren't collected on this cluster")
|
|
116
|
+
expect(text).toContain(message)
|
|
117
|
+
expect(text).toContain('Browse live files from running pod below')
|
|
118
|
+
expect(text).not.toContain('Authentication Required')
|
|
119
|
+
expect(text).not.toContain('Failed to inspect image')
|
|
120
|
+
expect(text).not.toContain('gcloud')
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it('keeps registry sign-in help for a 401 without a reason', async () => {
|
|
124
|
+
state.errorData = { error: 'Authentication required for this image', registryType: 'google' }
|
|
125
|
+
const text = await renderModal()
|
|
126
|
+
expect(text).toContain('Authentication Required')
|
|
127
|
+
expect(text).not.toContain("Secrets aren't collected on this cluster")
|
|
128
|
+
})
|
|
129
|
+
|
|
110
130
|
it('keeps the generic error box for an error without a known reason', async () => {
|
|
111
131
|
state.errorStatus = 500
|
|
112
132
|
state.errorData = { error: 'Failed to inspect image' }
|
|
@@ -13,6 +13,7 @@ import { apiUrl, getAuthHeaders, getCredentialsMode } from '../../api/config'
|
|
|
13
13
|
import { readErrorBody } from '../../api/httpErrors'
|
|
14
14
|
import { Input } from '@skyhook-io/k8s-ui'
|
|
15
15
|
import { useIsAuthEnabled } from '../../contexts/CapabilitiesContext'
|
|
16
|
+
import { SECRETS_NOT_COLLECTED_TITLE } from '@skyhook-io/k8s-ui/utils/secret-collection'
|
|
16
17
|
|
|
17
18
|
const radarLoadingIconUrl = assetUrl(radarLoadingIcon)
|
|
18
19
|
|
|
@@ -75,8 +76,13 @@ export function ImageFilesystemModal({
|
|
|
75
76
|
refetch: refetchMetadata,
|
|
76
77
|
} = useImageMetadata(image, namespace, podName, pullSecrets, open)
|
|
77
78
|
|
|
78
|
-
// Detect auth errors from metadata fetch
|
|
79
|
-
|
|
79
|
+
// Detect auth errors from metadata fetch. A 401 because Radar's Secret
|
|
80
|
+
// access is off isn't fixed by registry auth, so it gets its own notice.
|
|
81
|
+
const isUnauthorized = metadataError instanceof ApiError && metadataError.status === 401
|
|
82
|
+
const pullSecretsNotCollectedMessage = isUnauthorized && metadataError.data?.reason === 'radar_kind_not_collected'
|
|
83
|
+
? metadataError.message
|
|
84
|
+
: undefined
|
|
85
|
+
const isAuthError = isUnauthorized && pullSecretsNotCollectedMessage === undefined
|
|
80
86
|
const registryType = isAuthError ? (metadataError.data?.registryType as string) : undefined
|
|
81
87
|
const unavailable = metadataError instanceof ApiError ? registryUnavailable(metadataError.data) : undefined
|
|
82
88
|
|
|
@@ -222,6 +228,13 @@ export function ImageFilesystemModal({
|
|
|
222
228
|
/>
|
|
223
229
|
)}
|
|
224
230
|
|
|
231
|
+
{pullSecretsNotCollectedMessage !== undefined && (
|
|
232
|
+
<PullSecretsNotCollected
|
|
233
|
+
message={pullSecretsNotCollectedMessage}
|
|
234
|
+
liveFilesLinkShown={Boolean(onSwitchToPodFiles)}
|
|
235
|
+
/>
|
|
236
|
+
)}
|
|
237
|
+
|
|
225
238
|
{unavailable && (
|
|
226
239
|
<RegistryUnavailable
|
|
227
240
|
{...unavailable}
|
|
@@ -231,7 +244,7 @@ export function ImageFilesystemModal({
|
|
|
231
244
|
)}
|
|
232
245
|
|
|
233
246
|
{/* Other errors keep the existing red error box */}
|
|
234
|
-
{error && !isAuthError && !unavailable && (
|
|
247
|
+
{error && !isAuthError && pullSecretsNotCollectedMessage === undefined && !unavailable && (
|
|
235
248
|
<div className="p-4 bg-red-500/10 border border-red-500/30 rounded-lg">
|
|
236
249
|
<div className="flex items-start gap-3">
|
|
237
250
|
<AlertTriangle className="w-5 h-5 text-red-400 shrink-0 mt-0.5" />
|
|
@@ -551,6 +564,32 @@ function registryUnavailable(data: Record<string, unknown> | undefined): Registr
|
|
|
551
564
|
return undefined
|
|
552
565
|
}
|
|
553
566
|
|
|
567
|
+
interface PullSecretsNotCollectedProps {
|
|
568
|
+
message: string
|
|
569
|
+
liveFilesLinkShown: boolean
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// The Pod has pull Secrets, but Radar's access to Secrets is turned off, so
|
|
573
|
+
// they were never tried. The server's message names that cause.
|
|
574
|
+
function PullSecretsNotCollected({ message, liveFilesLinkShown }: PullSecretsNotCollectedProps) {
|
|
575
|
+
return (
|
|
576
|
+
<div className="flex flex-col items-center justify-center py-8">
|
|
577
|
+
<Shield className="w-16 h-16 text-amber-400 mb-4" />
|
|
578
|
+
<h4 className="text-lg font-medium text-theme-text-primary mb-2">
|
|
579
|
+
{SECRETS_NOT_COLLECTED_TITLE}
|
|
580
|
+
</h4>
|
|
581
|
+
<p className="text-sm text-theme-text-secondary text-center max-w-md mb-2">
|
|
582
|
+
{message}
|
|
583
|
+
</p>
|
|
584
|
+
{liveFilesLinkShown && (
|
|
585
|
+
<p className="text-xs text-theme-text-tertiary text-center max-w-md mb-2">
|
|
586
|
+
To see the files now, use Browse live files from running pod below.
|
|
587
|
+
</p>
|
|
588
|
+
)}
|
|
589
|
+
</div>
|
|
590
|
+
)
|
|
591
|
+
}
|
|
592
|
+
|
|
554
593
|
interface RegistryUnavailableProps extends RegistryUnavailableInfo {
|
|
555
594
|
liveFilesLinkShown: boolean
|
|
556
595
|
onRetry: () => void
|
|
@@ -13,10 +13,8 @@ import { useConnection } from '../../context/ConnectionContext'
|
|
|
13
13
|
import { getSecretStoreProviderType } from '@skyhook-io/k8s-ui'
|
|
14
14
|
import { usePinnedKinds } from '../../hooks/useFavorites'
|
|
15
15
|
import { useResourceCounts } from '../../hooks/useResourceCounts'
|
|
16
|
-
import {
|
|
17
|
-
import { useVeleroSidebarWorkspace } from '../velero/useVeleroSidebarWorkspace'
|
|
16
|
+
import { useIntegrationSidebars } from '../../integrations/sidebarWorkspaces'
|
|
18
17
|
import { isVeleroBackupKind } from '../velero/routes'
|
|
19
|
-
import { useMergedSidebarWorkspaces } from '../workspace/sidebar'
|
|
20
18
|
import { renderResourceKindList, resourceKindListMode, useResourceHostFeatures } from '../../integrations/resourceHosts'
|
|
21
19
|
import { useOpenLogs, useOpenWorkloadLogs } from '../dock'
|
|
22
20
|
import {
|
|
@@ -137,9 +135,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
137
135
|
}
|
|
138
136
|
return result
|
|
139
137
|
}, [issuesData])
|
|
140
|
-
const
|
|
141
|
-
const veleroSidebarWorkspace = useVeleroSidebarWorkspace({ apiResources })
|
|
142
|
-
const sidebarCategoryWorkspaces = useMergedSidebarWorkspaces(cnpgSidebarWorkspace, veleroSidebarWorkspace)
|
|
138
|
+
const sidebarCategoryWorkspaces = useIntegrationSidebars({ apiResources, namespaces, cnpg: { withMetrics: selectedKind?.group === 'postgresql.cnpg.io' } })
|
|
143
139
|
const workloadWrites = namespaces.length === 0
|
|
144
140
|
? capabilities?.workloadWrites
|
|
145
141
|
: namespaces.length === 1
|
|
@@ -251,6 +247,20 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
251
247
|
: null
|
|
252
248
|
|
|
253
249
|
const loadingInterval = useMemo(() => createListRefetchInterval(120000), [])
|
|
250
|
+
const { support: secretLiveReadSupport } = useRadarFeature('secretLiveRead')
|
|
251
|
+
const secretLiveRead = secretLiveReadSupport === 'supported'
|
|
252
|
+
// Read live as the person on each request, with no watch behind it: the
|
|
253
|
+
// list refreshes when they ask, not on a timer.
|
|
254
|
+
const secretsReadLive = secretLiveRead && capabilities?.secretCollection === 'disabled-by-policy'
|
|
255
|
+
const viewingSecrets = selectedKind?.kind === 'Secret' && !selectedKind.group
|
|
256
|
+
const selectedKindReadLive = secretsReadLive && viewingSecrets
|
|
257
|
+
|
|
258
|
+
// Certificate expiry for the Secrets list. Read live, it is only fetched
|
|
259
|
+
// while that list is open, so elsewhere it waits to learn how it is read.
|
|
260
|
+
const certExpiryQuery = useSecretCertExpiry(namespaces, viewingSecrets || (!capabilitiesPending && !secretsReadLive), secretsReadLive)
|
|
261
|
+
const certExpiry = certExpiryQuery.data
|
|
262
|
+
const certExpiryError = certExpiryQuery.isError
|
|
263
|
+
const refetchCertExpiry = certExpiryQuery.refetch
|
|
254
264
|
|
|
255
265
|
const selectedKindListsAsTable = resourceKindListMode(selectedKind, hostFeatures, capabilitiesPending) === 'table'
|
|
256
266
|
|
|
@@ -273,7 +283,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
273
283
|
staleTime: 30000,
|
|
274
284
|
// Safety net — SSE k8s_event drives near-real-time invalidation. A list
|
|
275
285
|
// whose namespaces are still loading is re-read until they finish.
|
|
276
|
-
refetchInterval: loadingInterval,
|
|
286
|
+
refetchInterval: selectedKindReadLive ? false : loadingInterval,
|
|
277
287
|
retry: (failureCount: number, error: Error) => {
|
|
278
288
|
if (isForbiddenError(error) || isKindSyncFailed(error) || isUnretryableReadError(error)) return false
|
|
279
289
|
// Cluster still connecting, or this kind's informer still completing
|
|
@@ -287,6 +297,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
287
297
|
})
|
|
288
298
|
|
|
289
299
|
// Map to ResourceQueryResult shape
|
|
300
|
+
const refetchSelectedKind = selectedKindQuery.refetch
|
|
290
301
|
const selectedKindQueryResult: ResourceQueryResult | undefined = useMemo(() => {
|
|
291
302
|
if (!selectedKind) return undefined
|
|
292
303
|
return {
|
|
@@ -296,10 +307,12 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
296
307
|
data: selectedKindQueryBlocked ? [] : selectedKindQuery.data?.items,
|
|
297
308
|
isLoading: waitingForGuardCount || selectedKindQuery.isLoading,
|
|
298
309
|
error: selectedKindQueryBlocked ? undefined : selectedKindQuery.error,
|
|
299
|
-
refetch:
|
|
310
|
+
refetch: selectedKindReadLive
|
|
311
|
+
? () => { void refetchSelectedKind(); void refetchCertExpiry() }
|
|
312
|
+
: refetchSelectedKind,
|
|
300
313
|
dataUpdatedAt: selectedKindQuery.dataUpdatedAt,
|
|
301
314
|
}
|
|
302
|
-
}, [selectedKind, selectedKindQueryBlocked, waitingForGuardCount, selectedKindQuery.data?.items, selectedKindQuery.data?.coverage, selectedKindQuery.isLoading, selectedKindQuery.error,
|
|
315
|
+
}, [selectedKind, selectedKindQueryBlocked, waitingForGuardCount, selectedKindQuery.data?.items, selectedKindQuery.data?.coverage, selectedKindQuery.isLoading, selectedKindQuery.error, refetchSelectedKind, selectedKindQuery.dataUpdatedAt, selectedKindReadLive, refetchCertExpiry])
|
|
303
316
|
|
|
304
317
|
// An empty filtered list reads as "there are none" unless it says what the
|
|
305
318
|
// filter hides. Under --namespace-scope the cache holds no other namespace,
|
|
@@ -320,8 +333,6 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
320
333
|
const { data: topPodMetrics } = useTopPodMetrics({ enabled: topPodMetricsEnabled, namespaces })
|
|
321
334
|
const { data: topNodeMetrics } = useTopNodeMetrics({ enabled: topNodeMetricsEnabled })
|
|
322
335
|
|
|
323
|
-
// Certificate expiry
|
|
324
|
-
const { data: certExpiry, isError: certExpiryError } = useSecretCertExpiry(namespaces)
|
|
325
336
|
|
|
326
337
|
// An ExternalSecret names a store; only the store says which backend it reads
|
|
327
338
|
// from. Two list calls per page beat one lookup per row, and the column shows
|
|
@@ -420,6 +431,8 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
420
431
|
emptyScopeHint={emptyHint && selectedKindCanonical
|
|
421
432
|
? <EmptyNamespaceHint hint={emptyHint} namespaces={namespaces} kind={selectedKindCanonical} onShowAll={namespaceScope?.canClearNamespace ? onClearNamespaces : undefined} />
|
|
422
433
|
: undefined}
|
|
434
|
+
secretCollection={capabilities?.secretCollection}
|
|
435
|
+
secretLiveRead={secretLiveRead}
|
|
423
436
|
// Injected data
|
|
424
437
|
apiResources={apiResources}
|
|
425
438
|
// Lightweight counts for sidebar (replaces 233 parallel queries)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { connectionHeaderValue } from '../../../api/connectionBinding'
|
|
2
2
|
import { usePodDetailAccess } from '../PodDebugAction'
|
|
3
3
|
import { getApiBase } from '../../../api/config'
|
|
4
|
+
import { SUBSTRATE_WORKER_POOL_LABEL } from '@skyhook-io/k8s-ui/components/resources/resource-utils-agent-runtimes'
|
|
5
|
+
import { SubstrateWorkerPodContext } from '../../substrate/SubstrateWorkerPodContext'
|
|
4
6
|
import { hasPrometheusCharts } from '../../../api/prometheusCharts'
|
|
5
7
|
import { PodRenderer as BasePodRenderer } from '@skyhook-io/k8s-ui/components/resources/renderers/PodRenderer'
|
|
6
8
|
import type { CopyHandler } from '@skyhook-io/k8s-ui/components/ui/drawer-components'
|
|
@@ -10,7 +12,7 @@ import { useMemo } from 'react'
|
|
|
10
12
|
import { useNavigate } from 'react-router-dom'
|
|
11
13
|
import { useOpenTerminal, useOpenLogs } from '../../dock'
|
|
12
14
|
import { useCapabilitiesContext, useNamespacedCapabilities, useIsLocalDeployment } from '../../../contexts/CapabilitiesContext'
|
|
13
|
-
import { getVisibleLiveMetrics, isLiveMetricsUnavailable, shouldFetchLiveMetrics, usePodEnvironment, usePodMetrics, usePodMetricsHistory, usePrometheusResourceMetrics, usePrometheusStatus, useResourceEvents, useResources, useRevealPodEnvironment } from '../../../api/client'
|
|
15
|
+
import { getVisibleLiveMetrics, isLiveMetricsUnavailable, shouldFetchLiveMetrics, usePodEnvironment, usePodMetrics, usePodMetricsHistory, usePrometheusResourceMetrics, usePrometheusStatus, useRadarFeature, useResourceEvents, useResources, useRevealPodEnvironment } from '../../../api/client'
|
|
14
16
|
import { toSecretsStoreRead } from '../../../api/secretsStore'
|
|
15
17
|
import {
|
|
16
18
|
SECRETS_STORE_GROUP, SECRET_PROVIDER_CLASSES, SECRET_PROVIDER_CLASS_POD_STATUSES, getSecretsStoreVolumes,
|
|
@@ -26,6 +28,7 @@ import { PodFilesystemModal } from '../PodFilesystemModal'
|
|
|
26
28
|
|
|
27
29
|
interface PodRendererProps {
|
|
28
30
|
data: any
|
|
31
|
+
expanded?: boolean
|
|
29
32
|
onCopy: CopyHandler
|
|
30
33
|
copied: string | null
|
|
31
34
|
onNavigate?: (ref: { kind: string; namespace: string; name: string }) => void
|
|
@@ -33,9 +36,11 @@ interface PodRendererProps {
|
|
|
33
36
|
resolvedEnvFrom?: ResolvedEnvFrom
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
export function PodRenderer({ data, onCopy, copied, onNavigate, onOpenLogs, resolvedEnvFrom }: PodRendererProps) {
|
|
39
|
+
export function PodRenderer({ data, expanded, onCopy, copied, onNavigate, onOpenLogs, resolvedEnvFrom }: PodRendererProps) {
|
|
37
40
|
const namespace = data.metadata?.namespace
|
|
38
41
|
const podName = data.metadata?.name
|
|
42
|
+
const { support: substrateWorkspace } = useRadarFeature('substrateWorkspace')
|
|
43
|
+
const substratePool = data.metadata?.labels?.[SUBSTRATE_WORKER_POOL_LABEL]
|
|
39
44
|
const isTerminal = data.status?.phase === 'Succeeded' || data.status?.phase === 'Failed'
|
|
40
45
|
const environmentEnabled = [...(data.spec?.initContainers ?? []), ...(data.spec?.containers ?? [])]
|
|
41
46
|
.some((container: any) => container.env?.length > 0 || container.envFrom?.length > 0)
|
|
@@ -106,6 +111,7 @@ export function PodRenderer({ data, onCopy, copied, onNavigate, onOpenLogs, reso
|
|
|
106
111
|
return (
|
|
107
112
|
<BasePodRenderer
|
|
108
113
|
data={data}
|
|
114
|
+
substrateWorkerContext={substrateWorkspace !== 'unsupported' && substratePool && namespace && podName ? <SubstrateWorkerPodContext namespace={namespace} pool={substratePool} pod={podName} resource={data} framed={expanded} /> : undefined}
|
|
109
115
|
onCopy={onCopy}
|
|
110
116
|
copied={copied}
|
|
111
117
|
onNavigate={onNavigate}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useOpenCostSummary, usePrometheusStatus, type useArgoStatus } from '../../api/client'
|
|
1
|
+
import { useMetricsRelayChecking, useOpenCostSummary, usePrometheusStatus, type useArgoStatus } from '../../api/client'
|
|
2
2
|
import { costIntegrationUnavailableMessage, costSourceLabel } from '../cost/source'
|
|
3
3
|
import { metricsSourceLine, sourceNote } from './openobserveStatus'
|
|
4
4
|
import type { IntegrationKind, IntegrationProfile } from './LocalConnectionSettings'
|
|
@@ -14,10 +14,11 @@ export function LocalIntegrationStatus({ kind, profile, argo, busy, changedAt }:
|
|
|
14
14
|
}) {
|
|
15
15
|
const prom = usePrometheusStatus(kind === 'metrics')
|
|
16
16
|
const cost = useOpenCostSummary(kind === 'cost')
|
|
17
|
+
const metricsChecking = useMetricsRelayChecking()
|
|
17
18
|
const query = kind === 'metrics' ? prom : kind === 'cost' ? cost : argo
|
|
18
19
|
// Background polls keep the last status; only the first load, or a result
|
|
19
20
|
// older than the latest saved integration change, reads as "Checking…".
|
|
20
|
-
const checking = busy || query.isPlaceholderData || (query.isFetching && !query.data) ||
|
|
21
|
+
const checking = busy || (kind === 'metrics' && metricsChecking) || query.isPlaceholderData || (query.isFetching && !query.data) ||
|
|
21
22
|
Math.max(query.dataUpdatedAt, query.errorUpdatedAt) < changedAt
|
|
22
23
|
let status = 'Checking…'
|
|
23
24
|
let detail: string | undefined
|
|
@@ -4,7 +4,7 @@ import { createPortal } from 'react-dom'
|
|
|
4
4
|
import {
|
|
5
5
|
Settings, X, RotateCcw, RotateCw, Loader2, Copy, Check, Pin, Shield, Lock, Plug,
|
|
6
6
|
Terminal, Boxes, Activity, GitBranch, Sparkles, SlidersHorizontal, Zap,
|
|
7
|
-
LayoutDashboard, ChevronRight, AlertTriangle, Coins, EyeOff,
|
|
7
|
+
LayoutDashboard, ChevronRight, AlertTriangle, Coins, EyeOff, Bot,
|
|
8
8
|
type LucideIcon,
|
|
9
9
|
} from 'lucide-react'
|
|
10
10
|
import { clsx } from 'clsx'
|
|
@@ -15,7 +15,7 @@ import { TRANSITION_BACKDROP, TRANSITION_PANEL, overlayExitMs, overlayTransition
|
|
|
15
15
|
import { apiUrl, getApiBase, getAuthHeaders, getCredentialsMode, mcpEndpointUrl } from '../../api/config'
|
|
16
16
|
import {
|
|
17
17
|
useCloudRole, useVersionCheck, useClusterInfo, usePrometheusStatus, useArgoStatus,
|
|
18
|
-
useOpenCostSummary,
|
|
18
|
+
useOpenCostSummary, useMetricsRelayCheck, useMetricsRelayChecking,
|
|
19
19
|
} from '../../api/client'
|
|
20
20
|
import { useCapabilitiesContext } from '../../contexts/CapabilitiesContext'
|
|
21
21
|
import { Input, ResourceRefBadge, SelectMenu, type ResourceRef } from '@skyhook-io/k8s-ui'
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
costSourcePreferenceLabel,
|
|
37
37
|
COST_SOURCE_OPTIONS,
|
|
38
38
|
} from '../cost/source'
|
|
39
|
-
import { costSourceApplyLabel, pendingSectionLabels, pendingSections, shouldShowSettingsFooter } from './settings-state'
|
|
39
|
+
import { costSourceApplyLabel, pendingSectionLabels, pendingSections, shouldShowSettingsFooter, showsSubstrateSection } from './settings-state'
|
|
40
40
|
import { PrometheusConfigField } from './PrometheusConfigField'
|
|
41
41
|
import { LocalConnectionSettings, type IntegrationProfiles, type IntegrationKind } from './LocalConnectionSettings'
|
|
42
42
|
import { LocalIntegrationStatus } from './LocalIntegrationStatus'
|
|
@@ -46,7 +46,14 @@ import { useContextSwitch } from '../../context/ContextSwitchContext'
|
|
|
46
46
|
import { previousIntegrationSettingsKey, type IntegrationSettingsResponse } from '../../hooks/usePreviousIntegrationSettings'
|
|
47
47
|
import type { SettingsSectionId } from './settings-state'
|
|
48
48
|
import { OperatorManagedNotice } from './OperatorManagedNotice'
|
|
49
|
+
import { CloudHintLink } from '../cloudHints/CloudHintLink'
|
|
50
|
+
import { useCloudHintsEnabled } from '../cloudHints/cloudHints'
|
|
49
51
|
import { FormSaveActions } from './FormSaveActions'
|
|
52
|
+
import { SubstrateSettings } from './SubstrateSettings'
|
|
53
|
+
import { useAPIResources } from '../../api/apiResources'
|
|
54
|
+
import { useRadarFeature } from '../../api/client'
|
|
55
|
+
import { useSubstrateConnection } from '../../api/substrateWorkspace'
|
|
56
|
+
import { substrateDiscovered } from '../substrate/useSubstrateSidebarWorkspace'
|
|
50
57
|
export type { SettingsSectionId } from './settings-state'
|
|
51
58
|
|
|
52
59
|
interface Config {
|
|
@@ -148,6 +155,7 @@ export function SettingsDialog({
|
|
|
148
155
|
onNavigateToResource,
|
|
149
156
|
}: SettingsDialogProps) {
|
|
150
157
|
const queryClient = useQueryClient()
|
|
158
|
+
useMetricsRelayCheck(open)
|
|
151
159
|
const dialogRef = useRef<HTMLDivElement>(null)
|
|
152
160
|
const { shouldRender, isOpen } = useAnimatedUnmount(open, overlayExitMs('dialog'))
|
|
153
161
|
const { data: versionInfo } = useVersionCheck()
|
|
@@ -168,6 +176,8 @@ export function SettingsDialog({
|
|
|
168
176
|
const metricsDirtyChange = useCallback((dirty: boolean) => setLocalDirty(value => ({ ...value, metrics: dirty })), [])
|
|
169
177
|
const argoDirtyChange = useCallback((dirty: boolean) => setLocalDirty(value => ({ ...value, argocd: dirty })), [])
|
|
170
178
|
const costDirtyChange = useCallback((dirty: boolean) => setLocalDirty(value => ({ ...value, cost: dirty })), [])
|
|
179
|
+
const [substrateDirty, setSubstrateDirty] = useState(false)
|
|
180
|
+
const [substrateBusy, setSubstrateBusy] = useState(false)
|
|
171
181
|
const [connectionsChangedAt, setConnectionsChangedAt] = useState(0)
|
|
172
182
|
const overviewHeading = useRef<HTMLHeadingElement>(null)
|
|
173
183
|
const previousNoticeDismissed = useCallback(() => {
|
|
@@ -193,6 +203,7 @@ export function SettingsDialog({
|
|
|
193
203
|
|
|
194
204
|
const [configData, setConfigData] = useState<ConfigResponse | null>(null)
|
|
195
205
|
const operatorManaged = configData?.management === 'operator'
|
|
206
|
+
const cloudHints = useCloudHintsEnabled()
|
|
196
207
|
const canEditConfig = configData != null && !operatorManaged && canAtLeast('owner')
|
|
197
208
|
const [editedConfig, setEditedConfig] = useState<Config>({})
|
|
198
209
|
const [saving, setSaving] = useState(false)
|
|
@@ -276,12 +287,12 @@ export function SettingsDialog({
|
|
|
276
287
|
const advancedDirty = mcpDirty || timelineDirty
|
|
277
288
|
const configDirty = configData != null && (connectionDirty || advancedDirty)
|
|
278
289
|
const prometheusDirty = prometheusCredentialDirty || localDirty.metrics || (editedConfig.prometheusUrl ?? '') !== (configData?.effective.prometheusUrl ?? '')
|
|
279
|
-
const pending = pendingSections({ prometheus: prometheusDirty, cost: costIntegrationDirty, argocd: localDirty.argocd, ai: aiDirty })
|
|
290
|
+
const pending = pendingSections({ prometheus: prometheusDirty, cost: costIntegrationDirty, argocd: localDirty.argocd, substrate: substrateDirty, ai: aiDirty })
|
|
280
291
|
const integrationDirty = pending.some(item => item !== 'ai')
|
|
281
292
|
// Drafts that save through their own form, which "Save startup settings" leaves in place.
|
|
282
293
|
const formDirty = pending.length > 0
|
|
283
294
|
const reviewSection = pending.find(item => item !== section)
|
|
284
|
-
const settingsBusy = saving || costCurrencySaving || integrationBusy || storageBusy
|
|
295
|
+
const settingsBusy = saving || costCurrencySaving || integrationBusy || storageBusy || substrateBusy
|
|
285
296
|
const metricsDraft = useRef({ open, scope: `${settingsApiBase}:${settingsCluster?.context}`, dirty: false })
|
|
286
297
|
const [draftFrozen, setDraftFrozen] = useState(false)
|
|
287
298
|
const [reloadVersion, setReloadVersion] = useState(0)
|
|
@@ -303,8 +314,8 @@ export function SettingsDialog({
|
|
|
303
314
|
return
|
|
304
315
|
}
|
|
305
316
|
if (draftFrozen) return
|
|
306
|
-
metricsDraft.current = { open, scope: settingsScope, dirty: configData != null && (prometheusDirty || configDirty || costIntegrationDirty || localDirty.argocd || aiDirty) }
|
|
307
|
-
}, [open, settingsScope, targetChangedWithDraft, draftFrozen, configData, prometheusDirty, configDirty, costIntegrationDirty, localDirty.argocd, aiDirty])
|
|
317
|
+
metricsDraft.current = { open, scope: settingsScope, dirty: substrateDirty || (configData != null && (prometheusDirty || configDirty || costIntegrationDirty || localDirty.argocd || aiDirty)) }
|
|
318
|
+
}, [open, settingsScope, targetChangedWithDraft, draftFrozen, configData, prometheusDirty, configDirty, costIntegrationDirty, localDirty.argocd, aiDirty, substrateDirty])
|
|
308
319
|
|
|
309
320
|
// Load config on open + snapshot AI prefs + pick a default section that's
|
|
310
321
|
// actually accessible to the current identity.
|
|
@@ -348,6 +359,33 @@ export function SettingsDialog({
|
|
|
348
359
|
if (open) setSection(initialSection)
|
|
349
360
|
}, [open, initialSection])
|
|
350
361
|
|
|
362
|
+
const { data: apiResources } = useAPIResources()
|
|
363
|
+
const { support: substrateSupport } = useRadarFeature('substrateWorkspace')
|
|
364
|
+
const substrateHere = substrateDiscovered(apiResources)
|
|
365
|
+
const substrateSupported = substrateSupport !== 'unsupported'
|
|
366
|
+
const canReadSavedSubstrate = capabilities.substrateLocalConnection === true
|
|
367
|
+
// A leftover saved connection can be disconnected even after Substrate is removed.
|
|
368
|
+
const substrateLeftover = useSubstrateConnection(open && apiResources !== undefined && !substrateHere && substrateSupported && canReadSavedSubstrate)
|
|
369
|
+
const substrateSaved = canReadSavedSubstrate && substrateLeftover.data?.view === 'local' && substrateLeftover.data.saved
|
|
370
|
+
// Kept until the dialog closes or the cluster changes, so Disconnect doesn't pull the section away mid-use.
|
|
371
|
+
const [substrateSavedOn, setSubstrateSavedOn] = useState<string | undefined>()
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
if (!open) setSubstrateSavedOn(undefined)
|
|
374
|
+
else if (substrateSaved) setSubstrateSavedOn(settingsCluster?.context)
|
|
375
|
+
}, [open, substrateSaved, settingsCluster?.context])
|
|
376
|
+
const showSubstrate = showsSubstrateSection({
|
|
377
|
+
supported: substrateSupported,
|
|
378
|
+
discovered: substrateHere,
|
|
379
|
+
saved: substrateSaved || (substrateSavedOn !== undefined && substrateSavedOn === settingsCluster?.context),
|
|
380
|
+
dirty: substrateDirty,
|
|
381
|
+
})
|
|
382
|
+
const substrateKnown = apiResources !== undefined && (substrateHere || !substrateSupported ||
|
|
383
|
+
capabilities.substrateLocalConnection === false || substrateLeftover.isFetched)
|
|
384
|
+
// A cluster without Substrate has no section to stay on.
|
|
385
|
+
useEffect(() => {
|
|
386
|
+
if (open && section === 'substrate' && substrateKnown && !showSubstrate) setSection('overview')
|
|
387
|
+
}, [open, section, substrateKnown, showSubstrate])
|
|
388
|
+
|
|
351
389
|
useEffect(() => {
|
|
352
390
|
if (!open || diag.agents.length === 0) return
|
|
353
391
|
setAiDraft((current) => {
|
|
@@ -518,7 +556,7 @@ export function SettingsDialog({
|
|
|
518
556
|
requestCloseRef.current = (afterClose) => {
|
|
519
557
|
if (settingsBusy) return
|
|
520
558
|
pendingCloseActionRef.current = afterClose ?? null
|
|
521
|
-
if ((canEditConfig && (configDirty || integrationDirty)) || aiDirty) setConfirmingClose(true)
|
|
559
|
+
if ((canEditConfig && (configDirty || integrationDirty)) || aiDirty || substrateDirty) setConfirmingClose(true)
|
|
522
560
|
else finishClose()
|
|
523
561
|
}
|
|
524
562
|
|
|
@@ -566,17 +604,19 @@ export function SettingsDialog({
|
|
|
566
604
|
// per-section captions carry the restart-vs-live semantics, so group labels
|
|
567
605
|
// would only add visual weight. AI investigations is always shown (the section
|
|
568
606
|
// explains how to enable it when no agent CLI is installed).
|
|
569
|
-
const navItems
|
|
607
|
+
const navItems = ([
|
|
570
608
|
{ id: 'overview', label: 'Overview', icon: LayoutDashboard, ownerOnly: false, dirty: false },
|
|
571
609
|
{ id: 'perms', label: 'My permissions', icon: Shield, ownerOnly: false, dirty: false },
|
|
572
610
|
{ id: 'connection', label: 'Connection', icon: Boxes, ownerOnly: true, dirty: connectionDirty },
|
|
573
611
|
{ id: 'prometheus', label: 'Metrics', icon: Activity, ownerOnly: true, dirty: prometheusDirty },
|
|
574
612
|
{ id: 'cost', label: 'Cost', icon: Coins, ownerOnly: true, dirty: costIntegrationDirty },
|
|
575
613
|
{ id: 'argocd', label: 'Argo CD', icon: GitBranch, ownerOnly: true, dirty: localDirty.argocd },
|
|
614
|
+
// Open to everyone: in a shared Radar it shows how Radar reads Substrate and the person's own access. Only on clusters it applies to.
|
|
615
|
+
{ id: 'substrate', label: 'Agent Substrate', icon: Bot, ownerOnly: false, dirty: substrateDirty },
|
|
576
616
|
{ id: 'ai', label: 'AI investigations', icon: Sparkles, ownerOnly: false, dirty: aiDirty },
|
|
577
617
|
{ id: 'privacy', label: 'Privacy', icon: EyeOff, ownerOnly: false, dirty: false },
|
|
578
618
|
{ id: 'advanced', label: 'Advanced', icon: SlidersHorizontal, ownerOnly: true, dirty: advancedDirty },
|
|
579
|
-
]
|
|
619
|
+
] as NavItemDef[]).filter((item) => item.id !== 'substrate' || showSubstrate)
|
|
580
620
|
|
|
581
621
|
const showFooter = shouldShowSettingsFooter({
|
|
582
622
|
canEditConfig,
|
|
@@ -698,10 +738,10 @@ export function SettingsDialog({
|
|
|
698
738
|
setReloadVersion((version) => version + 1)
|
|
699
739
|
}}>Discard draft and load current cluster</button>
|
|
700
740
|
</div>}
|
|
701
|
-
{!configData && !['overview', 'perms', 'ai', 'privacy'].includes(section) ? (
|
|
741
|
+
{!configData && !['overview', 'perms', 'ai', 'privacy', 'substrate'].includes(section) ? (
|
|
702
742
|
<p className="text-sm text-theme-text-secondary">{loadError ? 'Configuration is unavailable. Close Settings and try again.' : 'Loading configuration…'}</p>
|
|
703
743
|
) : <div inert={draftFrozen || settingsBusy || undefined} className={draftFrozen ? 'opacity-60' : undefined}>
|
|
704
|
-
{operatorManaged && section !== 'perms' && section !== 'ai' && section !== 'privacy' && <div className="mb-4"><OperatorManagedNotice /></div>}
|
|
744
|
+
{operatorManaged && section !== 'perms' && section !== 'ai' && section !== 'privacy' && section !== 'substrate' && <div className="mb-4"><OperatorManagedNotice /></div>}
|
|
705
745
|
{/* Overview — status at a glance; the landing section */}
|
|
706
746
|
<div className={clsx(section !== 'overview' && 'hidden')} role="tabpanel" inert={section !== 'overview' || undefined}>
|
|
707
747
|
<div className="mb-1">
|
|
@@ -896,6 +936,17 @@ export function SettingsDialog({
|
|
|
896
936
|
/>}
|
|
897
937
|
</SectionPane>
|
|
898
938
|
|
|
939
|
+
{/* Agent Substrate — a local Radar saves this context's connection; elsewhere a read-only summary. */}
|
|
940
|
+
<SectionPane
|
|
941
|
+
id="substrate"
|
|
942
|
+
active={section}
|
|
943
|
+
title="Agent Substrate"
|
|
944
|
+
caption={configData?.management === 'local' ? localIntegrationCaption : undefined}
|
|
945
|
+
live
|
|
946
|
+
>
|
|
947
|
+
<SubstrateSettings key={`${discardGeneration}:${reloadVersion}`} active={open && section === 'substrate' && showSubstrate && (substrateHere || canReadSavedSubstrate)} onDirtyChange={setSubstrateDirty} onBusyChange={setSubstrateBusy} />
|
|
948
|
+
</SectionPane>
|
|
949
|
+
|
|
899
950
|
{/* AI investigations — self-saving, usable by everyone. Same heading block
|
|
900
951
|
as every other tab; the body is the agent controls (when a CLI is
|
|
901
952
|
installed) or an enable explainer (when not). */}
|
|
@@ -910,7 +961,22 @@ export function SettingsDialog({
|
|
|
910
961
|
: "Investigate incidents with an AI agent that runs on your own machine — reading logs, events, and topology to understand what's happening. No Radar cloud, no API key."}
|
|
911
962
|
</p>
|
|
912
963
|
</div>
|
|
913
|
-
{operatorManaged ?
|
|
964
|
+
{operatorManaged ? (
|
|
965
|
+
<p className="text-sm text-theme-text-secondary">
|
|
966
|
+
Local AI investigations are unavailable in a shared installation. Use local Radar with an agent CLI, or{' '}
|
|
967
|
+
{cloudHints ? (
|
|
968
|
+
<CloudHintLink
|
|
969
|
+
entry="settings-ai"
|
|
970
|
+
// Through the close guard, so unsaved startup edits still
|
|
971
|
+
// prompt; the Cloud dialog opens once Settings has left.
|
|
972
|
+
onBeforeOpen={(open) => requestCloseRef.current(() => window.setTimeout(open, overlayExitMs('dialog')))}
|
|
973
|
+
/>
|
|
974
|
+
) : (
|
|
975
|
+
'Radar Cloud'
|
|
976
|
+
)}
|
|
977
|
+
.
|
|
978
|
+
</p>
|
|
979
|
+
) : aiAvailable ? (
|
|
914
980
|
<div className="space-y-4">
|
|
915
981
|
<AISettingsSection
|
|
916
982
|
available={diag.available}
|
|
@@ -1213,6 +1279,7 @@ function SectionCaption({ children, live }: { children: ReactNode; live?: boolea
|
|
|
1213
1279
|
|
|
1214
1280
|
function OperatorSettingsSummary({ section, config }: { section: SettingsSectionId; config: ConfigResponse }) {
|
|
1215
1281
|
const { data: prom, error: promError } = usePrometheusStatus()
|
|
1282
|
+
const metricsChecking = useMetricsRelayChecking()
|
|
1216
1283
|
const { data: argo, error: argoError } = useArgoStatus(section === 'argocd')
|
|
1217
1284
|
const { data: cost, error: costError } = useOpenCostSummary()
|
|
1218
1285
|
const { data: cluster } = useClusterInfo()
|
|
@@ -1226,7 +1293,7 @@ function OperatorSettingsSummary({ section, config }: { section: SettingsSection
|
|
|
1226
1293
|
break
|
|
1227
1294
|
case 'prometheus':
|
|
1228
1295
|
rows = [
|
|
1229
|
-
['Status', promError ? 'Status unavailable' : metricsConnectionLabel(prom)],
|
|
1296
|
+
['Status', promError ? 'Status unavailable' : metricsChecking ? 'Checking…' : metricsConnectionLabel(prom)],
|
|
1230
1297
|
['Endpoint', prom?.address || c.prometheusUrl || 'Auto-discovery'],
|
|
1231
1298
|
['Headers', config.prometheusHeaderKeys?.join(', ') || 'None configured'],
|
|
1232
1299
|
]
|
|
@@ -1314,6 +1381,7 @@ interface OverviewRow {
|
|
|
1314
1381
|
function OverviewPanel({ active, onNavigate }: { active: boolean; onNavigate: (s: SettingsSectionId) => void }) {
|
|
1315
1382
|
const { data: cluster } = useClusterInfo()
|
|
1316
1383
|
const { data: prom } = usePrometheusStatus()
|
|
1384
|
+
const metricsChecking = useMetricsRelayChecking()
|
|
1317
1385
|
const { data: cost } = useOpenCostSummary()
|
|
1318
1386
|
const { data: argo } = useArgoStatus(active)
|
|
1319
1387
|
const capabilities = useCapabilitiesContext()
|
|
@@ -1345,8 +1413,8 @@ function OverviewPanel({ active, onNavigate }: { active: boolean; onNavigate: (s
|
|
|
1345
1413
|
},
|
|
1346
1414
|
{
|
|
1347
1415
|
id: 'prometheus', icon: Activity, label: 'Metrics',
|
|
1348
|
-
tone: hasPrometheusCharts(prom) ? 'ok' : metricsSourceUnavailable(prom) ? 'warn' : prom?.discovering ? 'unknown' : prom?.error ? 'warn' : 'off',
|
|
1349
|
-
value: prom ? metricsConnectionLabel(prom) : 'Not connected',
|
|
1416
|
+
tone: metricsChecking ? 'unknown' : hasPrometheusCharts(prom) ? 'ok' : metricsSourceUnavailable(prom) ? 'warn' : prom?.discovering ? 'unknown' : prom?.error ? 'warn' : 'off',
|
|
1417
|
+
value: metricsChecking ? 'Checking…' : prom ? metricsConnectionLabel(prom) : 'Not connected',
|
|
1350
1418
|
detail: hasPrometheusCharts(prom) && prom?.connected ? prom.address : prom?.gkeSystemMetrics || prom?.discovering ? undefined : prom?.error || metricsSourceUnavailable(prom) ? 'Open Metrics for connection details.' : undefined,
|
|
1351
1419
|
},
|
|
1352
1420
|
{
|