@skyhook-io/radar-app 1.22.2 → 1.23.0

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.
Files changed (196) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +35 -10
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/api/agentSandbox.ts +259 -0
  6. package/src/api/client.autoPromConnect.test.tsx +43 -0
  7. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  8. package/src/api/client.ts +122 -24
  9. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  10. package/src/api/diagnose.ts +4 -0
  11. package/src/api/kagent.test.ts +82 -0
  12. package/src/api/kagent.ts +230 -0
  13. package/src/api/prometheusCharts.ts +5 -0
  14. package/src/api/radarFeatures.test.ts +9 -0
  15. package/src/api/radarFeatures.ts +13 -0
  16. package/src/api/substrateWorkspace.test.ts +72 -0
  17. package/src/api/substrateWorkspace.ts +1394 -0
  18. package/src/api/vulnerabilities.ts +207 -9
  19. package/src/api/workloadSource.test.tsx +315 -0
  20. package/src/api/workloadSource.ts +128 -12
  21. package/src/components/CloudConnectFlow.tsx +46 -7
  22. package/src/components/CloudFunnelButton.test.tsx +193 -7
  23. package/src/components/CloudFunnelButton.tsx +127 -32
  24. package/src/components/SelfManagedStart.tsx +12 -2
  25. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  26. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  27. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  28. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  29. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  30. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  31. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  32. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  33. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  34. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  35. package/src/components/agentsandbox/data.ts +135 -0
  36. package/src/components/agentsandbox/host.test.ts +27 -0
  37. package/src/components/agentsandbox/host.tsx +85 -0
  38. package/src/components/agentsandbox/labels.test.ts +42 -0
  39. package/src/components/agentsandbox/labels.ts +146 -0
  40. package/src/components/agentsandbox/listFilters.ts +85 -0
  41. package/src/components/agentsandbox/lists.ts +52 -0
  42. package/src/components/agentsandbox/routes.ts +23 -0
  43. package/src/components/agentsandbox/shared.tsx +321 -0
  44. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  45. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  46. package/src/components/agentsandbox/workspace.tsx +258 -0
  47. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  48. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  49. package/src/components/applications/ApplicationsView.tsx +156 -3
  50. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  51. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  52. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  53. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  54. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  55. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  56. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  57. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  58. package/src/components/cloudHints/cloudHints.ts +131 -0
  59. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  60. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  61. package/src/components/cloudHints/cloudLinks.ts +31 -0
  62. package/src/components/cloudHints/hintStorage.ts +28 -0
  63. package/src/components/cnpg/CNPGView.tsx +4 -7
  64. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  65. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  66. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  67. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  68. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  69. package/src/components/home/HomeAgentBlock.tsx +2 -0
  70. package/src/components/home/HomeView.tsx +3 -3
  71. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  72. package/src/components/home/MCPSetupDialog.tsx +6 -2
  73. package/src/components/home/McpCloudLine.test.tsx +162 -0
  74. package/src/components/home/McpCloudLine.tsx +95 -0
  75. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  76. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  77. package/src/components/home/mcpToolCatalog.ts +4 -4
  78. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  79. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  80. package/src/components/issues/IssuesPane.tsx +181 -23
  81. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  82. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  83. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  84. package/src/components/issues/sinceLastVisit.ts +439 -0
  85. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  86. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  87. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  88. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  89. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  90. package/src/components/kagent/KagentLists.tsx +412 -0
  91. package/src/components/kagent/KagentOverview.tsx +234 -0
  92. package/src/components/kagent/KagentPages.tsx +690 -0
  93. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  94. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  95. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  96. package/src/components/kagent/KagentView.tsx +109 -0
  97. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  98. package/src/components/kagent/host.tsx +144 -0
  99. package/src/components/kagent/routes.ts +31 -0
  100. package/src/components/kagent/shared.tsx +336 -0
  101. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  102. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  103. package/src/components/kagent/workspace.fixtures.ts +108 -0
  104. package/src/components/kagent/workspaceRoute.ts +18 -0
  105. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  106. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  107. package/src/components/resource/PrometheusCharts.tsx +10 -1
  108. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  109. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  110. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  111. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  112. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  113. package/src/components/resources/ResourcesView.tsx +2 -6
  114. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  115. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  116. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  117. package/src/components/settings/SettingsDialog.tsx +84 -16
  118. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  119. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  120. package/src/components/settings/SubstrateSettings.tsx +544 -0
  121. package/src/components/settings/settings-state.test.ts +21 -3
  122. package/src/components/settings/settings-state.ts +13 -3
  123. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  124. package/src/components/share/ShareLinkButton.tsx +391 -0
  125. package/src/components/share/openShareInCloud.test.ts +29 -0
  126. package/src/components/share/openShareInCloud.ts +10 -0
  127. package/src/components/share/shareLink.test.ts +129 -0
  128. package/src/components/share/shareLink.ts +175 -0
  129. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  130. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  131. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  132. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  133. package/src/components/substrate/SubstrateActors.tsx +612 -0
  134. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  135. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  136. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  137. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  138. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  139. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  140. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  141. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  142. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  143. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  144. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  145. package/src/components/substrate/SubstrateView.tsx +173 -0
  146. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  147. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  148. package/src/components/substrate/attention.ts +81 -0
  149. package/src/components/substrate/contextPin.tsx +69 -0
  150. package/src/components/substrate/host.tsx +83 -0
  151. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  152. package/src/components/substrate/readings.test.ts +484 -0
  153. package/src/components/substrate/readings.ts +997 -0
  154. package/src/components/substrate/routes.ts +103 -0
  155. package/src/components/substrate/shared.tsx +426 -0
  156. package/src/components/substrate/substrate.fixtures.ts +325 -0
  157. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  158. package/src/components/substrate/workspaceRoute.ts +23 -0
  159. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  160. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  161. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  162. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  163. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  164. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  165. package/src/components/traffic/TrafficGraph.tsx +17 -14
  166. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  167. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  168. package/src/components/traffic/TrafficView.tsx +26 -56
  169. package/src/components/traffic/trafficFilters.test.ts +61 -1
  170. package/src/components/traffic/trafficFilters.ts +68 -8
  171. package/src/components/velero/VeleroOverview.tsx +2 -2
  172. package/src/components/velero/VeleroView.tsx +3 -6
  173. package/src/components/vulnerabilities/columns.tsx +132 -0
  174. package/src/components/vulnerabilities/filters.tsx +317 -0
  175. package/src/components/vulnerabilities/owner.test.ts +54 -0
  176. package/src/components/vulnerabilities/owner.tsx +163 -0
  177. package/src/components/vulnerabilities/parts.test.ts +126 -12
  178. package/src/components/vulnerabilities/parts.tsx +612 -52
  179. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  180. package/src/components/vulnerabilities/traffic.tsx +40 -0
  181. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  182. package/src/components/workload/WorkloadView.tsx +52 -13
  183. package/src/components/workspace/layout.tsx +13 -7
  184. package/src/components/workspace/sidebar.test.ts +48 -0
  185. package/src/components/workspace/sidebar.ts +73 -3
  186. package/src/components/workspace/table.ts +2 -1
  187. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  188. package/src/contexts/RegistryAccessMode.tsx +25 -0
  189. package/src/integrations/resourceHost.ts +12 -6
  190. package/src/integrations/resourceHosts.test.tsx +27 -1
  191. package/src/integrations/resourceHosts.tsx +15 -7
  192. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  193. package/src/integrations/sidebarWorkspaces.ts +41 -0
  194. package/src/integrations/workspaceRoute.ts +1 -1
  195. package/src/integrations/workspaceRoutes.ts +7 -1
  196. package/src/integrations/workspaceScreens.tsx +6 -0
