@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.
Files changed (228) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +49 -13
  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 +151 -27
  9. package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
  10. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  11. package/src/api/diagnose.ts +4 -0
  12. package/src/api/kagent.test.ts +82 -0
  13. package/src/api/kagent.ts +230 -0
  14. package/src/api/poll.ts +78 -0
  15. package/src/api/prometheusCharts.ts +5 -0
  16. package/src/api/radarFeatures.test.ts +9 -0
  17. package/src/api/radarFeatures.ts +16 -0
  18. package/src/api/substrateWorkspace.test.ts +72 -0
  19. package/src/api/substrateWorkspace.ts +1394 -0
  20. package/src/api/vulnerabilities.ts +207 -9
  21. package/src/api/workloadSource.test.tsx +315 -0
  22. package/src/api/workloadSource.ts +128 -12
  23. package/src/components/CloudConnectFlow.tsx +46 -7
  24. package/src/components/CloudFunnelButton.test.tsx +193 -7
  25. package/src/components/CloudFunnelButton.tsx +128 -32
  26. package/src/components/SelfManagedStart.tsx +12 -2
  27. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  28. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  29. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  30. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  31. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  32. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  33. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  34. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  35. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  36. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  37. package/src/components/agentsandbox/data.ts +135 -0
  38. package/src/components/agentsandbox/host.test.ts +27 -0
  39. package/src/components/agentsandbox/host.tsx +85 -0
  40. package/src/components/agentsandbox/labels.test.ts +42 -0
  41. package/src/components/agentsandbox/labels.ts +146 -0
  42. package/src/components/agentsandbox/listFilters.ts +85 -0
  43. package/src/components/agentsandbox/lists.ts +52 -0
  44. package/src/components/agentsandbox/routes.ts +23 -0
  45. package/src/components/agentsandbox/shared.tsx +321 -0
  46. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  47. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  48. package/src/components/agentsandbox/workspace.tsx +258 -0
  49. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  50. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  51. package/src/components/applications/ApplicationsView.tsx +156 -3
  52. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  53. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  54. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  55. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  56. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  57. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  58. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  59. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  60. package/src/components/cloudHints/cloudHints.ts +131 -0
  61. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  62. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  63. package/src/components/cloudHints/cloudLinks.ts +31 -0
  64. package/src/components/cloudHints/hintStorage.ts +28 -0
  65. package/src/components/cnpg/CNPGView.tsx +4 -7
  66. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  67. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  68. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  69. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  70. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  71. package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
  72. package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
  73. package/src/components/helm/HelmView.tsx +4 -3
  74. package/src/components/helm/ObservedHelmNotice.tsx +39 -17
  75. package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
  76. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
  77. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
  78. package/src/components/home/HomeAgentBlock.tsx +2 -0
  79. package/src/components/home/HomeView.tsx +3 -3
  80. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  81. package/src/components/home/MCPSetupDialog.tsx +6 -2
  82. package/src/components/home/McpCloudLine.test.tsx +162 -0
  83. package/src/components/home/McpCloudLine.tsx +95 -0
  84. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  85. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  86. package/src/components/home/mcpToolCatalog.ts +4 -4
  87. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  88. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  89. package/src/components/issues/IssuesPane.tsx +181 -23
  90. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  91. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  92. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  93. package/src/components/issues/sinceLastVisit.ts +439 -0
  94. package/src/components/issues/uncheckedSources.test.ts +8 -0
  95. package/src/components/issues/uncheckedSources.ts +3 -0
  96. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  97. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  98. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  99. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  100. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  101. package/src/components/kagent/KagentLists.tsx +412 -0
  102. package/src/components/kagent/KagentOverview.tsx +234 -0
  103. package/src/components/kagent/KagentPages.tsx +690 -0
  104. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  105. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  106. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  107. package/src/components/kagent/KagentView.tsx +109 -0
  108. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  109. package/src/components/kagent/host.tsx +144 -0
  110. package/src/components/kagent/routes.ts +31 -0
  111. package/src/components/kagent/shared.tsx +336 -0
  112. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  113. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  114. package/src/components/kagent/workspace.fixtures.ts +108 -0
  115. package/src/components/kagent/workspaceRoute.ts +18 -0
  116. package/src/components/nudges/activeNudges.test.ts +39 -0
  117. package/src/components/nudges/activeNudges.ts +76 -0
  118. package/src/components/poll/OssPoll.tsx +871 -0
  119. package/src/components/poll/mount.test.ts +12 -0
  120. package/src/components/poll/pollCloud.test.ts +23 -0
  121. package/src/components/poll/pollCloud.ts +6 -0
  122. package/src/components/poll/pollDefinition.ts +93 -0
  123. package/src/components/poll/pollFlow.test.ts +140 -0
  124. package/src/components/poll/pollFlow.ts +137 -0
  125. package/src/components/poll/pollSender.test.ts +137 -0
  126. package/src/components/poll/pollSender.ts +76 -0
  127. package/src/components/poll/pollStorage.test.ts +53 -0
  128. package/src/components/poll/pollStorage.ts +77 -0
  129. package/src/components/poll/round.json +350 -0
  130. package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
  131. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  132. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  133. package/src/components/resource/PrometheusCharts.tsx +10 -1
  134. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  135. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  136. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  137. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  138. package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
  139. package/src/components/resources/ImageFilesystemModal.tsx +42 -3
  140. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  141. package/src/components/resources/ResourcesView.tsx +24 -11
  142. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  143. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  144. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  145. package/src/components/settings/SettingsDialog.tsx +84 -16
  146. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  147. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  148. package/src/components/settings/SubstrateSettings.tsx +544 -0
  149. package/src/components/settings/settings-state.test.ts +21 -3
  150. package/src/components/settings/settings-state.ts +13 -3
  151. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  152. package/src/components/share/ShareLinkButton.tsx +391 -0
  153. package/src/components/share/openShareInCloud.test.ts +29 -0
  154. package/src/components/share/openShareInCloud.ts +10 -0
  155. package/src/components/share/shareLink.test.ts +129 -0
  156. package/src/components/share/shareLink.ts +175 -0
  157. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  158. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  159. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  160. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  161. package/src/components/substrate/SubstrateActors.tsx +612 -0
  162. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  163. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  164. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  165. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  166. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  167. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  168. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  169. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  170. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  171. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  172. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  173. package/src/components/substrate/SubstrateView.tsx +173 -0
  174. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  175. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  176. package/src/components/substrate/attention.ts +81 -0
  177. package/src/components/substrate/contextPin.tsx +69 -0
  178. package/src/components/substrate/host.tsx +83 -0
  179. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  180. package/src/components/substrate/readings.test.ts +484 -0
  181. package/src/components/substrate/readings.ts +997 -0
  182. package/src/components/substrate/routes.ts +103 -0
  183. package/src/components/substrate/shared.tsx +426 -0
  184. package/src/components/substrate/substrate.fixtures.ts +325 -0
  185. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  186. package/src/components/substrate/workspaceRoute.ts +23 -0
  187. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  188. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  189. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  190. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  191. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  192. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  193. package/src/components/traffic/TrafficGraph.tsx +17 -14
  194. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  195. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  196. package/src/components/traffic/TrafficView.tsx +26 -56
  197. package/src/components/traffic/trafficFilters.test.ts +61 -1
  198. package/src/components/traffic/trafficFilters.ts +68 -8
  199. package/src/components/ui/UpdateNotification.tsx +2 -0
  200. package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
  201. package/src/components/velero/VeleroOverview.tsx +2 -2
  202. package/src/components/velero/VeleroView.tsx +3 -6
  203. package/src/components/vulnerabilities/columns.tsx +132 -0
  204. package/src/components/vulnerabilities/filters.tsx +317 -0
  205. package/src/components/vulnerabilities/owner.test.ts +54 -0
  206. package/src/components/vulnerabilities/owner.tsx +163 -0
  207. package/src/components/vulnerabilities/parts.test.ts +126 -12
  208. package/src/components/vulnerabilities/parts.tsx +612 -52
  209. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  210. package/src/components/vulnerabilities/traffic.tsx +40 -0
  211. package/src/components/whats-new/WhatsNew.tsx +2 -0
  212. package/src/components/whats-new/releaseNotes.ts +75 -1
  213. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  214. package/src/components/workload/WorkloadView.tsx +52 -13
  215. package/src/components/workspace/layout.tsx +13 -7
  216. package/src/components/workspace/sidebar.test.ts +48 -0
  217. package/src/components/workspace/sidebar.ts +73 -3
  218. package/src/components/workspace/table.ts +2 -1
  219. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  220. package/src/contexts/RegistryAccessMode.tsx +25 -0
  221. package/src/integrations/resourceHost.ts +12 -6
  222. package/src/integrations/resourceHosts.test.tsx +27 -1
  223. package/src/integrations/resourceHosts.tsx +15 -7
  224. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  225. package/src/integrations/sidebarWorkspaces.ts +41 -0
  226. package/src/integrations/workspaceRoute.ts +1 -1
  227. package/src/integrations/workspaceRoutes.ts +7 -1
  228. package/src/integrations/workspaceScreens.tsx +6 -0
