@skyhook-io/radar-app 1.18.2 → 1.20.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 (228) hide show
  1. package/README.md +1 -1
  2. package/package.json +7 -7
  3. package/src/App.tsx +31 -6
  4. package/src/api/application-evidence.ts +63 -0
  5. package/src/api/argoSync.test.ts +22 -0
  6. package/src/api/client.audit-gating.test.tsx +48 -0
  7. package/src/api/client.kueuePosition.test.ts +32 -0
  8. package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
  9. package/src/api/client.resource-identity.test.ts +3 -0
  10. package/src/api/client.resourceIssues.test.tsx +239 -0
  11. package/src/api/client.resourcePath.test.ts +3 -0
  12. package/src/api/client.ts +285 -55
  13. package/src/api/config.ts +21 -0
  14. package/src/api/diagnose.test.ts +33 -2
  15. package/src/api/diagnose.ts +97 -3
  16. package/src/api/radarFeatures.render.test.tsx +33 -1
  17. package/src/api/radarFeatures.test.ts +47 -0
  18. package/src/api/radarFeatures.ts +41 -1
  19. package/src/api/rbac.settled.test.tsx +42 -0
  20. package/src/api/rbac.test.ts +18 -0
  21. package/src/api/rbac.ts +37 -7
  22. package/src/api/traffic.ts +9 -4
  23. package/src/api/usage-data.fixtures.ts +3 -1
  24. package/src/api/usage-data.test.tsx +134 -0
  25. package/src/api/usage-data.ts +35 -7
  26. package/src/api/workloadPodsPolling.test.ts +26 -0
  27. package/src/components/CloudConnectFlow.test.tsx +86 -0
  28. package/src/components/CloudConnectFlow.tsx +65 -27
  29. package/src/components/CloudFunnelButton.test.tsx +140 -5
  30. package/src/components/CloudFunnelButton.tsx +50 -9
  31. package/src/components/ConnectionErrorView.test.tsx +34 -0
  32. package/src/components/ConnectionErrorView.tsx +35 -11
  33. package/src/components/ContextSwitcher.tsx +5 -2
  34. package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
  35. package/src/components/SwitchAwareConnectionError.tsx +85 -0
  36. package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
  37. package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
  38. package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
  39. package/src/components/capacity/CapacityDemand.tsx +3 -2
  40. package/src/components/capacity/demandSummary.test.ts +38 -0
  41. package/src/components/capacity/shared.tsx +12 -1
  42. package/src/components/cost/ApplicationCostTab.tsx +4 -0
  43. package/src/components/cost/CostTrendChart.tsx +2 -0
  44. package/src/components/cost/WorkloadCostTab.tsx +4 -0
  45. package/src/components/cost/source.test.ts +5 -0
  46. package/src/components/cost/source.ts +11 -0
  47. package/src/components/diagnose/AIMarkdown.tsx +4 -1
  48. package/src/components/diagnose/ActivityTurn.tsx +34 -14
  49. package/src/components/diagnose/AgentControls.tsx +53 -6
  50. package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
  51. package/src/components/diagnose/AgentSetupNotice.tsx +22 -4
  52. package/src/components/diagnose/AgentSigninNotice.test.tsx +98 -0
  53. package/src/components/diagnose/AgentSigninNotice.tsx +61 -0
  54. package/src/components/diagnose/AnalysisStory.test.tsx +22 -0
  55. package/src/components/diagnose/AnalysisStory.tsx +17 -4
  56. package/src/components/diagnose/AssessmentCard.tsx +39 -8
  57. package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
  58. package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
  59. package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
  60. package/src/components/diagnose/DiagnoseContext.capacity.test.tsx +113 -0
  61. package/src/components/diagnose/DiagnoseContext.question.test.tsx +245 -0
  62. package/src/components/diagnose/DiagnoseContext.tsx +272 -10
  63. package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
  64. package/src/components/diagnose/DiagnoseSurface.tsx +151 -134
  65. package/src/components/diagnose/EvidenceCard.tsx +67 -14
  66. package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
  67. package/src/components/diagnose/Home.test.tsx +208 -5
  68. package/src/components/diagnose/Home.tsx +187 -36
  69. package/src/components/diagnose/InvestigationCapacityNotice.test.tsx +246 -0
  70. package/src/components/diagnose/InvestigationCapacityNotice.tsx +241 -0
  71. package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +97 -6
  72. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +57 -0
  73. package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
  74. package/src/components/diagnose/InvestigationEvidenceSections.tsx +50 -23
  75. package/src/components/diagnose/InvestigationView.tsx +249 -54
  76. package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
  77. package/src/components/diagnose/LocalDiagnoseAction.tsx +365 -39
  78. package/src/components/diagnose/NextStepJump.test.tsx +92 -0
  79. package/src/components/diagnose/NextStepJump.tsx +75 -0
  80. package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
  81. package/src/components/diagnose/QuestionComposer.tsx +495 -0
  82. package/src/components/diagnose/QuestionFocus.test.tsx +38 -0
  83. package/src/components/diagnose/QuestionFocus.tsx +123 -0
  84. package/src/components/diagnose/ResourcePicker.tsx +206 -0
  85. package/src/components/diagnose/StoryExcerpt.tsx +12 -3
  86. package/src/components/diagnose/assessmentCopy.ts +5 -0
  87. package/src/components/diagnose/exampleInvestigation.events.json +191 -0
  88. package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
  89. package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
  90. package/src/components/diagnose/exampleInvestigation.ts +121 -0
  91. package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
  92. package/src/components/diagnose/investigationCase.test.tsx +9 -1
  93. package/src/components/diagnose/investigationCase.ts +33 -1
  94. package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
  95. package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
  96. package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +58 -2
  97. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
  98. package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
  99. package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +40 -0
  100. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +27 -1
  101. package/src/components/diagnose/investigationEvidence/bodies/metrics.test.tsx +111 -0
  102. package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
  103. package/src/components/diagnose/investigationEvidence/builder.ts +30 -0
  104. package/src/components/diagnose/investigationEvidence/excerpt.test.ts +18 -5
  105. package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
  106. package/src/components/diagnose/investigationEvidence/index.ts +1 -1
  107. package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
  108. package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
  109. package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
  110. package/src/components/diagnose/investigationEvidence/types.ts +7 -0
  111. package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
  112. package/src/components/diagnose/investigationFocus.test.ts +271 -0
  113. package/src/components/diagnose/investigationFocus.ts +132 -0
  114. package/src/components/diagnose/investigationState.ts +28 -0
  115. package/src/components/diagnose/lastInvestigation.test.ts +95 -0
  116. package/src/components/diagnose/lastInvestigation.ts +58 -0
  117. package/src/components/diagnose/launch.test.ts +125 -1
  118. package/src/components/diagnose/launch.ts +57 -10
  119. package/src/components/diagnose/parts.test.tsx +20 -0
  120. package/src/components/diagnose/questionSuggestions.test.ts +111 -0
  121. package/src/components/diagnose/questionSuggestions.ts +150 -0
  122. package/src/components/diagnose/storyParts.test.tsx +13 -0
  123. package/src/components/diagnose/target.test.ts +143 -2
  124. package/src/components/diagnose/target.ts +109 -7
  125. package/src/components/diagnose/testdata/story-runs.json +474 -0
  126. package/src/components/diagnose/toolCallLabel.test.ts +10 -4
  127. package/src/components/diagnose/verdictText.test.tsx +87 -0
  128. package/src/components/diagnose/verdictText.ts +68 -0
  129. package/src/components/execution/BatchExecutionView.tsx +24 -11
  130. package/src/components/execution/JobSetAdmission.test.tsx +42 -0
  131. package/src/components/execution/JobSetAdmission.tsx +18 -3
  132. package/src/components/execution/JobSetMemberComparison.tsx +2 -1
  133. package/src/components/execution/runState.test.ts +14 -0
  134. package/src/components/execution/runState.ts +8 -0
  135. package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
  136. package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
  137. package/src/components/gitops/GitOpsView.tsx +86 -17
  138. package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
  139. package/src/components/gitops/destination-toast.test.ts +1 -1
  140. package/src/components/gitops/destination-toast.ts +2 -2
  141. package/src/components/home/ClusterHealthCard.tsx +13 -39
  142. package/src/components/home/HomeAgentBlock.test.tsx +141 -0
  143. package/src/components/home/HomeAgentBlock.tsx +103 -0
  144. package/src/components/home/HomeDiagramCard.tsx +47 -0
  145. package/src/components/home/HomeView.tsx +86 -47
  146. package/src/components/home/MCPSetupDialog.test.tsx +95 -5
  147. package/src/components/home/MCPSetupDialog.tsx +30 -5
  148. package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
  149. package/src/components/home/ProblemsPanel.test.tsx +3 -1
  150. package/src/components/home/RadarVersionLine.test.tsx +0 -14
  151. package/src/components/home/RadarVersionLine.tsx +3 -28
  152. package/src/components/home/TopologyPreview.test.tsx +73 -0
  153. package/src/components/home/TopologyPreview.tsx +120 -233
  154. package/src/components/home/TrafficSummary.test.tsx +63 -0
  155. package/src/components/home/TrafficSummary.tsx +135 -138
  156. package/src/components/home/mcpToolCatalog.ts +23 -10
  157. package/src/components/issues/IssuesPane.test.ts +11 -0
  158. package/src/components/issues/IssuesPane.tsx +15 -5
  159. package/src/components/issues/uncheckedSources.test.ts +20 -1
  160. package/src/components/issues/uncheckedSources.ts +18 -0
  161. package/src/components/kueue/KueuePendingPosition.tsx +35 -0
  162. package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
  163. package/src/components/kueue/useRelatedReads.test.ts +56 -0
  164. package/src/components/kueue/useRelatedReads.ts +205 -0
  165. package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
  166. package/src/components/logs/MultiPodLogsTab.tsx +120 -0
  167. package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
  168. package/src/components/logs/PodLogsUnavailable.tsx +21 -0
  169. package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
  170. package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
  171. package/src/components/logs/RayClusterLogsTab.tsx +109 -0
  172. package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
  173. package/src/components/logs/rayClusterPods.ts +32 -0
  174. package/src/components/outageSince.test.ts +21 -0
  175. package/src/components/outageSince.ts +10 -0
  176. package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
  177. package/src/components/resource/PrometheusCharts.tsx +3 -40
  178. package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
  179. package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
  180. package/src/components/resources/crd/host.tsx +14 -0
  181. package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
  182. package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
  183. package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
  184. package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
  185. package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
  186. package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
  187. package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
  188. package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
  189. package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
  190. package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
  191. package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
  192. package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
  193. package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
  194. package/src/components/traffic/TrafficView.tsx +3 -3
  195. package/src/components/ui/Omnibar.investigate.test.tsx +105 -0
  196. package/src/components/ui/Omnibar.tsx +47 -3
  197. package/src/components/ui/RadarOmnibar.test.tsx +1 -0
  198. package/src/components/ui/RadarOmnibar.tsx +11 -0
  199. package/src/components/ui/command-items-crd.test.tsx +23 -0
  200. package/src/components/ui/command-items.ts +2 -1
  201. package/src/components/useContextSwitchFlow.test.tsx +61 -0
  202. package/src/components/useContextSwitchFlow.tsx +21 -4
  203. package/src/components/whats-new/WhatsNew.test.ts +10 -3
  204. package/src/components/whats-new/WhatsNew.tsx +5 -1
  205. package/src/components/whats-new/WhatsNewDialog.test.tsx +18 -4
  206. package/src/components/whats-new/releaseNotes.ts +136 -4
  207. package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
  208. package/src/components/workload/RelatedFindingsSection.tsx +80 -0
  209. package/src/components/workload/WorkloadView.test.ts +10 -1
  210. package/src/components/workload/WorkloadView.tsx +85 -98
  211. package/src/components/workload/issueResourceOpener.test.ts +20 -0
  212. package/src/components/workload/issueResourceOpener.ts +17 -0
  213. package/src/context/ConnectionContext.tsx +133 -60
  214. package/src/context/ConnectionProvider.retry.test.tsx +176 -0
  215. package/src/context/ContextSwitchContext.tsx +14 -1
  216. package/src/context/DiagnoseCustomization.tsx +3 -0
  217. package/src/context/clusterConnected.ts +10 -0
  218. package/src/contexts/CapabilitiesContext.tsx +6 -4
  219. package/src/hooks/useAgentSignin.test.tsx +190 -0
  220. package/src/hooks/useAgentSignin.ts +160 -0
  221. package/src/hooks/useApproveAfterSignin.test.tsx +108 -0
  222. package/src/hooks/useElementSize.ts +30 -0
  223. package/src/integrations/resourceHost.test.tsx +1 -0
  224. package/src/integrations/resourceHost.ts +5 -1
  225. package/src/integrations/resourceHosts.test.tsx +21 -4
  226. package/src/integrations/resourceHosts.tsx +12 -0
  227. package/src/main.tsx +5 -0
  228. package/src/utils/related-findings.ts +46 -0