@@ -0,0 +1,108 @@
1
+ import type { KagentAgent, KagentRef, KagentWorkspace } from '../../api/kagent'
2
+ export const ref = (kind: string, name: string, namespace = 'agents'): KagentRef => ({ group: 'api.kagent.dev', kind, namespace, name })
3
+ export function workspace(): KagentWorkspace {
4
+ const keys = [
5
+ 'agents',
6
+ 'agentTemplates',
7
+ 'harnesses',
8
+ 'models',
9
+ 'mcpServers',
10
+ 'egressPolicies',
11
+ 'modelProviders',
12
+ 'sandboxTemplates',
13
+ ] as const
14
+ const coverage = Object.fromEntries(keys.map((k) => [k, { state: 'full' }])) as KagentWorkspace['coverage']
15
+ const count = { n: 0, lowerBound: false }
16
+ return {
17
+ context: 'test',
18
+ installed: true,
19
+ namespaces: [],
20
+ coverage,
21
+ referenceCoverage: coverage,
22
+ agents: [],
23
+ models: [],
24
+ mcpServers: [],
25
+ modelProviders: [],
26
+ findings: [],
27
+ groups: [],
28
+ counts: {
29
+ findings: { ...count },
30
+ critical: { ...count },
31
+ agents: { ...count },
32
+ agentsAffected: { ...count },
33
+ mcpServers: { ...count },
34
+ mcpServersFailing: { ...count },
35
+ models: { ...count },
36
+ modelsWithProblems: { ...count },
37
+ groups: { n: 0, incomplete: false },
38
+ agentsByLatestChange: {},
39
+ },
40
+ }
41
+ }
42
+ export function agent(name = 'helper'): KagentAgent {
43
+ return {
44
+ ref: ref('Agent', name),
45
+ reading: { state: 'ready', tone: 'healthy', text: 'Ready', summary: 'Ready to start sessions', condition: 'Ready' },
46
+ latestChange: { state: 'prepared' },
47
+ newSessionsRevision: 'abcdef0123456789',
48
+ inlineTemplate: true,
49
+ description: 'Helps operate the cluster',
50
+ mcpServers: { declared: 0, failing: 0, absent: 0, unread: 0, notPermitted: 0 },
51
+ references: [],
52
+ }
53
+ }
54
+ export function blockedWorkspace(): KagentWorkspace {
55
+ const w = workspace(),
56
+ a = agent('blocked-edit'),
57
+ model = ref('ModelConfig', 'broken-model', 'models')
58
+ a.latestChange = { state: 'blocked', message: 'resolve ModelConfig "models/broken-model": secret missing not found' }
59
+ a.reading = { ...a.reading, tone: 'alert', state: 'blocked', text: 'Blocked', message: a.latestChange.message }
60
+ a.model = {
61
+ ref: model,
62
+ state: 'present',
63
+ reading: { state: 'blocked', tone: 'alert', text: 'Blocked', summary: 'API key Secret missing', reason: 'APIKeySecretNotFound' },
64
+ }
65
+ a.references = [
66
+ { role: 'model', from: a.ref, target: model, state: 'present', field: 'spec.template.inline.modelConfig', reading: a.model.reading },
67
+ ]
68
+ w.agents = [a]
69
+ w.models = [
70
+ {
71
+ ref: model,
72
+ reading: a.model.reading!,
73
+ provider: 'OpenAI',
74
+ model: 'gpt',
75
+ credential: { mode: 'apiKeySecret', secret: { ...ref('Secret', 'missing', 'models'), group: '' }, key: 'OPENAI_API_KEY' },
76
+ usedBy: { count: 1, lowerBound: false, consumers: 'seen', agents: [{ agent: a.ref, effect: 'blocked', roles: ['model'] }] },
77
+ },
78
+ ]
79
+ w.findings = [
80
+ {
81
+ id: 'agent',
82
+ subject: a.ref,
83
+ severity: 'warning',
84
+ reason: 'KagentChangeBlocked',
85
+ message: 'Blocked edit',
86
+ action: 'Fix the model.',
87
+ cause: { target: model, form: 'failed', role: 'model' },
88
+ },
89
+ {
90
+ id: 'model',
91
+ subject: model,
92
+ severity: 'warning',
93
+ reason: 'KagentAPIKeySecretMissing',
94
+ kagentReason: 'APIKeySecretNotFound',
95
+ message: 'secret missing not found',
96
+ action: 'Create Secret models/missing.',
97
+ affects: w.models[0].usedBy,
98
+ },
99
+ ]
100
+ w.groups = [{ id: 'model', severity: 'warning', findings: ['model'], folded: [{ finding: 'agent', under: 'model' }] }]
101
+ w.counts.findings.n = 2
102
+ w.counts.groups.n = 1
103
+ w.counts.agents.n = 1
104
+ w.counts.models.n = 1
105
+ w.counts.modelsWithProblems.n = 1
106
+ w.counts.agentsByLatestChange = { blocked: 1 }
107
+ return w
108
+ }
@@ -0,0 +1,18 @@
1
+ import type { WorkspaceRoute } from '../../integrations/workspaceRoute'
2
+ import { parseKagentRoute } from './routes'
3
+ export const kagentWorkspaceRoute: WorkspaceRoute = {
4
+ id: 'kagent',
5
+ path: '/kagent',
6
+ label: 'kagent',
7
+ navView: 'resources',
8
+ namespaceScope: 'view',
9
+ pageTitle: (path) => {
10
+ const r = parseKagentRoute(path)
11
+ return r.detail?.name ?? `kagent ${r.screen === 'mcpservers' ? 'MCP servers' : r.screen}`
12
+ },
13
+ contextSwitchSearch(path, search) {
14
+ const next = new URLSearchParams()
15
+ if (parseKagentRoute(path).detail && search.has('ctx')) next.set('ctx', search.get('ctx')!)
16
+ return next
17
+ },
18
+ }
@@ -48,3 +48,31 @@ it('says OpenObserve unavailable once', async () => {
48
48
  act(() => root.unmount())
49
49
  vi.unstubAllGlobals()
50
50
  })