@@ -1,7 +1,8 @@
1
1
  export const TABLE_WRAP = 'overflow-x-auto';
2
2
  export const TABLE_HEAD =
3
3
  'border-b border-theme-border bg-theme-base/60 text-[11px] uppercase tracking-wide text-theme-text-tertiary';
4
- export const TH = 'px-3 py-2.5 text-left font-medium whitespace-nowrap';
4
+ export const TH_BASE = 'px-3 py-2.5 text-left font-medium';
5
+ export const TH = `${TH_BASE} whitespace-nowrap`;
5
6
  export const TD = 'px-3 py-2.5 align-top text-sm text-theme-text-primary';
6
7
  export const TBODY = 'table-divide-subtle';
7
8
  export const ROW_HOVER = 'transition-colors hover:bg-theme-hover/50';
@@ -0,0 +1,51 @@
1
+ // @vitest-environment jsdom
2
+ import { act, useContext } from 'react'
3
+ import { createRoot } from 'react-dom/client'
4
+ import { afterEach, expect, it, vi } from 'vitest'
5
+ import { RegistryAccessModeContext } from '@skyhook-io/k8s-ui'
6
+ import { RegistryAccessModeProvider } from './RegistryAccessMode'
7
+
8
+ let capabilities: unknown
9
+ let clusterInfo: unknown
10
+ vi.mock('../api/client', () => ({
11
+ useCapabilities: () => ({ data: capabilities }),
12
+ useClusterInfo: () => ({ data: clusterInfo }),
13
+ }))
14
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
15
+
16
+ function Probe() {
17
+ return <span>{useContext(RegistryAccessModeContext) ?? 'none'}</span>
18
+ }
19
+
20
+ let root: ReturnType<typeof createRoot> | null = null
21
+ afterEach(() => {
22
+ act(() => root?.unmount())
23
+ root = null
24
+ })
25
+
26
+ function read(): string {
27
+ const host = document.createElement('div')
28
+ root = createRoot(host)
29
+ act(() => root!.render(<RegistryAccessModeProvider><Probe /></RegistryAccessModeProvider>))
30
+ return host.textContent ?? ''
31
+ }
32
+
33
+ it('says nothing until capabilities and cluster info have loaded', () => {
34
+ capabilities = undefined
35
+ clusterInfo = { platform: 'eks' }
36
+ expect(read()).toBe('none')
37
+ })
38
+
39
+ it('names the EKS/GKE fix for signed-in in-cluster and cloud Radar, and the local one on a loopback local Radar', () => {
40
+ capabilities = { deployment: { mode: 'in-cluster' }, authEnabled: true, localTerminal: false }
41
+ clusterInfo = { platform: 'eks' }
42
+ expect(read()).toBe('eks')
43
+ act(() => root?.unmount())
44
+ capabilities = { deployment: { mode: 'cloud' }, authEnabled: true, localTerminal: false }
45
+ clusterInfo = { platform: 'gke' }
46
+ expect(read()).toBe('gke')
47
+ act(() => root?.unmount())
48
+ capabilities = { deployment: { mode: 'local' }, localTerminal: true }
49
+ clusterInfo = { platform: 'gke' }
50
+ expect(read()).toBe('local')
51
+ })
@@ -0,0 +1,25 @@
1
+ import { useMemo, type ReactNode } from 'react'
2
+ import { RegistryAccessModeContext, registryAccessMode } from '@skyhook-io/k8s-ui'
3
+ import { useCapabilities, useClusterInfo } from '../api/client'
4
+
5
+ /** Tells the code views which private-registry fix applies to this Radar,
6
+ * from the capabilities and cluster info the app already reads. Nothing is
7
+ * said until both have loaded (the capabilities' loading defaults would
8
+ * otherwise look like a local Radar). */
9
+ export function RegistryAccessModeProvider({ children }: { children: ReactNode }) {
10
+ const { data: capabilities } = useCapabilities()
11
+ const { data: clusterInfo } = useClusterInfo()
12
+ const mode = useMemo(
13
+ () =>
14
+ capabilities && clusterInfo
15
+ ? registryAccessMode({
16
+ deploymentMode: capabilities.deployment?.mode,
17
+ authEnabled: capabilities.authEnabled,
18
+ localTerminal: capabilities.localTerminal,
19
+ platform: clusterInfo.platform,
20
+ })
21
+ : null,
22
+ [capabilities, clusterInfo],
23
+ )
24
+ return <RegistryAccessModeContext.Provider value={mode}>{children}</RegistryAccessModeContext.Provider>
25
+ }
@@ -6,7 +6,7 @@ import type { SelectedResource } from '../types'
6
6
  import { kindToPluralWithGroup } from '../utils/navigation'