@@ -0,0 +1,108 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { beforeEach, expect, it, vi } from 'vitest'
5
+ import { useApproveAfterSignin } from './useAgentSignin'
6
+ import type { AgentSigninStatus } from '../api/diagnose'
7
+
8
+ vi.mock('../api/client', () => ({ useRadarFeature: () => ({ support: 'supported' }) }))
9
+ vi.mock('../api/diagnose', () => ({ fetchAgentSignin: vi.fn() }))
10
+
11
+ type Actions = ReturnType<typeof useApproveAfterSignin>
12
+ const seen = {} as { actions: Actions }
13
+
14
+ function Probe(props: Parameters<typeof useApproveAfterSignin>[0]) {
15
+ seen.actions = useApproveAfterSignin(props)
16
+ return null
17
+ }
18
+
19
+ function deferred() {
20
+ let resolve!: (s: AgentSigninStatus | undefined) => void
21
+ const promise = new Promise<AgentSigninStatus | undefined>((r) => { resolve = r })
22
+ return { promise, resolve }
23
+ }
24
+
25
+ const signedOut: AgentSigninStatus = { agent: 'claude', state: 'signed-out', signinCmd: 'claude auth login' }
26
+
27
+ let root: Root
28
+ let approve: ReturnType<typeof vi.fn<() => void>>
29
+ let cancel: ReturnType<typeof vi.fn<() => void>>
30
+
31
+ async function render(pending: boolean, settle: () => Promise<AgentSigninStatus | undefined>, attemptKey = 'claude:safeguarded') {
32
+ await act(async () => {
33
+ root.render(<Probe approve={approve} cancel={cancel} signin={{ pending, settle }} attemptKey={attemptKey} />)
34
+ })
35
+ }
36
+
37
+ beforeEach(() => {
38
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
39
+ root = createRoot(document.createElement('div'))
40
+ approve = vi.fn()
41
+ cancel = vi.fn()
42
+ })
43
+
44
+ it('approves at once when no check is running', async () => {
45
+ const settle = vi.fn()
46
+ await render(false, settle)
47
+ await act(async () => seen.actions.approve())
48
+ expect(approve).toHaveBeenCalledTimes(1)
49
+ expect(settle).not.toHaveBeenCalled()
50
+ root.unmount()
51
+ })
52
+
53
+ it('waits for a running check and stops on signed out', async () => {
54
+ const answer = deferred()
55
+ await render(true, () => answer.promise)
56
+ await act(async () => seen.actions.approve())
57
+ expect(seen.actions.waiting).toBe(true)
58
+ expect(approve).not.toHaveBeenCalled()
59
+ await act(async () => answer.resolve(signedOut))
60
+ expect(seen.actions.waiting).toBe(false)
61
+ expect(approve).not.toHaveBeenCalled()
62
+ root.unmount()
63
+ })
64
+
65
+ it.each<[string, AgentSigninStatus | undefined]>([
66
+ ['signed in', { agent: 'claude', state: 'signed-in' }],
67
+ ['unknown', { agent: 'claude', state: 'unknown' }],
68
+ ['no answer (timeout or failure)', undefined],
69
+ ])('approves after a running check answers %s', async (_label, status) => {
70
+ const answer = deferred()
71
+ await render(true, () => answer.promise)
72
+ await act(async () => seen.actions.approve())
73
+ await act(async () => answer.resolve(status))
74
+ expect(approve).toHaveBeenCalledTimes(1)
75
+ root.unmount()
76
+ })
77
+
78
+ it('Cancel abandons the wait', async () => {
79
+ const answer = deferred()
80
+ await render(true, () => answer.promise)
81
+ await act(async () => seen.actions.approve())
82
+ await act(async () => seen.actions.cancel())
83
+ expect(cancel).toHaveBeenCalledTimes(1)
84
+ expect(seen.actions.waiting).toBe(false)
85
+ await act(async () => answer.resolve({ agent: 'claude', state: 'signed-in' }))
86
+ expect(approve).not.toHaveBeenCalled()
87
+ root.unmount()
88
+ })
89
+
90
+ it('switching agent or profile abandons the wait', async () => {
91
+ const answer = deferred()
92
+ await render(true, () => answer.promise)
93
+ await act(async () => seen.actions.approve())
94
+ await render(true, () => answer.promise, 'codex:safeguarded')
95
+ expect(seen.actions.waiting).toBe(false)
96
+ await act(async () => answer.resolve(undefined))
97
+ expect(approve).not.toHaveBeenCalled()
98
+ root.unmount()
99
+ })
100
+
101
+ it('leaving the card abandons the wait', async () => {
102
+ const answer = deferred()
103
+ await render(true, () => answer.promise)
104
+ await act(async () => seen.actions.approve())
105
+ root.unmount()
106
+ await act(async () => answer.resolve(undefined))
107
+ expect(approve).not.toHaveBeenCalled()
108
+ })
@@ -0,0 +1,30 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+
3
+ export interface ElementSize {
4
+ width: number
5
+ height: number
6
+ }
7
+
8
+ // Tracks an element's rendered size. Until the first measurement (and where
9
+ // ResizeObserver is missing, as in jsdom) it reports `initial`.
10
+ export function useElementSize<T extends Element>(initial: ElementSize) {
11
+ const ref = useRef<T>(null)
12
+ const [size, setSize] = useState(initial)
13
+
14
+ useEffect(() => {
15
+ const el = ref.current
16
+ if (!el || typeof ResizeObserver === 'undefined') return
17
+ const update = () => {
18
+ const { width, height } = el.getBoundingClientRect()
19
+ if (width > 0 && height > 0) {
20
+ setSize(prev => (prev.width === width && prev.height === height ? prev : { width, height }))
21
+ }
22
+ }
23
+ update()
24
+ const observer = new ResizeObserver(update)
25
+ observer.observe(el)
26
+ return () => observer.disconnect()
27
+ }, [])
28
+
29
+ return [ref, size] as const
30
+ }
@@ -48,6 +48,7 @@ describe('resource host composition', () => {
48
48
 
49
49
  it('catches summary and tab conflicts even if a contribution omitted its declaration', () => {
50
50
  expect(() => composeDetailSlots(['one', 'two'].map(id => ({ id, slots: { renderSummary: () => null } })))).toThrow('summary ownership conflict')
51
+ expect(() => composeDetailSlots(['one', 'two'].map(id => ({ id, slots: { renderStatusBadge: () => null } })))).toThrow('status badge ownership conflict')
51
52
  const tab = { id: 'runs', label: 'Runs', render: () => null }
52
53
  expect(composeDetailSlots([], [tab, tab]).extraTabs).toEqual([tab, tab])
53
54
  expect(() => composeDetailSlots([{ id: 'execution', slots: { extraTabs: [tab] } }], [tab])).toThrow('tab ownership conflict: runs')
@@ -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'>
9
+ export type DetailSlots = Pick<ComponentProps<typeof WorkloadView>, 'renderSummary' | 'renderHeaderActions' | 'extraTabs' | 'renderStatusBadge'>
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 }
@@ -84,6 +84,9 @@ export function composeDetailSlots(contributions: readonly { id: string; slots:
84
84
  const summaries = contributions.filter(host => host.slots?.renderSummary)
85
85
  if (summaries.length > 1) throw new Error(`Resource host summary ownership conflict: ${summaries.map(host => host.id).join(', ')}`)
86
86
  const summary = summaries[0]?.slots?.renderSummary
87
+ const badges = contributions.filter(host => host.slots?.renderStatusBadge)
88
+ if (badges.length > 1) throw new Error(`Resource host status badge ownership conflict: ${badges.map(host => host.id).join(', ')}`)
89
+ const badge = badges[0]?.slots?.renderStatusBadge
87
90
  const actions = contributions.filter(host => host.slots?.renderHeaderActions)
88
91
  const tabs = [...inheritedTabs, ...contributions.flatMap(host => host.slots?.extraTabs ?? [])]
89
92
  const tabIds = new Set(inheritedTabs.map(tab => tab.id))
@@ -93,6 +96,7 @@ export function composeDetailSlots(contributions: readonly { id: string; slots:
93
96
  }
94
97
  return {
95
98
  ...(summary ? { renderSummary: summary } : {}),
99
+ ...(badge ? { renderStatusBadge: badge } : {}),
96
100
  ...(actions.length ? { renderHeaderActions: (props: Parameters<NonNullable<DetailSlots['renderHeaderActions']>>[0]) => actions.map(host => createElement(Fragment, { key: host.id }, host.slots!.renderHeaderActions!(props))) } : {}),
97
101
  ...(tabs.length ? { extraTabs: tabs } : {}),
98
102
  }
@@ -8,7 +8,7 @@ import { kindToPluralWithGroup } from '../utils/navigation'
8
8
  import {
9
9
  decorateResourceDiagnose, renderResourceKindList, resourceKindListMode, resourceKindListTitle, ResourceDrawerNavigation,
10
10
  resourceDetailRedirect, resourceDetailSlots, resourceExpandedPath,
11
- resourceLogs, resourceRendererOverrides,
11
+ resourceLogs, resourceRendererOverrides, resourceHosts,
12
12
  } from './resourceHosts'
13
13
 
14
14
  vi.mock('../api/client', () => ({
@@ -48,14 +48,14 @@ describe('application resource hosts', () => {
48
48
 
49
49
  it('retains every existing renderer override at a stable module reference', () => {
50
50
  expect(Object.keys(resourceRendererOverrides).sort()).toEqual([
51
- 'RayJobRenderer', 'JobRenderer', 'JobSetRenderer', 'RayServiceRenderer', 'RayClusterRenderer',
52
- 'KueueWorkloadRenderer', 'CAPIClusterRenderer', 'PodRenderer', 'KarpenterNodePoolRenderer',
51
+ 'CustomResourceDefinitionRenderer', 'RayJobRenderer', 'JobRenderer', 'JobSetRenderer', 'RayServiceRenderer', 'RayClusterRenderer',
52
+ 'KueueWorkloadRenderer', 'LocalQueueRenderer', 'ClusterQueueRenderer', 'CAPIClusterRenderer', 'PodRenderer', 'KarpenterNodePoolRenderer',
53
53
  'NodeRenderer', 'ServiceRenderer', 'WorkloadRenderer', 'CompositeRenderer', 'ServiceAccountRenderer',
54
54
  'RoleRenderer', 'RoleBindingRenderer', 'NamespaceRenderer', 'HPARenderer', 'PVCRenderer',
55
55
  'RolloutRenderer', 'KyvernoPolicyCoverage', 'KyvernoPolicyQueued', 'CNPGObjectStoreRenderer',
56
56
  'VeleroBSLRenderer', 'VeleroBackupRenderer', 'VeleroRestoreRenderer', 'CNPGClusterRenderer',
57
57
  'CNPGDatabaseRenderer', 'CNPGPublicationRenderer', 'CNPGSubscriptionRenderer', 'CNPGImageCatalogRenderer',
58
- 'FluxHelmReleaseRenderer',
58
+ 'FluxHelmReleaseRenderer', 'OpenTelemetryCollectorRenderer',
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,12 @@ describe('application resource hosts', () => {
63
63
  expect(resourceDetailRedirect({ ...cluster, group: '' }, new URLSearchParams('tab=events'))).toBeNull()
64
64
  })
65
65
 
66
+ it('owns the LocalQueue header badge and nothing for other Kueue kinds', () => {
67
+ expect(resourceDetailSlots({ kind: 'LocalQueue', group: 'kueue.x-k8s.io', namespace: 'team', name: 'q' }).renderStatusBadge).toBeTypeOf('function')
68
+ expect(resourceDetailSlots({ kind: 'ClusterQueue', group: 'kueue.x-k8s.io', namespace: '', name: 'q' }).renderStatusBadge).toBeUndefined()
69
+ expect(resourceDetailSlots({ kind: 'LocalQueue', group: undefined, namespace: 'team', name: 'q' }).renderStatusBadge).toBeUndefined()
70
+ })
71
+
66
72
  it('keeps query, tab, context and drawer state when redirecting a generic detail link', () => {
67
73
  const search = new URLSearchParams('apiGroup=postgresql.cnpg.io&ctx=kind-demo&tab=events&drawer=pods%3Apg-1&ai-run=run')
68
74
  const path = resourceDetailRedirect({ ...cluster, kind: 'clusters' }, search)!
@@ -140,3 +146,14 @@ describe('application resource hosts', () => {
140
146
  expect(decorateResourceDiagnose(undefined)).toBeUndefined()
141
147
  })
142
148
  })
149
+
150
+
151
+ it('registers one CRD renderer and one Schema tab for the exact group', () => {
152
+ const resource = { kind: 'customresourcedefinitions', namespace: '', name: 'widgets.example.io', group: 'apiextensions.k8s.io' }
153
+ const tabs = resourceDetailSlots(resource).extraTabs!
154
+ expect(tabs.map(tab => [tab.id, tab.label, tab.after])).toEqual([['schema', 'Schema', 'overview']])
155
+ expect(isValidElement(tabs[0].render())).toBe(true)
156
+ expect(resourceDetailSlots({ ...resource, group: 'other.io' })).toEqual({})
157
+ expect(resourceDetailSlots({ ...resource, kind: 'CustomResourceDefinition' }).extraTabs).toHaveLength(1)
158
+ expect(resourceHosts.filter(host => host.renderers?.CustomResourceDefinitionRenderer).map(host => host.id)).toEqual(['crd'])
159
+ })
@@ -6,6 +6,7 @@ import type { RenderDiagnoseAction } from '../context/DiagnoseCustomization'
6
6
  import { apiVersionToGroup } from '../utils/navigation'
7
7
  import type { SelectedResource } from '../types'
8
8
  import { cnpgResourceHost } from '../components/cnpg/host'
9
+ import { crdResourceHost } from '../components/resources/crd/host'
9
10
  import {
10
11
  composeDetailSlots, composeResourceHosts, hostsForResource, hostSupport, resourceHostForSlot,
11
12
  type DetailSlots, type HostResource, type HostFeatures, type HostKind, type KindListProps,
@@ -14,8 +15,10 @@ import {
14
15
  import { RayJobRenderer } from '../components/resources/renderers/RayJobRenderer'
15
16
  import { JobRenderer, JobSetRenderer } from '../components/resources/renderers/JobAdmissionRenderers'
16
17
  import { RayClusterRenderer } from '../components/resources/renderers/RayClusterRenderer'
18
+ import { OpenTelemetryCollectorRenderer } from '../components/resources/renderers/OpenTelemetryCollectorRenderer'
17
19
  import { RayServiceRenderer } from '../components/resources/renderers/RayServiceRenderer'
18
20
  import { KueueWorkloadRenderer } from '../components/resources/renderers/KueueWorkloadRenderer'
21
+ import { ClusterQueueRenderer, LocalQueueRenderer, LocalQueueStatusBadge } from '../components/resources/renderers/KueueQueueRenderers'
19
22
  import { PodRenderer } from '../components/resources/renderers/PodRenderer'
20
23
  import { KarpenterNodePoolRenderer } from '../components/resources/renderers/KarpenterNodePoolRenderer'
21
24
  import { NodeRenderer } from '../components/resources/renderers/NodeRenderer'
@@ -41,6 +44,14 @@ export const resourceHosts: readonly ResourceHost[] = [
41
44
  { id: 'kubernetes', renderers: { PodRenderer, NodeRenderer, ServiceRenderer, WorkloadRenderer, HPARenderer, PVCRenderer } },
42
45
  { id: 'rbac', renderers: { ServiceAccountRenderer, RoleRenderer, RoleBindingRenderer, NamespaceRenderer } },
43
46
  { id: 'batch-and-admission', renderers: { JobRenderer, JobSetRenderer, KueueWorkloadRenderer } },
47
+ {
48
+ id: 'kueue-queues',
49
+ renderers: { LocalQueueRenderer, ClusterQueueRenderer },
50
+ // The header badge reads the LocalQueue's ClusterQueue like its detail does, so header and detail agree; the table keeps the LocalQueue's own report.
51
+ resources: [{ name: 'localqueues', group: 'kueue.x-k8s.io' }],
52
+ detailSlots: () => ({ renderStatusBadge: (resource: any) => <LocalQueueStatusBadge data={resource} /> }),
53
+ },
54
+ { id: 'opentelemetry', renderers: { OpenTelemetryCollectorRenderer } },
44
55
  { id: 'ray', renderers: { RayJobRenderer, RayServiceRenderer, RayClusterRenderer } },
45
56
  { id: 'capacity', renderers: { KarpenterNodePoolRenderer } },
46
57
  { id: 'capi', renderers: { CAPIClusterRenderer } },
@@ -50,6 +61,7 @@ export const resourceHosts: readonly ResourceHost[] = [
50
61
  { id: 'velero', renderers: { VeleroBSLRenderer, VeleroBackupRenderer, VeleroRestoreRenderer } },
51
62
  { id: 'flux', renderers: { FluxHelmReleaseRenderer } },
52
63
  cnpgResourceHost,
64
+ crdResourceHost,
53
65
  ]
54
66
 
55
67
  export const resourceRendererOverrides = composeResourceHosts(resourceHosts)
package/src/main.tsx CHANGED
@@ -1,10 +1,15 @@
1
1
  import React from 'react'
2
2
  import ReactDOM from 'react-dom/client'
3
3
  import { RadarApp } from './RadarApp'
4
+ import { setAutomaticRequestMarking } from './api/config'
4
5
  import { openExternal } from './utils/navigation'
5
6
  import { installWailsClipboardShim } from './utils/wails-clipboard'
6
7
  import './index.css'
7
8
 
9
+ // Automatic requests can beat the usage status to the server, and a recording
10
+ // Radar must still tell them from clicks. Embedding hosts don't run this entry.
11
+ setAutomaticRequestMarking(true)
12
+
8
13
  // Intercept external link clicks in the Wails desktop app.
9
14
  // <a target="_blank"> is swallowed by WKWebView/WebView2 — route through openExternal()
10
15
  // which calls the backend /api/desktop/open-url endpoint to open in the system browser.
@@ -0,0 +1,46 @@
1
+ import {
2
+ gapReasonText,
3
+ readActionFor,
4
+ type RelatedFindingsGroup,
5
+ } from "@skyhook-io/k8s-ui";
6
+
7
+ export function relatedFindingLimitations(
8
+ group: RelatedFindingsGroup,
9
+ ): { kind: "unknown" | "truncated"; message: string }[] {
10
+ const kinds =
11
+ group.kinds.names
12
+ ?.map((ref) => (ref.group ? `${ref.kind} (${ref.group})` : ref.kind))
13
+ .join(", ") ?? `${group.kinds.count} resource kinds`;
14
+ const limits: { kind: "unknown" | "truncated"; message: string }[] = [];
15
+ if (group.unknown > 0) {
16
+ limits.push({
17
+ kind: "unknown",
18
+ message: `${kinds}: ${group.unknown} of ${group.checked} checked resources could not be assessed.`,
19
+ });
20
+ }
21
+ for (const gap of group.gaps) {
22
+ const action = gap.action ?? readActionFor(gap.code);
23
+ const next =
24
+ action === "radar_config"
25
+ ? " Check Radar's collection settings and cluster access."
26
+ : action === "user_access"
27
+ ? " Ask an administrator for read access."
28
+ : action === "retry" || action === "wait"
29
+ ? " Retry this read."
30
+ : "";
31
+ const reason =
32
+ gap.code === "list_too_large"
33
+ ? "too many resources to inspect"
34
+ : gapReasonText(gap.code);
35
+ const message = `${kinds}: incomplete related inventory — ${reason}.${next}`;
36
+ if (!limits.some((limit) => limit.message === message))
37
+ limits.push({ kind: "unknown", message });
38
+ }
39
+ if (group.truncated) {
40
+ limits.push({
41
+ kind: "truncated",
42
+ message: "Additional related findings were omitted.",
43
+ });
44
+ }
45
+ return limits;
46
+ }