51
+
52
+ it('keeps the generic heading when OpenObserve is an option and adds the reason beneath it', async () => {
53
+ const client = new QueryClient()
54
+ const container = document.createElement('div')
55
+ const root = createRoot(container)
56
+ const render = (status: PrometheusStatus) => root.render(
57
+ <QueryClientProvider client={client}><NavCustomizationProvider value={{}}>
58
+ <MetricsNotConnected status={status} isWorkload={false} />
59
+ </NavCustomizationProvider></QueryClientProvider>,
60
+ )
61
+ const lines = () => [...container.querySelectorAll('p')].map((p) => p.textContent)
62
+ const generic = ['No metrics source connected', 'Radar can read metrics from Prometheus or OpenObserve.']
63
+
64
+ await act(async () => render({ available: false, connected: false }))
65
+ expect(lines()[0]).toBe('Prometheus not connected')
66
+ expect(container.textContent).not.toContain('OpenObserve')
67
+
68
+ await act(async () => render({ available: false, connected: false, openobserve: 'local' }))
69
+ expect(lines()).toEqual(generic)
70
+
71
+ const reason = "Couldn't read this cluster's ID to find it in OpenObserve: forbidden"
72
+ await act(async () => render({ available: false, connected: false, openobserve: 'local', source: { kind: 'openobserve', via: 'local', error: reason } }))
73
+ expect(lines().slice(0, 3)).toEqual([...generic, reason])
74
+
75
+ await act(async () => render({ available: false, connected: false, openobserve: 'local', error: 'Prometheus connection failed: no service' }))
76
+ expect(lines().slice(0, 3)).toEqual([...generic, 'Prometheus connection failed: no service'])
77
+ act(() => root.unmount())
78
+ })
@@ -6,7 +6,7 @@ import {
6
6
  type PrometheusStatus,
7
7
  } from "../../api/client";