7
7
 
8
8
  export type HostResource = Pick<SelectedResource, 'kind' | 'group' | 'namespace' | 'name'>
9
- export type DetailSlots = Pick<ComponentProps<typeof WorkloadView>, 'renderSummary' | 'renderHeaderActions' | 'extraTabs' | 'renderStatusBadge'>
9
+ export type DetailSlots = Pick<ComponentProps<typeof WorkloadView>, 'renderSummary' | 'renderHeaderActions' | 'extraTabs' | 'renderStatusBadge' | 'breadcrumb'>
10
10
  export type HostFeatures = Partial<Record<RadarFeature, RadarFeatureSupport>>
11
11
  export type KindListMode = 'table' | 'wait' | 'view'
12
12
  export interface HostKind { name: string; kind: string; group: string }
@@ -21,6 +21,7 @@ type ExclusiveDetailSlot = 'summary' | 'destination' | 'logs'
21
21
  export interface ResourceHost {
22
22
  id: string
23
23
  feature?: RadarFeature
24
+ waitForFeature?: boolean
24
25
  diagnoseAction?: (render: RenderDiagnoseAction | undefined) => RenderDiagnoseAction | undefined
25
26
  kindLists?: readonly {
26
27
  kind: HostKind
@@ -51,15 +52,19 @@ export function hostSupport(host: ResourceHost, features: HostFeatures): RadarFe
51
52
 
52
53
  function resourceKey(name: string, group: string): string { return `${group}\u0000${name}` }
53
54
 
54
- export function hostsForResource(hosts: readonly ResourceHost[], resource: HostResource): ResourceHost[] {
55
+ export function hostsForResource(hosts: readonly ResourceHost[], resource: HostResource, features?: HostFeatures): ResourceHost[] {
55
56
  // An unresolved group must not select a colliding CRD, or be treated as core.
56
57
  if (resource.group === undefined) return []
57
58
  const plural = kindToPluralWithGroup(resource.kind, resource.group)
58
- return hosts.filter(host => host.resources?.some(kind => kind.name === plural && kind.group === resource.group))
59
+ return hosts.filter(host => {
60
+ const support = features ? hostSupport(host, features) : 'supported'
61
+ return (support === 'supported' || support === 'unknown' && !host.waitForFeature) &&
62
+ host.resources?.some(kind => kind.name === plural && kind.group === resource.group)
63
+ })
59
64
  }
60
65
 
61
- export function resourceHostForSlot(hosts: readonly ResourceHost[], resource: HostResource, slot: ExclusiveDetailSlot): ResourceHost | undefined {
62
- return hostsForResource(hosts, resource).find(host => host.detailOwnership?.includes(slot))
66
+ export function resourceHostForSlot(hosts: readonly ResourceHost[], resource: HostResource, slot: ExclusiveDetailSlot, features?: HostFeatures): ResourceHost | undefined {
67
+ return hostsForResource(hosts, resource, features).find(host => host.detailOwnership?.includes(slot))
63
68
  }
64
69
 
65
70
  export function composeResourceHosts(hosts: readonly ResourceHost[]): RendererOverrides {
@@ -88,6 +93,7 @@ export function composeDetailSlots(contributions: readonly { id: string; slots:
88
93
  const summaries = contributions.filter(host => host.slots?.renderSummary)
89
94
  if (summaries.length > 1) throw new Error(`Resource host summary ownership conflict: ${summaries.map(host => host.id).join(', ')}`)
90
95
  const summary = summaries[0]?.slots?.renderSummary
96
+ const breadcrumb = summaries[0]?.slots?.breadcrumb
91
97
  const badges = contributions.filter(host => host.slots?.renderStatusBadge)
92
98
  if (badges.length > 1) throw new Error(`Resource host status badge ownership conflict: ${badges.map(host => host.id).join(', ')}`)
93
99
  const badge = badges[0]?.slots?.renderStatusBadge
@@ -99,7 +105,7 @@ export function composeDetailSlots(contributions: readonly { id: string; slots:
99
105
  tabIds.add(tab.id)
100
106
  }
101
107
  return {
102
- ...(summary ? { renderSummary: summary } : {}),
108
+ ...(summary ? { renderSummary: summary, ...(breadcrumb ? { breadcrumb } : {}) } : {}),
103
109
  ...(badge ? { renderStatusBadge: badge } : {}),
104
110
  ...(actions.length ? { renderHeaderActions: (props: Parameters<NonNullable<DetailSlots['renderHeaderActions']>>[0]) => actions.map(host => createElement(Fragment, { key: host.id }, host.slots!.renderHeaderActions!(props))) } : {}),
105
111
  ...(tabs.length ? { extraTabs: tabs } : {}),
@@ -55,7 +55,7 @@ describe('application resource hosts', () => {
55
55
  'RolloutRenderer', 'KyvernoPolicyCoverage', 'KyvernoPolicyQueued', 'CNPGObjectStoreRenderer',
56
56
  'VeleroBSLRenderer', 'VeleroBackupRenderer', 'VeleroRestoreRenderer', 'CNPGClusterRenderer',
57
57
  'CNPGDatabaseRenderer', 'CNPGPublicationRenderer', 'CNPGSubscriptionRenderer', 'CNPGImageCatalogRenderer',
58
- 'FluxHelmReleaseRenderer', 'OpenTelemetryCollectorRenderer', 'ValidatingAdmissionPolicyRenderer', 'ValidatingAdmissionPolicyBindingRenderer', 'MutatingAdmissionPolicyRenderer', 'MutatingAdmissionPolicyBindingRenderer', 'SecretProviderClassRenderer', 'UpgradePlanRenderer', 'SealedSecretRenderer', 'K3sHelmChartRenderer', 'TraefikIngressRouteRenderer', 'TraefikMiddlewareRenderer',
58
+ 'FluxHelmReleaseRenderer', 'KagentAgentRenderer', 'OpenTelemetryCollectorRenderer', 'ValidatingAdmissionPolicyRenderer', 'ValidatingAdmissionPolicyBindingRenderer', 'MutatingAdmissionPolicyRenderer', 'MutatingAdmissionPolicyBindingRenderer', 'SecretProviderClassRenderer', 'UpgradePlanRenderer', 'SealedSecretRenderer', 'K3sHelmChartRenderer', 'TraefikIngressRouteRenderer', 'TraefikMiddlewareRenderer',
59
59
  ].sort())
60
60
  const inherited = [{ id: 'local', label: 'Local', render: () => null }]
61
61
  expect(resourceDetailSlots({ kind: 'Pod', group: '', namespace: 'db', name: 'pg-1' }, inherited).extraTabs).toEqual(inherited)
@@ -63,6 +63,20 @@ describe('application resource hosts', () => {
63
63
  expect(resourceDetailRedirect({ ...cluster, group: '' }, new URLSearchParams('tab=events'))).toBeNull()
64
64
  })
65
65
 
66
+ it('keeps WorkerPool paths on generic detail when the Radar lacks Substrate workspace routes', () => {
67
+ const pool = { kind: 'WorkerPool', group: 'ate.dev', namespace: 'agents', name: 'pool' }
68
+ const search = new URLSearchParams('apiGroup=ate.dev')
69
+ const older = { substrateWorkspace: 'unsupported' } as const
70
+ const current = { substrateWorkspace: 'supported' } as const
71
+
72
+ expect(resourceExpandedPath(pool, undefined, undefined, older)).toBeNull()
73
+ expect(resourceDetailRedirect(pool, search, older)).toBeNull()
74
+ expect(resourceDetailSlots(pool, undefined, older)).toEqual({})
75
+ expect(resourceExpandedPath(pool, undefined, undefined, current)).toBe('/substrate/workerpools/agents/pool')
76
+ expect(resourceDetailRedirect(pool, search, current)).toBe('/substrate/workerpools/agents/pool')
77
+ expect(resourceDetailSlots(pool, undefined, current).renderSummary).toBeDefined()
78
+ })
79
+
66
80
  it('owns the LocalQueue header badge and nothing for other Kueue kinds', () => {
67
81
  expect(resourceDetailSlots({ kind: 'LocalQueue', group: 'kueue.x-k8s.io', namespace: 'team', name: 'q' }).renderStatusBadge).toBeTypeOf('function')
68
82
  expect(resourceDetailSlots({ kind: 'ClusterQueue', group: 'kueue.x-k8s.io', namespace: '', name: 'q' }).renderStatusBadge).toBeUndefined()
@@ -169,3 +183,15 @@ it('registers one CRD renderer and one Schema tab for the exact group', () => {
169
183
  expect(resourceDetailSlots({ ...resource, kind: 'CustomResourceDefinition' }).extraTabs).toHaveLength(1)
170
184
  expect(resourceHosts.filter(host => host.renderers?.CustomResourceDefinitionRenderer).map(host => host.id)).toEqual(['crd'])
171
185
  })
186
+
187
+
188
+ it('gates kagent destinations and composed summaries while keeping the generic renderer', () => {
189
+ const agent = { kind: 'Agent', group: 'api.kagent.dev', namespace: 'agents', name: 'helper' }
190
+ for (const kagentWorkspace of ['unknown', 'unsupported'] as const) {
191
+ expect(resourceExpandedPath(agent, 'test', undefined, { kagentWorkspace })).toBeNull()
192
+ expect(resourceDetailRedirect(agent, new URLSearchParams(), { kagentWorkspace })).toBeNull()
193
+ expect(resourceDetailSlots(agent, [], { kagentWorkspace }).renderSummary).toBeUndefined()
194
+ }
195
+ expect(resourceExpandedPath(agent, 'test', undefined, { kagentWorkspace: 'supported' })).toBe('/kagent/agents/agents/helper?ctx=test')
196
+ expect(resourceExpandedPath({ ...agent, group: 'agent.k8s.elastic.co' }, 'test', undefined, { kagentWorkspace: 'supported' })).toBeNull()
197
+ })
@@ -7,6 +7,9 @@ import { apiVersionToGroup } from '../utils/navigation'
7
7
  import type { SelectedResource } from '../types'
8
8
  import { cnpgResourceHost } from '../components/cnpg/host'
9
9
  import { veleroResourceHost } from '../components/velero/host'
10
+ import { substrateResourceHost } from '../components/substrate/host'
11
+ import { agentSandboxResourceHost } from '../components/agentsandbox/host'
12
+ import { kagentResourceHost } from '../components/kagent/host'
10
13
  import { crdResourceHost } from '../components/resources/crd/host'
11
14
  import {
12
15
  composeDetailSlots, composeResourceHosts, hostsForResource, hostSupport, resourceHostForSlot,
@@ -77,6 +80,9 @@ export const resourceHosts: readonly ResourceHost[] = [
77
80
  { id: 'kyverno', renderers: { KyvernoPolicyCoverage, KyvernoPolicyQueued } },
78
81
  veleroResourceHost,
79
82
  { id: 'longhorn', renderers: { LonghornVolumeRenderer } },
83
+ substrateResourceHost,
84
+ agentSandboxResourceHost,
85
+ kagentResourceHost,
80
86
  { id: 'flux', renderers: { FluxHelmReleaseRenderer } },
81
87
  { id: 'secrets-store-csi', renderers: { SecretProviderClassRenderer } },
82
88
  { id: 'admission-policy', renderers: { ValidatingAdmissionPolicyRenderer, ValidatingAdmissionPolicyBindingRenderer, MutatingAdmissionPolicyRenderer, MutatingAdmissionPolicyBindingRenderer } },
@@ -86,12 +92,12 @@ export const resourceHosts: readonly ResourceHost[] = [
86
92
 
87
93
  export const resourceRendererOverrides = composeResourceHosts(resourceHosts)
88
94
 
89
- export function resourceExpandedPath(resource: HostResource, context?: string, tab?: 'yaml'): string | null {
90
- return resourceHostForSlot(resourceHosts, resource, 'destination')?.expandedPath?.(resource, context, tab) ?? null
95
+ export function resourceExpandedPath(resource: HostResource, context?: string, tab?: 'yaml', features?: HostFeatures): string | null {
96
+ return resourceHostForSlot(resourceHosts, resource, 'destination', features)?.expandedPath?.(resource, context, tab) ?? null
91
97
  }
92
98
 
93
- export function resourceDetailRedirect(resource: HostResource, search: URLSearchParams): string | null {
94
- return resourceHostForSlot(resourceHosts, resource, 'destination')?.detailRedirect?.(resource, search) ?? null
99
+ export function resourceDetailRedirect(resource: HostResource, search: URLSearchParams, features?: HostFeatures): string | null {
100
+ return resourceHostForSlot(resourceHosts, resource, 'destination', features)?.detailRedirect?.(resource, search) ?? null
95
101
  }
96
102
 
97
103
  export function resourceIssueDetail(resource: HostResource, props: { issue: { kind?: string; reason?: string }; resource: any }) {
@@ -102,8 +108,8 @@ export function resourceIssueDetail(resource: HostResource, props: { issue: { ki
102
108
  return null
103
109
  }
104
110
 
105
- export function resourceDetailSlots(resource: HostResource, inheritedTabs?: WorkloadExtraTab[]): DetailSlots {
106
- const slots = hostsForResource(resourceHosts, resource)
111
+ export function resourceDetailSlots(resource: HostResource, inheritedTabs?: WorkloadExtraTab[], features?: HostFeatures): DetailSlots {
112
+ const slots = hostsForResource(resourceHosts, resource, features)
107
113
  .map(host => ({ id: host.id, slots: host.detailSlots?.(resource) }))
108
114
  return composeDetailSlots(slots, inheritedTabs)
109
115
  }
@@ -128,7 +134,9 @@ export function useResourceHostFeatures(): HostFeatures {
128
134
  // Hook order is fixed here; selected adapters mount components that own their data hooks.
129
135
  const { support: cnpgWorkspace } = useRadarFeature('cnpgWorkspace')
130
136
  const { support: veleroWorkspace } = useRadarFeature('veleroWorkspace')
131
- return useMemo(() => ({ cnpgWorkspace, veleroWorkspace }), [cnpgWorkspace, veleroWorkspace])
137
+ const { support: substrateWorkspace } = useRadarFeature('substrateWorkspace')
138
+ const { support: kagentWorkspace } = useRadarFeature('kagentWorkspace')
139
+ return useMemo(() => ({ cnpgWorkspace, veleroWorkspace, substrateWorkspace, kagentWorkspace }), [cnpgWorkspace, veleroWorkspace, substrateWorkspace, kagentWorkspace])
132
140
  }
133
141
 
134
142
 
@@ -0,0 +1,63 @@
1
+ import { readdirSync, readFileSync, statSync } from 'node:fs'
2
+ import { join, relative } from 'node:path'
3
+ import { renderToStaticMarkup } from 'react-dom/server'
4
+ import { describe, expect, it, vi } from 'vitest'
5
+ import type { SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
6
+ import { useIntegrationSidebars } from './sidebarWorkspaces'
7
+
8
+ const calls = vi.hoisted(() => ({} as Record<string, any>))
9
+ const part = (name: string) => ({ [name]: { tools: name, destinations: [{ id: name, label: name, onSelect: () => {} }] } as SidebarCategoryWorkspace })
10
+
11
+ vi.mock('../components/cnpg/useCNPGSidebarWorkspace', () => ({ useCNPGSidebarWorkspace: (o: any) => { calls.cnpg = o; return part('CNPG') } }))
12
+ vi.mock('../components/velero/useVeleroSidebarWorkspace', () => ({ useVeleroSidebarWorkspace: (o: any) => { calls.velero = o; return part('Velero') } }))
13
+ vi.mock('../components/substrate/useSubstrateSidebarWorkspace', () => ({ useSubstrateSidebarWorkspace: (o: any) => { calls.substrate = o; return part('Substrate') } }))
14
+ vi.mock('../components/agentsandbox/useAgentSandboxSidebarWorkspace', () => ({ useAgentSandboxSidebarWorkspace: (o: any) => { calls.agentSandbox = o; return part('AgentSandbox') } }))
15
+ vi.mock('../components/kagent/useKagentSidebarWorkspace', () => ({ useKagentSidebarWorkspace: (o: any) => { calls.kagent = o; return part('Kagent') } }))
16
+
17
+ const SRC = join(__dirname, '..')
18
+
19
+ function sourceFiles(dir: string): string[] {
20
+ return readdirSync(dir).flatMap((name) => {
21
+ const path = join(dir, name)
22
+ if (statSync(path).isDirectory()) return name === 'node_modules' ? [] : sourceFiles(path)
23
+ return /\.tsx?$/.test(name) && !/\.test\.tsx?$/.test(name) ? [path] : []
24
+ })
25
+ }
26
+
27
+ describe('useIntegrationSidebars', () => {
28
+ it('merges every integration’s part, in order, passing each only its own options', () => {
29
+ let merged: Record<string, SidebarCategoryWorkspace> | undefined
30
+ function Host() {
31
+ merged = useIntegrationSidebars({ apiResources: [], namespaces: ['team'], cnpg: { withMetrics: true }, velero: { active: true }, substrate: { active: 'actors' }, agentSandbox: { active: true } })
32
+ return null
33
+ }
34
+ renderToStaticMarkup(<Host />)
35
+ expect(Object.keys(merged ?? {})).toEqual(['CNPG', 'Velero', 'Substrate', 'AgentSandbox', 'Kagent'])
36
+ expect(calls.cnpg).toEqual({ apiResources: [], namespaces: ['team'], withMetrics: true })
37
+ expect(calls.velero).toEqual({ apiResources: [], active: true })
38
+ expect(calls.substrate).toEqual({ apiResources: [], active: 'actors' })
39
+ expect(calls.agentSandbox).toEqual({ apiResources: [], namespaces: ['team'], active: true })
40
+ expect(calls.kagent).toEqual({ apiResources: [], namespaces: ['team'] })
41
+ })
42
+
43
+ // An integration's sidebar hook added beside the others, or a view that
44
+ // calls the hooks itself, is how a screen ends up without an integration's
45
+ // row: every hook goes through useIntegrationSidebars, and nothing else
46
+ // calls one.
47
+ it('is the only caller of every integration sidebar hook', () => {
48
+ const files = sourceFiles(SRC)
49
+ const hooks = files.flatMap((f) => [...readFileSync(f, 'utf8').matchAll(/export function (use\w+SidebarWorkspace)\(/g)].map((m) => m[1]))
50
+ expect(hooks.sort()).toEqual(['useAgentSandboxSidebarWorkspace', 'useCNPGSidebarWorkspace', 'useKagentSidebarWorkspace', 'useSubstrateSidebarWorkspace', 'useVeleroSidebarWorkspace'])
51
+ const own = readFileSync(join(SRC, 'integrations/sidebarWorkspaces.ts'), 'utf8')
52
+ const strays: string[] = []
53
+ for (const hook of [...hooks, 'useMergedSidebarWorkspaces']) {
54
+ expect(own, `${hook} is not merged by useIntegrationSidebars`).toMatch(new RegExp(`\\b${hook}\\(`))
55
+ for (const f of files) {
56
+ if (f.endsWith('integrations/sidebarWorkspaces.ts')) continue
57
+ const text = readFileSync(f, 'utf8')
58
+ if (new RegExp(`(?<!function )\\b${hook}\\(`).test(text)) strays.push(`${relative(SRC, f)}: ${hook}`)
59
+ }
60
+ }
61
+ expect(strays).toEqual([])
62
+ })
63
+ })
@@ -0,0 +1,41 @@
1
+ import type { SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
2
+ import type { APIResource } from '../types'
3
+ import { useCNPGSidebarWorkspace } from '../components/cnpg/useCNPGSidebarWorkspace'
4
+ import { useVeleroSidebarWorkspace } from '../components/velero/useVeleroSidebarWorkspace'
5
+ import { useSubstrateSidebarWorkspace } from '../components/substrate/useSubstrateSidebarWorkspace'
6
+ import { useAgentSandboxSidebarWorkspace } from '../components/agentsandbox/useAgentSandboxSidebarWorkspace'
7
+ import { useKagentSidebarWorkspace } from '../components/kagent/useKagentSidebarWorkspace'
8
+ import { useMergedSidebarWorkspaces } from '../components/workspace/sidebar'
9
+
10
+ type Workspaces = Record<string, SidebarCategoryWorkspace>
11
+
12
+ /** Each integration's own options, for the view that is that integration's screen. */
13
+ export interface IntegrationSidebarOptions {
14
+ cnpg?: Omit<Parameters<typeof useCNPGSidebarWorkspace>[0], 'apiResources' | 'namespaces'>
15
+ velero?: Omit<Parameters<typeof useVeleroSidebarWorkspace>[0], 'apiResources'>
16
+ substrate?: Omit<Parameters<typeof useSubstrateSidebarWorkspace>[0], 'apiResources'>
17
+ agentSandbox?: Omit<Parameters<typeof useAgentSandboxSidebarWorkspace>[0], 'apiResources' | 'namespaces'>
18
+ }
19
+
20
+ /**
21
+ * Every integration's part of the Resources sidebar, merged, in the order the
22
+ * rows list them. Each workspace view (Resources, CloudNativePG, Velero,
23
+ * Agent Substrate, Agent Sandbox) renders the same sidebar, so they all call
24
+ * this rather than the integrations' hooks: an integration added here shows
25
+ * on every screen.
26
+ */
27
+ export function useIntegrationSidebars({
28
+ apiResources,
29
+ namespaces,
30
+ cnpg,
31
+ velero,
32
+ substrate,
33
+ agentSandbox,
34
+ }: { apiResources: APIResource[] | undefined; namespaces: string[] } & IntegrationSidebarOptions): Workspaces | undefined {
35
+ const cnpgSidebar = useCNPGSidebarWorkspace({ apiResources, namespaces, ...cnpg })
36
+ const veleroSidebar = useVeleroSidebarWorkspace({ apiResources, ...velero })
37
+ const substrateSidebar = useSubstrateSidebarWorkspace({ apiResources, ...substrate })
38
+ const sandboxSidebar = useAgentSandboxSidebarWorkspace({ apiResources, namespaces, ...agentSandbox })
39
+ const kagentSidebar = useKagentSidebarWorkspace({ apiResources, namespaces })
40
+ return useMergedSidebarWorkspaces(cnpgSidebar, veleroSidebar, substrateSidebar, sandboxSidebar, kagentSidebar)
41
+ }
@@ -9,7 +9,7 @@ export interface WorkspaceScreenProps {
9
9
  }
10
10
 
11
11
  export interface WorkspaceRoute {
12
- id: 'cnpg' | 'capacity' | 'velero'
12
+ id: 'cnpg' | 'capacity' | 'velero' | 'substrate' | 'agent-sandbox' | 'kagent'
13
13
  path: string
14
14
  label: string
15
15
  navView: 'resources' | 'capacity'
@@ -1,14 +1,20 @@
1
+ import { kagentWorkspaceRoute } from '../components/kagent/workspaceRoute'
2
+ import { agentSandboxWorkspaceRoute } from '../components/agentsandbox/workspaceRoute'
1
3
  import { capacityWorkspaceRoute } from '../components/capacity/workspaceRoute'
2
4
  import { cnpgWorkspaceRoute } from '../components/cnpg/workspaceRoute'
5
+ import { substrateWorkspaceRoute } from '../components/substrate/workspaceRoute'
3
6
  import { veleroWorkspaceRoute } from '../components/velero/workspaceRoute'
4
7
  import type { WorkspaceRoute } from './workspaceRoute'
5
8
 
6
- export const workspaceRoutes = [cnpgWorkspaceRoute, capacityWorkspaceRoute, veleroWorkspaceRoute] as const
9
+ export const workspaceRoutes = [cnpgWorkspaceRoute, capacityWorkspaceRoute, veleroWorkspaceRoute, substrateWorkspaceRoute, agentSandboxWorkspaceRoute, kagentWorkspaceRoute] as const
7
10
 
8
11
  export const workspaceLabels = {
9
12
  cnpg: cnpgWorkspaceRoute.label,
10
13
  capacity: capacityWorkspaceRoute.label,
11
14
  velero: veleroWorkspaceRoute.label,
15
+ substrate: substrateWorkspaceRoute.label,
16
+ 'agent-sandbox': agentSandboxWorkspaceRoute.label,
17
+ kagent: kagentWorkspaceRoute.label,
12
18
  } satisfies Record<WorkspaceRoute['id'], string>
13
19
 
14
20
  export function workspaceForPath(pathname: string) {
@@ -1,13 +1,19 @@
1
+ import { KagentView } from '../components/kagent/KagentView'
1
2
  import type { ComponentType } from 'react'
3
+ import { AgentSandboxView } from '../components/agentsandbox/AgentSandboxView'
2
4
  import { CapacityView } from '../components/capacity/CapacityView'
3
5
  import { CNPGView } from '../components/cnpg/CNPGView'
6
+ import { SubstrateView } from '../components/substrate/SubstrateView'
4
7
  import { VeleroView } from '../components/velero/VeleroView'
5
8
  import type { WorkspaceRoute, WorkspaceScreenProps } from './workspaceRoute'
6
9
 
7
10
  const screens: Record<WorkspaceRoute['id'], ComponentType<WorkspaceScreenProps>> = {
11
+ kagent: KagentView,
8
12
  cnpg: CNPGView,
9
13
  capacity: ({ onOpenResource }) => <CapacityView onOpenResource={onOpenResource} />,
10
14
  velero: VeleroView,
15
+ substrate: SubstrateView,
16
+ 'agent-sandbox': AgentSandboxView,
11
17
  }
12
18
 
13
19
  export function WorkspaceScreen({ workspace, ...props }: WorkspaceScreenProps & { workspace: WorkspaceRoute }) {