8
8
  import { useNavCustomization } from "../../context/NavCustomization";
9
- import { unavailableReason } from '../settings/openobserveStatus';
9
+ import { sourceNote, unavailableReason } from '../settings/openobserveStatus';
10
10
  import { previousSettingsNote, usePreviousIntegrationSettings } from '../../hooks/usePreviousIntegrationSettings';
11
11
 
12
12
  const openMetricsSettings = () => window.dispatchEvent(new CustomEvent('radar:open-settings', { detail: { section: 'prometheus' } }));
@@ -34,18 +34,21 @@ function NotConnected({ status, isWorkload }: MetricsNotConnectedProps) {
34
34
  const outcome = openObservePath ? discoverMutation.data : undefined;
35
35
  const failure = openObservePath ? discoverMutation.error?.message : undefined;
36
36
  const notFound = outcome === "none" || outcome === "collector";
37
+ const offersOpenObserve = !!openObservePath || status?.source?.kind === "openobserve";
38
+ const reason = status?.error || sourceNote(status?.source);
37
39
  return (
38
40
  <div className="flex flex-col items-center justify-center py-12 gap-4">
39
41
  <WifiOff className="w-10 h-10 text-theme-text-quaternary" />
40
42
  <div className="text-center">
41
43
  <p className="text-sm text-theme-text-secondary mb-1">
42
- {openObservePath ? "No metrics source connected" : "Prometheus not connected"}
43
- </p>
44
- <p className="text-xs text-theme-text-tertiary mb-4">
45
- {status?.error || (openObservePath
46
- ? "Radar can read metrics from Prometheus or OpenObserve."
47
- : "Connect to view historical CPU, memory, and network metrics")}
44
+ {offersOpenObserve ? "No metrics source connected" : "Prometheus not connected"}
48
45
  </p>
46
+ {offersOpenObserve ? <>
47
+ <p className={clsx("text-xs text-theme-text-tertiary", !reason && "mb-4")}>Radar can read metrics from Prometheus or OpenObserve.</p>
48
+ {reason && <p className="mt-1 mb-4 text-xs text-theme-text-tertiary">{reason}</p>}
49
+ </> : <p className="text-xs text-theme-text-tertiary mb-4">
50
+ {reason || "Connect to view historical CPU, memory, and network metrics"}
51
+ </p>}
49
52
  {(notFound || failure) && <p role="status" className="text-sm text-theme-text-secondary mb-4">
50
53
  {failure
51
54
  ? failure
@@ -1,5 +1,6 @@
1
- import { hasPrometheusCharts, metricsSourceUnavailable } from '../../api/prometheusCharts'
1
+ import { hasPrometheusCharts, metricsSourceChecking, metricsSourceUnavailable } from '../../api/prometheusCharts'
2
2
  import { useState, useMemo } from 'react'
3
+ import { Loader2 } from 'lucide-react'
3
4
  import {
4
5
  PrometheusChartsView,
5
6
  MetricsSummary as BaseMetricsSummary,
@@ -119,6 +120,14 @@ export function PrometheusCharts({ kind, namespace, name, showEmptyState = false
119
120
 
120
121
  if (showEmptyState && isSupported && status) {
121
122
  if (metricsSourceUnavailable(status)) return <OpenObserveUnavailable status={status} />
123
+ if (metricsSourceChecking(status)) {
124
+ return (
125
+ <div className="flex items-center justify-center py-12 text-theme-text-tertiary">
126
+ <Loader2 className="w-5 h-5 animate-spin mr-2" />
127
+ Checking OpenObserve…
128
+ </div>
129
+ )
130
+ }
122
131
  if (status.openobserve && !isConnected && !status.discovering) {
123
132
  return <MetricsNotConnected status={status} isWorkload={['Deployment', 'StatefulSet', 'DaemonSet'].includes(kind)} />
124
133
  }
@@ -90,6 +90,15 @@ describe('Expanded metrics recovery and scope', () => {
90
90
  expect(ranges).toEqual([])
91
91
  })
92
92
 
93
+ it('waits while Radar checks OpenObserve instead of offering Prometheus setup', () => {
94
+ openobserve = 'local'
95
+ source = { kind: 'openobserve', via: 'local', pending: true, warning: 'Checking…' }
96
+ const html = render()
97
+ expect(html).toContain('Checking OpenObserve…')
98
+ expect(html).not.toContain('Prometheus not connected')
99
+ expect(ranges).toEqual([])
100
+ })
101
+
93
102
  it('offers standalone setup without losing the backend error or retry', () => {
94
103
  const html = render()
95
104
  expect(html).toContain('Backend query failed')
@@ -1,4 +1,4 @@
1
- import { hasPrometheusCharts, metricsSourceUnavailable } from '../../api/prometheusCharts'
1
+ import { hasPrometheusCharts, metricsSourceChecking, metricsSourceUnavailable } from '../../api/prometheusCharts'
2
2
  import { clsx } from "clsx";
3
3
  import { useMemo, type ReactNode } from "react";
4
4
  import { useSearchParams } from "react-router-dom";
@@ -164,11 +164,11 @@ export function PrometheusChartsGrid({
164
164
  );
165
165
  }
166
166
 
167
- if (!isConnected && status?.discovering) {
167
+ if (!isConnected && (status?.discovering || metricsSourceChecking(status))) {
168
168
  return (
169
169
  <div className="flex items-center justify-center py-12 text-theme-text-tertiary">
170
170
  <Loader2 className="w-5 h-5 animate-spin mr-2" />
171
- Discovering Prometheus…
171
+ {metricsSourceChecking(status) ? "Checking OpenObserve…" : "Discovering Prometheus…"}
172
172
  </div>
173
173
  );
174
174
  }
@@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest'
3
3
  import type { SubstrateHealth } from '../../api/substrateHealth'
4
4
 
5
5
  let health: { data?: SubstrateHealth; error?: unknown; upgrade?: unknown; blockedReason?: string; support?: string } = {}
6
- let promStatus: { connected: boolean; discovering?: boolean; error?: string } = { connected: true }
6
+ let promStatus: { connected: boolean; discovering?: boolean; error?: string } | undefined = { connected: true }
7
7
 
8
8
  vi.mock('../../api/client', async (orig) => ({
9
9
  ...(await orig<typeof import('../../api/client')>()),
@@ -45,6 +45,17 @@ describe('SubstrateHealthCharts', () => {
45
45
  promStatus = { connected: true }
46
46
  })
47
47
 
48
+ it('has a standalone state before connection and series data arrive', () => {
49
+ const standalone = () => renderToStaticMarkup(<SubstrateHealthCharts target={pool} standalone collapsible={false} />)
50
+ promStatus = undefined
51
+ health = {}
52
+ expect(standalone()).toContain('Checking Prometheus connection…')
53
+ promStatus = { connected: true }
54
+ health = { support: 'supported' }
55
+ expect(standalone()).toContain('Reading Agent Substrate metrics…')
56
+ expect(render(node)).toBe('')
57
+ })
58
+
48
59
  it('says why there are no charts when Radar support could not be checked', () => {
49
60
  health = { blockedReason: "Couldn't check this cluster's Radar support. Refresh to try again." }
50
61
  expect(render(pool)).toContain('Refresh to try again')
@@ -85,6 +96,7 @@ describe('SubstrateHealthCharts', () => {
85
96
  it('shows a denial instead of an empty chart', () => {
86
97
  health = { error: new ApiError('forbidden', 403) }
87
98
  expect(render(pool)).toContain('You don&#x27;t have access to these metrics')
99
+ expect(render(pool)).toContain('Requires get on workerpools.ate.dev in namespace agents.')
88
100
  })
89
101
 
90
102
  it('keeps unrounded values readable and explains charts it cannot draw', () => {
@@ -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 || !status) return null
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
- ? 'Agent Substrate charts are available to users who can read this WorkerPool.'
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
  )
@@ -50,6 +50,7 @@ export function ResourceDetailDrawer(props: ResourceDetailDrawerProps) {
50
50
  onBack={onBack ?? (() => {})}
51
51
  onNavigateToResource={onNavigateToResource}
52
52
  onCollapseToDrawer={onCollapseToDrawer}
53
+ shareLink="drawer"
53
54
  />
54
55
  </div>
55
56
  </div>
@@ -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 { useCNPGSidebarWorkspace } from '../cnpg/useCNPGSidebarWorkspace'
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 cnpgSidebarWorkspace = useCNPGSidebarWorkspace({ apiResources, namespaces, withMetrics: selectedKind?.group === 'postgresql.cnpg.io' })
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
@@ -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}
@@ -7,6 +7,7 @@ import { LocalIntegrationStatus } from './LocalIntegrationStatus'
7
7
  vi.mock('../../api/client', () => ({
8
8
  usePrometheusStatus: () => ({}),
9
9
  useOpenCostSummary: () => ({}),
10
+ useMetricsRelayChecking: () => false,
10
11
  }))
11
12
 
12
13
  const profile: IntegrationProfile = {
@@ -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