@skyhook-io/radar-app 1.20.1 → 1.21.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 (215) hide show
  1. package/package.json +10 -9
  2. package/src/App.tsx +65 -16
  3. package/src/api/client.audit-gating.test.tsx +105 -5
  4. package/src/api/client.auditBadgesSync.test.tsx +118 -0
  5. package/src/api/client.capabilitiesPoll.test.ts +61 -0
  6. package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
  7. package/src/api/client.pauseDeployment.test.tsx +77 -0
  8. package/src/api/client.restartError.test.ts +14 -0
  9. package/src/api/client.revisionRefresh.test.tsx +44 -0
  10. package/src/api/client.rollbackError.test.ts +14 -0
  11. package/src/api/client.ts +347 -16
  12. package/src/api/namespaceScopeRetry.test.ts +14 -0
  13. package/src/api/networkAttachments.test.tsx +120 -0
  14. package/src/api/networkAttachments.ts +30 -0
  15. package/src/api/radarFeatures.test.ts +5 -0
  16. package/src/api/radarFeatures.ts +10 -0
  17. package/src/api/secretsStore.test.ts +33 -0
  18. package/src/api/secretsStore.ts +37 -0
  19. package/src/api/substrateHealth.ts +134 -0
  20. package/src/api/velero.test.ts +60 -0
  21. package/src/api/velero.ts +201 -0
  22. package/src/api/vulnerabilities.ts +255 -0
  23. package/src/components/ConnectionErrorView.test.tsx +11 -0
  24. package/src/components/ConnectionErrorView.tsx +19 -0
  25. package/src/components/ContextSwitcher.tsx +9 -2
  26. package/src/components/NamespaceSwitcher.tsx +3 -1
  27. package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
  28. package/src/components/applications/ApplicationsView.tsx +8 -11
  29. package/src/components/audit/AuditView.tsx +4 -0
  30. package/src/components/audit/ChecksViewTabs.test.tsx +33 -5
  31. package/src/components/audit/ChecksViewTabs.tsx +11 -1
  32. package/src/components/audit/UpgradeReadinessView.test.ts +35 -1
  33. package/src/components/audit/UpgradeReadinessView.tsx +60 -2
  34. package/src/components/audit/VulnerabilitiesView.tsx +907 -0
  35. package/src/components/cnpg/CNPGClusterTabs.tsx +3 -1
  36. package/src/components/cnpg/CNPGDrawerTrail.tsx +5 -26
  37. package/src/components/cnpg/CNPGInvestigationAction.test.tsx +27 -6
  38. package/src/components/cnpg/CNPGView.tsx +43 -117
  39. package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +30 -0
  40. package/src/components/cnpg/host.tsx +2 -2
  41. package/src/components/cnpg/routes.ts +3 -1
  42. package/src/components/cnpg/shared.tsx +5 -53
  43. package/src/components/cnpg/useCNPGNavigate.ts +1 -21
  44. package/src/components/cnpg/useCNPGSidebarWorkspace.ts +16 -13
  45. package/src/components/community.tsx +42 -0
  46. package/src/components/cost/CostView.tsx +27 -9
  47. package/src/components/diagnose/InvestigationView.tsx +12 -3
  48. package/src/components/diagnose/diagnoseEvidenceTypes.ts +2 -0
  49. package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
  50. package/src/components/diagnose/investigationEvidence/adapters/helm.ts +10 -0
  51. package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
  52. package/src/components/diagnose/investigationEvidence/types.ts +5 -0
  53. package/src/components/diagnose/investigationMetrics.test.ts +20 -0
  54. package/src/components/diagnose/investigationMetrics.ts +2 -1
  55. package/src/components/dock/BottomDock.tsx +1 -0
  56. package/src/components/dock/LogsTab.tsx +3 -0
  57. package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
  58. package/src/components/dock/TerminalPreferences.test.tsx +68 -0
  59. package/src/components/dock/TerminalPreferences.tsx +73 -0
  60. package/src/components/gitops/GitOpsView.tsx +2 -10
  61. package/src/components/helm/HelmDrawerFrame.tsx +1 -1
  62. package/src/components/helm/HelmReleaseDrawer.tsx +24 -12
  63. package/src/components/helm/HelmView.tsx +25 -19
  64. package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
  65. package/src/components/helm/NotCheckedBadge.tsx +39 -0
  66. package/src/components/helm/OwnedResources.test.tsx +86 -0
  67. package/src/components/helm/OwnedResources.tsx +69 -11
  68. package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
  69. package/src/components/home/ClusterHealthCard.test.ts +44 -1
  70. package/src/components/home/ClusterHealthCard.tsx +25 -11
  71. package/src/components/home/HelmSummary.tsx +15 -15
  72. package/src/components/home/HomeAgentBlock.tsx +3 -0
  73. package/src/components/home/HomeView.tsx +7 -0
  74. package/src/components/home/MCPSetupDialog.test.tsx +19 -12
  75. package/src/components/home/MCPSetupDialog.tsx +4 -2
  76. package/src/components/home/mcpToolCatalog.ts +17 -4
  77. package/src/components/home/useVulnerabilitiesRow.test.ts +26 -0
  78. package/src/components/home/useVulnerabilitiesRow.ts +50 -0
  79. package/src/components/logs/LogsViewer.tsx +3 -1
  80. package/src/components/logs/MultiPodLogsTab.test.tsx +24 -4
  81. package/src/components/logs/MultiPodLogsTab.tsx +9 -5
  82. package/src/components/nav/PrimaryNavRail.test.tsx +17 -0
  83. package/src/components/nav/PrimaryNavRail.tsx +174 -29
  84. package/src/components/resource/PrometheusChartsGrid.tsx +5 -1
  85. package/src/components/resource/RightsizingStrip.test.ts +57 -0
  86. package/src/components/resource/RightsizingStrip.tsx +53 -4
  87. package/src/components/resource/SubstrateHealthCharts.test.tsx +143 -0
  88. package/src/components/resource/SubstrateHealthCharts.tsx +254 -0
  89. package/src/components/resource/SubstrateVerdictLine.test.tsx +131 -0
  90. package/src/components/resource/SubstrateVerdictLine.tsx +180 -0
  91. package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
  92. package/src/components/resources/ImageFilesystemModal.tsx +98 -6
  93. package/src/components/resources/PodFileUploadPanel.tsx +150 -0
  94. package/src/components/resources/PodFilesystemModal.tsx +246 -3
  95. package/src/components/resources/ResourcesView.tsx +12 -6
  96. package/src/components/resources/pod-file-upload.test.tsx +223 -0
  97. package/src/components/resources/pod-file-upload.ts +266 -0
  98. package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
  99. package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
  100. package/src/components/resources/renderers/PodRenderer.tsx +26 -1
  101. package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
  102. package/src/components/resources/renderers/UpgradePlanRenderer.test.tsx +20 -0
  103. package/src/components/resources/renderers/UpgradePlanRenderer.tsx +22 -0
  104. package/src/components/resources/renderers/VeleroBackupRenderer.tsx +16 -36
  105. package/src/components/resources/renderers/VeleroRestoreRenderer.tsx +6 -19
  106. package/src/components/resources/renderers/WorkloadRenderer.tsx +8 -0
  107. package/src/components/rightsizing/RightsizingScanView.tsx +19 -3
  108. package/src/components/rightsizing/model.test.ts +11 -0
  109. package/src/components/rightsizing/model.ts +3 -1
  110. package/src/components/rightsizing/presentation.test.ts +46 -0
  111. package/src/components/rightsizing/presentation.ts +17 -2
  112. package/src/components/shared/LargeClusterNamespacePicker.test.tsx +27 -0
  113. package/src/components/shared/LargeClusterNamespacePicker.tsx +8 -2
  114. package/src/components/timeline/TimelineView.tsx +3 -1
  115. package/src/components/traffic/TrafficConnectionsTable.test.tsx +94 -0
  116. package/src/components/traffic/TrafficConnectionsTable.tsx +21 -5
  117. package/src/components/traffic/TrafficData.test.tsx +37 -0
  118. package/src/components/traffic/TrafficData.tsx +27 -0
  119. package/src/components/traffic/TrafficFlowList.tsx +9 -7
  120. package/src/components/traffic/TrafficGraph.layoutEngine.test.tsx +193 -0
  121. package/src/components/traffic/TrafficGraph.test.tsx +269 -0
  122. package/src/components/traffic/TrafficGraph.tsx +135 -64
  123. package/src/components/traffic/TrafficGraphUnavailable.tsx +57 -0
  124. package/src/components/traffic/TrafficView.layoutUnavailable.test.tsx +211 -0
  125. package/src/components/traffic/TrafficView.tsx +72 -155
  126. package/src/components/traffic/trafficFilters.test.ts +189 -1
  127. package/src/components/traffic/trafficFilters.ts +169 -1
  128. package/src/components/ui/DiagnosticsOverlay.tsx +14 -1
  129. package/src/components/ui/Omnibar.tsx +4 -1
  130. package/src/components/ui/RadarOmnibar.test.tsx +55 -2
  131. package/src/components/ui/RadarOmnibar.tsx +7 -1
  132. package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
  133. package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
  134. package/src/components/ui/UpdateNotification.manual.test.tsx +5 -2
  135. package/src/components/ui/UpdateNotification.test.tsx +54 -3
  136. package/src/components/ui/UpdateNotification.tsx +60 -19
  137. package/src/components/ui/command-items.ts +24 -1
  138. package/src/components/ui/omnibar-match.test.ts +7 -0
  139. package/src/components/ui/omnibar-match.ts +1 -0
  140. package/src/components/ui/searchCoverageNote.test.ts +17 -0
  141. package/src/components/ui/searchCoverageNote.ts +31 -7
  142. package/src/components/useContextSwitchFlow.tsx +9 -1
  143. package/src/components/velero/VeleroBackupNow.test.tsx +165 -0
  144. package/src/components/velero/VeleroBackupNow.tsx +143 -0
  145. package/src/components/velero/VeleroDeleteBackup.test.tsx +364 -0
  146. package/src/components/velero/VeleroDeleteBackup.tsx +306 -0
  147. package/src/components/velero/VeleroDetailPage.tsx +148 -0
  148. package/src/components/velero/VeleroKindLists.test.tsx +48 -0
  149. package/src/components/velero/VeleroKindLists.tsx +43 -0
  150. package/src/components/velero/VeleroLocations.expand.test.tsx +27 -0
  151. package/src/components/velero/VeleroLocations.test.tsx +86 -0
  152. package/src/components/velero/VeleroLocations.tsx +240 -0
  153. package/src/components/velero/VeleroOverview.test.tsx +311 -0
  154. package/src/components/velero/VeleroOverview.tsx +485 -0
  155. package/src/components/velero/VeleroPages.test.tsx +516 -0
  156. package/src/components/velero/VeleroPages.tsx +1056 -0
  157. package/src/components/velero/VeleroRunLists.tsx +309 -0
  158. package/src/components/velero/VeleroRunMessagesHost.test.tsx +25 -0
  159. package/src/components/velero/VeleroRunMessagesHost.tsx +54 -0
  160. package/src/components/velero/VeleroScheduleStatusBadge.test.tsx +28 -0
  161. package/src/components/velero/VeleroScheduleStatusBadge.tsx +21 -0
  162. package/src/components/velero/VeleroSchedules.tsx +255 -0
  163. package/src/components/velero/VeleroView.tsx +59 -0
  164. package/src/components/velero/VeleroWorkspace.gate.test.tsx +97 -0
  165. package/src/components/velero/attention.test.ts +178 -0
  166. package/src/components/velero/attention.ts +281 -0
  167. package/src/components/velero/backupDelete.test.tsx +91 -0
  168. package/src/components/velero/backupDelete.tsx +182 -0
  169. package/src/components/velero/coverage.test.ts +87 -0
  170. package/src/components/velero/coverage.ts +150 -0
  171. package/src/components/velero/host.tsx +86 -0
  172. package/src/components/velero/routes.ts +78 -0
  173. package/src/components/velero/runs.tsx +121 -0
  174. package/src/components/velero/shared.test.ts +84 -0
  175. package/src/components/velero/shared.tsx +423 -0
  176. package/src/components/velero/useVeleroSidebarWorkspace.test.tsx +28 -0
  177. package/src/components/velero/useVeleroSidebarWorkspace.ts +71 -0
  178. package/src/components/velero/velero.fixtures.ts +61 -0
  179. package/src/components/velero/workspaceRoute.ts +21 -0
  180. package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +167 -0
  181. package/src/components/vulnerabilities/parts.test.ts +72 -0
  182. package/src/components/vulnerabilities/parts.tsx +291 -0
  183. package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
  184. package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
  185. package/src/components/workload/WorkloadView.tsx +114 -37
  186. package/src/components/workspace/DrawerTrailBack.tsx +32 -0
  187. package/src/components/workspace/WorkspaceFrame.tsx +71 -0
  188. package/src/components/workspace/coverage.ts +61 -0
  189. package/src/components/workspace/layout.test.tsx +29 -1
  190. package/src/components/workspace/layout.tsx +15 -5
  191. package/src/components/workspace/sidebar.ts +9 -0
  192. package/src/components/workspace/useWorkspaceDrawer.ts +63 -0
  193. package/src/components/workspace/useWorkspaceNavigate.ts +21 -0
  194. package/src/context/ConnectionContext.test.ts +1 -0
  195. package/src/context/ConnectionContext.tsx +2 -2
  196. package/src/desktop/AboutDialog.test.ts +12 -0
  197. package/src/desktop/AboutDialog.tsx +151 -0
  198. package/src/desktop/WindowsTitleBar.tsx +359 -0
  199. package/src/desktop/titleBar.test.ts +61 -0
  200. package/src/desktop/titleBar.ts +45 -0
  201. package/src/index.css +19 -0
  202. package/src/integrations/resourceHost.ts +5 -1
  203. package/src/integrations/resourceHosts.test.tsx +15 -3
  204. package/src/integrations/resourceHosts.tsx +26 -6
  205. package/src/integrations/workspaceRoute.ts +1 -1
  206. package/src/integrations/workspaceRoutes.test.ts +11 -0
  207. package/src/integrations/workspaceRoutes.ts +3 -1
  208. package/src/integrations/workspaceScreens.tsx +2 -0
  209. package/src/main.tsx +8 -0
  210. package/src/utils/desktop-zoom.test.ts +53 -0
  211. package/src/utils/desktop-zoom.ts +30 -0
  212. package/src/utils/namespacePick.test.ts +87 -0
  213. package/src/utils/namespacePick.ts +88 -0
  214. package/src/utils/staleAssetPrompt.test.tsx +76 -0
  215. package/src/utils/staleAssetPrompt.tsx +32 -0
@@ -1,5 +1,5 @@
1
1
  import { RelatedFindingsSection } from './RelatedFindingsSection'
2
- import { decorateResourceDiagnose, resourceDetailRedirect, resourceDetailSlots, resourceLogs, resourceRendererOverrides } from '../../integrations/resourceHosts'
2
+ import { decorateResourceDiagnose, resourceDetailRedirect, resourceDetailSlots, resourceIssueDetail, resourceLogs, resourceRendererOverrides } from '../../integrations/resourceHosts'
3
3
  import { ApplicationEvidenceAction } from '../application-evidence/ApplicationEvidenceAction'
4
4
  import { useMemo, useEffect, useCallback, useRef, useState, type ReactNode } from 'react'
5
5
  import { useQueries, useQueryClient } from '@tanstack/react-query'
@@ -25,6 +25,7 @@ import {
25
25
  isDiagnoseKind,
26
26
  isRolloutKind,
27
27
  canSetWorkloadImages,
28
+ canPauseDeployment,
28
29
  isCoreBatchJob,
29
30
  type SetImageOwnership,
30
31
  SET_IMAGE_WRITES,
@@ -36,8 +37,10 @@ import {
36
37
  } from '@skyhook-io/k8s-ui'
37
38
  import type { ServicePortRenderProps } from '@skyhook-io/k8s-ui/components/resources/renderers/ServiceRenderer'
38
39
  import { isJobSetV1Alpha2 } from '@skyhook-io/k8s-ui/components/resources/resource-utils-jobset-lws'
40
+ import { SUBSTRATE_GROUP } from '@skyhook-io/k8s-ui/components/resources/resource-utils-agent-runtimes'
39
41
  import type { SelectedResource, ResourceRef, Relationships, ResourceWithRelationships } from '../../types'
40
42
  import { CronJobSchedulingContext, CronJobSchedulingDetails } from './CronJobSchedulingEvidence'
43
+ import { NodeCertificateContext, NodeCertificateDetails, nodeCertificateContextVisible } from './NodeCertificateEvidence'
41
44
  import { useHistoryPaging } from './historyPaging'
42
45
  import { findInheritedGitOpsLookupRef, useResolvedGitOpsOwner } from '../../hooks/useResolvedGitOpsOwner'
43
46
  import { useGitOpsWriteGuard } from '../../hooks/useGitOpsWriteGuard'
@@ -64,10 +67,13 @@ import {
64
67
  useSuspendCronJob,
65
68
  useResumeCronJob,
66
69
  useRestartWorkload,
70
+ usePauseDeployment,
71
+ useResumeDeployment,
67
72
  fetchWorkloadImages,
68
73
  fetchResourceWithRelationships,
69
74
  useSetWorkloadImages,
70
75
  useWorkloadRevisions,
76
+ useRefreshRevisionsOnNewRollout,
71
77
  useRollbackWorkload,
72
78
  useRolloutAction,
73
79
  useRolloutCapabilities,
@@ -102,7 +108,7 @@ import { isOpenCostWorkloadKind } from '../cost/kinds'
102
108
  import { isRadarFeatureUnsupported } from '../../api/radarFeatures'
103
109
  import { useTrafficAvailable } from '../../api/traffic'
104
110
  import { isNotFoundError, useResourceAudit, useResourceIssues, useSubjectIssues, useRadarFeature, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
105
- import { AuditAlerts, getRadarUpgradeRequirement, ResourceIssuesSection, ReachabilityView, TraceSummary, InClusterConsentDialog, traceFingerprint, staticPollUnreliable, summarizeInClusterTests, type Trace as NetworkTrace, type InClusterCapability, inClusterConsentGiven, consentRequestRows } from '@skyhook-io/k8s-ui'
111
+ import { AuditAlerts, getRadarUpgradeRequirement, ResourceIssuesSection, ReachabilityView, TraceSummary, InClusterConsentDialog, traceFingerprint, staticPollUnreliable, summarizeInClusterTests, type Trace as NetworkTrace, type InClusterCapability, inClusterConsentGiven, consentRequestRows, getDefaultLogContainerName, getLogContainerNames, getInitContainerNames } from '@skyhook-io/k8s-ui'
106
112
  import { WorkloadLogsViewer } from '../logs/WorkloadLogsViewer'
107
113
  import { ScheduledWorkloadLogsViewer } from '../logs/ScheduledWorkloadLogsViewer'
108
114
  import { LogsViewer } from '../logs/LogsViewer'
@@ -134,8 +140,12 @@ import { useDesktopDownload } from '../../hooks/useDesktopDownload'
134
140
  import { useCompareLauncher } from '../compare/useCompareLauncher'
135
141
  import { useDiagnoseCustomization } from '../../context/DiagnoseCustomization'
136
142
  import { NodeDrainStatus } from './NodeDrainStatus'
143
+ import { SubstrateHealthCharts } from '../resource/SubstrateHealthCharts'
144
+ import { SubstrateVerdictLine } from '../resource/SubstrateVerdictLine'
145
+ import { useAPIResources } from '../../api/apiResources'
137
146
  import { recordUsageEvent } from '../../api/usage-data'
138
147
  import { issueResourceOpener } from './issueResourceOpener'
148
+ import { isVeleroBackupKind } from '../velero/routes'
139
149
 
140
150
  type TabType = WorkloadTabType
141
151
 
@@ -290,6 +300,7 @@ interface WorkloadViewProps {
290
300
  statusNote?: ReactNode
291
301
  onRefresh?: () => Promise<unknown>
292
302
  hideKindBadge?: boolean
303
+ truncateName?: boolean
293
304
  }
294
305
 
295
306
  interface ImageTargetOwnershipContext {
@@ -326,6 +337,8 @@ function useActionsBarProps(
326
337
 
327
338
  const deleteMutation = useDeleteResource()
328
339
  const restartWorkloadMutation = useRestartWorkload()
340
+ const pauseDeploymentMutation = usePauseDeployment()
341
+ const resumeDeploymentMutation = useResumeDeployment()
329
342
  const setWorkloadImagesMutation = useSetWorkloadImages()
330
343
  const rollbackMutation = useRollbackWorkload()
331
344
  // Only the revision dialog drives this one, and it explains a failed promote in place
@@ -348,6 +361,9 @@ function useActionsBarProps(
348
361
  const canSetImages = isRolloutShape
349
362
  ? imageUpdatesSupported && isRollout && !rolloutCapabilitiesPending && rolloutCapabilities?.setImage === true
350
363
  : !workloadWritesPending && canSetWorkloadImages({ name: kind, group }, workloadWrites, imageUpdatesSupported)
364
+ const { support: deploymentPauseSupport } = useRadarFeature('deploymentPause')
365
+ const canPauseDeployments = !workloadWritesPending &&
366
+ canPauseDeployment({ name: kind, group }, workloadWrites, deploymentPauseSupport === 'supported')
351
367
  const loadImages = useCallback(
352
368
  (params: { kind: string; namespace: string; name: string }) =>
353
369
  queryClient.fetchQuery({
@@ -418,10 +434,14 @@ function useActionsBarProps(
418
434
  className?: string
419
435
  }) => <PortForwardButton type={type} namespace={ns} name={n} className={className} />,
420
436
  renderDiagnose: decorateResourceDiagnose(renderDiagnose),
421
- onDelete: (
422
- params: Parameters<typeof deleteMutation.mutate>[0],
423
- callbacks?: { onSuccess?: () => void },
424
- ) => deleteMutation.mutate(params, { onSuccess: result => { if (!result.outcomeUnknown) callbacks?.onSuccess?.() } }),
437
+ // Deleting a Velero Backup object leaves the backup in storage and Velero
438
+ // recreates the object; the Velero host offers Delete backup instead.
439
+ onDelete: isVeleroBackupKind(kind, group)
440
+ ? undefined
441
+ : (
442
+ params: Parameters<typeof deleteMutation.mutate>[0],
443
+ callbacks?: { onSuccess?: () => void },
444
+ ) => deleteMutation.mutate(params, { onSuccess: result => { if (!result.outcomeUnknown) callbacks?.onSuccess?.() } }),
425
445
  isDeleting: deleteMutation.isPending,
426
446
  onDeletePreviewOpenChange: setDeletePreviewOpen,
427
447
  cascadeDetail: cascadePreview,
@@ -434,6 +454,16 @@ function useActionsBarProps(
434
454
  restartWorkloadMutation.mutate(params)
435
455
  : undefined,
436
456
  isRestarting: restartWorkloadMutation.isPending,
457
+ onPauseDeployment: canPauseDeployments
458
+ ? (params: Parameters<typeof pauseDeploymentMutation.mutate>[0]) =>
459
+ pauseDeploymentMutation.mutate(params)
460
+ : undefined,
461
+ onResumeDeployment: canPauseDeployments
462
+ ? (params: Parameters<typeof resumeDeploymentMutation.mutate>[0]) =>
463
+ resumeDeploymentMutation.mutate(params)
464
+ : undefined,
465
+ isPausingDeployment: pauseDeploymentMutation.isPending,
466
+ isResumingDeployment: resumeDeploymentMutation.isPending,
437
467
  onLoadImages: canSetImages ? loadImages : undefined,
438
468
  onSetImages: canSetImages
439
469
  ? (params: Parameters<typeof setWorkloadImagesMutation.mutateAsync>[0]) =>
@@ -592,6 +622,12 @@ export function WorkloadView({
592
622
  } = useResourceWithRelationships<any>(apiKind, namespace, name, rest.group)
593
623
  const resource = resourceResponse?.resource
594
624
  const relationships = resourceResponse?.relationships
625
+ useRefreshRevisionsOnNewRollout(
626
+ apiKind.toLowerCase(),
627
+ namespace,
628
+ name,
629
+ resource ? resource.metadata?.annotations?.['deployment.kubernetes.io/revision'] ?? '' : undefined,
630
+ )
595
631
  const resourceGroup = useMemo(
596
632
  () => (resource?.apiVersion ? apiVersionToGroup(resource.apiVersion) : undefined),
597
633
  [resource?.apiVersion],
@@ -602,6 +638,14 @@ export function WorkloadView({
602
638
  // of itself. Fall back to the group derived from the fetched resource, then
603
639
  // to undefined (which the gate treats as "group unknown → allow").
604
640
  const effectiveGroup = rest.group || resourceGroup || undefined
641
+ // The fetched resource's own group, once it has loaded: the route's group is
642
+ // '' whenever a link left ?apiGroup out.
643
+ const identityGroup = resource?.apiVersion ? resourceGroup : effectiveGroup
644
+ const isNode = apiKind === 'nodes' && !effectiveGroup
645
+ const isSubstrateWorkerPool = apiKind === 'workerpools' && effectiveGroup === SUBSTRATE_GROUP
646
+ // Substrate's node charts are asked of Prometheus only on a cluster that serves it.
647
+ const { data: apiResources } = useAPIResources()
648
+ const servesSubstrate = isNode && apiResources?.some(r => r.group === SUBSTRATE_GROUP && r.name === 'workerpools') === true
605
649
  const batchKind = pluralToKind(apiKind)
606
650
  const batchExecution = supportsBatchExecution(batchKind, apiKind, effectiveGroup, resource?.apiVersion)
607
651
  const batchRunsQuery = useWorkloadRuns(apiKind, namespace, name, expanded && batchExecution, {
@@ -654,6 +698,7 @@ export function WorkloadView({
654
698
  [podWorkloadOwner, podOwnerAppsQuery.data?.applications],
655
699
  )
656
700
  const certificateInfo = resourceResponse?.certificateInfo
701
+ const certificateSigningRequest = resourceResponse?.certificateSigningRequest
657
702
  const hpaDiagnosis = resourceResponse?.hpaDiagnosis
658
703
  const activeImageTargetOwnership = useMemo(
659
704
  () =>
@@ -845,20 +890,27 @@ export function WorkloadView({
845
890
  // the renderer banners. The backend canonicalizes a plural kind via discovery,
846
891
  // so using the normalized API kind resolves direct links and app navigation alike.
847
892
  const isCronJob = apiKind === 'cronjobs' && (!effectiveGroup || effectiveGroup === 'batch')
893
+ const isCoreNode = apiKind === 'nodes' && !effectiveGroup
848
894
  const { support: coverageSupport } = useRadarFeature('resourceIssueCoverage')
849
- const useCronJobCoverage = isCronJob && coverageSupport === 'supported'
895
+ const useReportCoverage = (isCronJob || isCoreNode) && coverageSupport === 'supported'
850
896
  const issueObservation = resource ? JSON.stringify([resource.metadata?.uid, resource.metadata?.resourceVersion]) : undefined
851
897
  const ordinaryIssues = useResourceIssues(apiKind, rest.group, namespace, name,
852
- rest.active !== false && !useCronJobCoverage && !isNotFoundError(resourceError), issueObservation)
853
- const cronJobIssues = useSubjectIssues(useCronJobCoverage ? { kind: 'CronJob', group: 'batch', namespace, name, uid: resource?.metadata?.uid } : null, useCronJobCoverage && Boolean(resource))
854
- const liveIssues = useCronJobCoverage ? cronJobIssues.data?.issues : ordinaryIssues.data
855
- const issuesPending = useCronJobCoverage ? cronJobIssues.isPending : ordinaryIssues.isPending
856
- const schedulingEvidence = cronJobIssues.data?.scheduling_report?.uid === resource?.metadata?.uid ? cronJobIssues.data?.scheduling_report : undefined
857
- const [schedulingTimelineFocus, setSchedulingTimelineFocus] = useState<{ uid: string; id: string }>()
898
+ rest.active !== false && !useReportCoverage && !isNotFoundError(resourceError), issueObservation)
899
+ const subjectIssues = useSubjectIssues(useReportCoverage ? { kind: isCoreNode ? 'Node' : 'CronJob', group: isCoreNode ? '' : 'batch', namespace, name, uid: resource?.metadata?.uid } : null, useReportCoverage && Boolean(resource))
900
+ const liveIssues = useReportCoverage ? subjectIssues.data?.issues : ordinaryIssues.data
901
+ const issuesPending = useReportCoverage ? subjectIssues.isPending : ordinaryIssues.isPending
902
+ const schedulingEvidence = isCronJob && subjectIssues.data?.scheduling_report?.uid === resource?.metadata?.uid ? subjectIssues.data?.scheduling_report : undefined
903
+ const certificateEvidence = isCoreNode && subjectIssues.data?.node_certificate_report?.uid === resource?.metadata?.uid ? subjectIssues.data?.node_certificate_report : undefined
904
+ const hasCertificateIssue = Boolean(liveIssues?.some(issue => issue.kind === 'Node' && issue.reason === 'NodeCertificateExpiry'))
905
+ const [reportTimelineFocus, setReportTimelineFocus] = useState<{ uid: string; id: string }>()
858
906
  const viewSchedulingReport = useCallback(() => {
859
- setSchedulingTimelineFocus(schedulingEvidence?.event_id ? { uid: schedulingEvidence.uid, id: schedulingEvidence.event_id } : undefined)
907
+ setReportTimelineFocus(schedulingEvidence?.event_id ? { uid: schedulingEvidence.uid, id: schedulingEvidence.event_id } : undefined)
860
908
  handleTabChange('timeline')
861
909
  }, [schedulingEvidence, handleTabChange])
910
+ const viewCertificateReport = useCallback(() => {
911
+ setReportTimelineFocus(certificateEvidence?.event_id ? { uid: certificateEvidence.uid, id: certificateEvidence.event_id } : undefined)
912
+ handleTabChange('timeline')
913
+ }, [certificateEvidence, handleTabChange])
862
914
  const { data: auditFindings } = useResourceAudit(apiKind, namespace, name, effectiveGroup)
863
915
  const hasOperationalIssues = Boolean(liveIssues?.length)
864
916
  const openIssueResource = issueResourceOpener(rest.onNavigateToResource)
@@ -1187,6 +1239,7 @@ export function WorkloadView({
1187
1239
  ownershipContext={ownershipContext}
1188
1240
  onOpenApplication={handleOpenApplication}
1189
1241
  certificateInfo={certificateInfo}
1242
+ certificateSigningRequest={certificateSigningRequest}
1190
1243
  hpaDiagnosis={hpaDiagnosis}
1191
1244
  workloadPods={supportsWorkloadPods ? workloadPodsQuery.data?.pods : undefined}
1192
1245
  onEvaluateCapacity={
@@ -1207,7 +1260,7 @@ export function WorkloadView({
1207
1260
  refetch={refetchResourceAndRuns}
1208
1261
  // Timeline
1209
1262
  allEvents={allEvents}
1210
- timelineFocusEvent={schedulingTimelineFocus?.uid === resource?.metadata?.uid ? schedulingTimelineFocus : undefined}
1263
+ timelineFocusEvent={reportTimelineFocus?.uid === resource?.metadata?.uid ? reportTimelineFocus : undefined}
1211
1264
  historyTruncated={!historyFallback && historyTruncated}
1212
1265
  onLoadOlderHistory={historyFallback ? undefined : loadOlderHistory}
1213
1266
  loadingOlderHistory={!historyFallback && loadingOlderHistory}
@@ -1251,7 +1304,7 @@ export function WorkloadView({
1251
1304
  viewNamespaces={viewNamespaces}
1252
1305
  />
1253
1306
  )}
1254
- {...resourceDetailSlots({ kind: apiKind, group: resource?.apiVersion ? resourceGroup : effectiveGroup, namespace, name }, rest.extraTabs)}
1307
+ {...resourceDetailSlots({ kind: apiKind, group: identityGroup, namespace, name }, rest.extraTabs)}
1255
1308
  onSelectTopologyMember={batchExecution && batchKind === 'JobSet' ? handleSelectTopologyMember : undefined}
1256
1309
  renderExpandedOverview={({ kind: k, apiKind, namespace: ns, name: n, resource: res, leadContent }) =>
1257
1310
  supportsBatchExecution(k, apiKind, effectiveGroup, res?.apiVersion) &&
@@ -1276,14 +1329,25 @@ export function WorkloadView({
1276
1329
  renderRelatedYaml={(ref) => (
1277
1330
  <RelatedResourceYaml key={`${ref.kind}/${ref.namespace}/${ref.name}`} target={ref} />
1278
1331
  )}
1279
- renderMetricsTab={({ kind, namespace: ns, name: n }) => (
1280
- <MetricsTabContent
1281
- kind={kind}
1282
- namespace={ns}
1283
- name={n}
1284
- resource={resource}
1285
- expanded={expanded}
1332
+ renderMetricsTab={({ kind, namespace: ns, name: n }) => isSubstrateWorkerPool ? (
1333
+ <SubstrateHealthCharts
1334
+ target={{ kind: 'workerpool', namespace: ns, name: n }}
1335
+ standalone
1336
+ collapsible={!expanded}
1337
+ workerPods={typeof resource?.status?.replicas === 'number' ? resource.status.replicas : undefined}
1286
1338
  />
1339
+ ) : (
1340
+ <>
1341
+ <MetricsTabContent
1342
+ kind={kind}
1343
+ namespace={ns}
1344
+ name={n}
1345
+ resource={resource}
1346
+ expanded={expanded}
1347
+ fill={!(isNode && servesSubstrate)}
1348
+ />
1349
+ {isNode && servesSubstrate && <div className="pt-4"><SubstrateHealthCharts target={{ kind: 'node', name: n }} collapsible={!expanded} /></div>}
1350
+ </>
1287
1351
  )}
1288
1352
  renderCostTab={({ kind, namespace: ns, name: n }) => (
1289
1353
  <div className="space-y-4">
@@ -1313,16 +1377,23 @@ export function WorkloadView({
1313
1377
  />
1314
1378
  )}
1315
1379
  isMetricsAvailable={(kind, res) =>
1316
- isPrometheusSupported(kind) && !(kind === 'Pod' && res?.status?.phase === 'Pending')
1380
+ isSubstrateWorkerPool || (isPrometheusSupported(kind) && !(kind === 'Pod' && res?.status?.phase === 'Pending'))
1317
1381
  }
1318
1382
  isCostAvailable={(kind) => isOpenCostWorkloadKind(kind)}
1319
1383
  onDuplicate={handleDuplicate}
1320
1384
  onDownload={desktopDownload}
1321
1385
  actionsBarProps={actionsBarProps}
1322
1386
  rendererOverrides={resourceRendererOverrides}
1323
- renderOverviewIntro={apiKind === 'nodes' && !effectiveGroup && resource?.metadata?.uid
1324
- ? () => <NodeDrainStatus name={name} nodeUID={resource.metadata.uid} />
1325
- : undefined}
1387
+ renderOverviewIntro={isSubstrateWorkerPool
1388
+ ? ({ namespace: ns, name: n }) => <SubstrateVerdictLine target={{ kind: 'workerpool', namespace: ns, name: n }} onOpenMetrics={expanded ? () => handleTabChange('metrics') : undefined} />
1389
+ : isNode && resource?.metadata?.uid
1390
+ ? () => (
1391
+ <div className="space-y-3">
1392
+ <NodeDrainStatus name={name} nodeUID={resource.metadata.uid} />
1393
+ {servesSubstrate && <SubstrateVerdictLine target={{ kind: 'node', name }} onOpenMetrics={expanded ? () => handleTabChange('metrics') : undefined} />}
1394
+ </div>
1395
+ )
1396
+ : undefined}
1326
1397
  renderOverviewExtra={({ kind: k, namespace: ns, name: n, group: g, context }) => {
1327
1398
  // Network entry kinds (Service/Ingress/Route/Gateway) ARE the diagnosis
1328
1399
  // target: DiagnoseInlineSection renders in the drawer, no hint. Workload
@@ -1355,16 +1426,21 @@ export function WorkloadView({
1355
1426
  renderOverviewLead={() => (
1356
1427
  <div className="flex flex-col gap-4">
1357
1428
  <CronJobSchedulingContext evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} />
1429
+ <NodeCertificateContext evidence={certificateEvidence} hasIssue={hasCertificateIssue} onViewTimeline={viewCertificateReport} />
1358
1430
  <ResourceIssuesSection
1359
1431
  issues={liveIssues}
1360
- renderDetailSection={schedulingEvidence?.state === 'reported' ? ({ issue }) => issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason ? <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} /> : null : undefined}
1432
+ renderDetailSection={({ issue }) => {
1433
+ if (schedulingEvidence?.state === 'reported' && issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason) return <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} />
1434
+ if (certificateEvidence && issue.kind === 'Node' && issue.reason === 'NodeCertificateExpiry') return <NodeCertificateDetails evidence={certificateEvidence} onViewTimeline={viewCertificateReport} includeOriginalReport={false} />
1435
+ return resourceIssueDetail({ kind: apiKind, group: resource?.apiVersion ? resourceGroup : effectiveGroup, namespace, name }, { issue, resource })
1436
+ }}
1361
1437
  compact={!expanded}
1362
- subjectResource={{ kind: apiKind, namespace, name, group: rest.group }}
1438
+ subjectResource={{ kind: apiKind, namespace, name, group: identityGroup }}
1363
1439
  onResourceClick={openIssueResource}
1364
1440
  />
1365
1441
  </div>
1366
1442
  )}
1367
- hasOverviewLead={hasOperationalIssues || Boolean(schedulingEvidence && schedulingEvidence.state !== 'reported')}
1443
+ hasOverviewLead={hasOperationalIssues || Boolean(schedulingEvidence && schedulingEvidence.state !== 'reported') || nodeCertificateContextVisible(certificateEvidence, hasCertificateIssue)}
1368
1444
  hasOperationalIssues={hasOperationalIssues}
1369
1445
  operationalIssuesPending={issuesPending}
1370
1446
  // A manager answer's chip links only managers the server found; a
@@ -1647,12 +1723,8 @@ function PodLogsTab({
1647
1723
  initialContainer?: string | null
1648
1724
  onConsumeInitialContainer?: () => void
1649
1725
  }) {
1650
- const containers = useMemo(() => {
1651
- const names: string[] = []
1652
- for (const c of resource?.spec?.initContainers || []) if (c.name) names.push(c.name)
1653
- for (const c of resource?.spec?.containers || []) if (c.name) names.push(c.name)
1654
- return names
1655
- }, [resource])
1726
+ const containers = useMemo(() => getLogContainerNames(resource), [resource])
1727
+ const initContainers = useMemo(() => getInitContainerNames(resource), [resource])
1656
1728
 
1657
1729
  // A terminated pod has nothing to follow — only stream live ones. Wait for
1658
1730
  // the phase to be known so a completed pod isn't briefly streamed while the
@@ -1672,7 +1744,8 @@ function PodLogsTab({
1672
1744
  namespace={namespace}
1673
1745
  podName={name}
1674
1746
  containers={containers}
1675
- initialContainer={initialContainer || undefined}
1747
+ initialContainer={initialContainer || getDefaultLogContainerName(resource)}
1748
+ initContainers={initContainers}
1676
1749
  autoStream={autoStream}
1677
1750
  />
1678
1751
  </div>
@@ -2188,14 +2261,18 @@ function MetricsTabContent({
2188
2261
  name,
2189
2262
  resource,
2190
2263
  expanded,
2264
+ fill = true,
2191
2265
  }: {
2192
2266
  kind: string
2193
2267
  namespace: string
2194
2268
  name: string
2195
2269
  resource: any
2196
2270
  expanded: boolean
2271
+ /** False when content follows, so the tab scrolls everything as one. */
2272
+ fill?: boolean
2197
2273
  }) {
2198
2274
  if (expanded) {
2275
+ if (!fill) return <PrometheusChartsGrid kind={kind} namespace={namespace} name={name} resource={resource} fill={false} />
2199
2276
  return (
2200
2277
  <div className="flex flex-col h-full">
2201
2278
  <div className="flex-1 min-h-0">
@@ -0,0 +1,32 @@
1
+ import { useLocation, useSearchParams } from 'react-router-dom'
2
+ import { ArrowLeft } from 'lucide-react'
3
+ import type { SelectedResource } from '../../types'
4
+ import { decodeDrawerTrail, encodeDrawerTrail, sameSelectedResource } from '../../utils/drawer-trail'
5
+
6
+ /**
7
+ * On a workspace screen the drawer URL carries the chain of objects opened
8
+ * from inside the drawer. This is the step back to the previous one, shown for
9
+ * whatever kind is open. `kindLabel` names the previous object's kind from its
10
+ * plural; unnamed plurals show as they are.
11
+ */
12
+ export function DrawerTrailBack({ resource, pathPrefix, kindLabel }: { resource: SelectedResource; pathPrefix: string; kindLabel: (plural: string) => string | undefined }) {
13
+ const location = useLocation()
14
+ const [searchParams, setSearchParams] = useSearchParams()
15
+ if (location.pathname !== pathPrefix && !location.pathname.startsWith(`${pathPrefix}/`)) return null
16
+ const trail = decodeDrawerTrail(searchParams.get('drawer'))
17
+ if (trail.length < 2 || !sameSelectedResource(trail[trail.length - 1], resource)) return null
18
+ const prev = trail[trail.length - 2]
19
+ const back = () => {
20
+ const params = new URLSearchParams(searchParams)
21
+ params.set('drawer', encodeDrawerTrail(trail.slice(0, -1)))
22
+ setSearchParams(params, { replace: true, state: location.state })
23
+ }
24
+ return (
25
+ <div className="shrink-0 border-b border-theme-border px-4 py-2">
26
+ <button type="button" onClick={back} className="inline-flex items-center gap-1 text-xs font-medium text-accent-text hover:underline">
27
+ <ArrowLeft className="h-3.5 w-3.5" />
28
+ {kindLabel(prev.kind) ?? prev.kind} {prev.name}
29
+ </button>
30
+ </div>
31
+ )
32
+ }
@@ -0,0 +1,71 @@
1
+ import { useCallback, useEffect, useState, type ReactNode } from 'react'
2
+ import { useLocation } from 'react-router-dom'
3
+ import { DialogPortal, ResourcesSidebar, type SelectedKindInfo, type SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
4
+ import { PanelLeft, X } from 'lucide-react'
5
+ import { useAPIResources } from '../../api/apiResources'
6
+ import { usePinnedKinds } from '../../hooks/useFavorites'
7
+ import { useResourceCounts } from '../../hooks/useResourceCounts'
8
+ import { useWorkspaceNavigate } from './useWorkspaceNavigate'
9
+
10
+ /**
11
+ * A workspace inside Resources: the same Resources sidebar, with the
12
+ * workspaces' destinations above their exact kinds, and the screen beside it.
13
+ * On narrow windows the sidebar moves into a dialog behind a button.
14
+ */
15
+ export function WorkspaceFrame({
16
+ namespaces,
17
+ categoryWorkspaces,
18
+ selectedKind = null,
19
+ compactNavigation,
20
+ children,
21
+ }: {
22
+ namespaces: string[]
23
+ categoryWorkspaces: Record<string, SidebarCategoryWorkspace> | undefined
24
+ /** The kind whose row is highlighted, when the screen is one object of it rather than a destination. */
25
+ selectedKind?: SelectedKindInfo | null
26
+ compactNavigation: boolean
27
+ children: ReactNode
28
+ }) {
29
+ const location = useLocation()
30
+ const navigate = useWorkspaceNavigate()
31
+ const [navigationOpen, setNavigationOpen] = useState(false)
32
+ useEffect(() => setNavigationOpen(false), [location.pathname, location.search, compactNavigation])
33
+ const { data: apiResources } = useAPIResources()
34
+ const { data: counts } = useResourceCounts(namespaces)
35
+ const { pinned, togglePin, isPinned } = usePinnedKinds()
36
+
37
+ const selectKind = useCallback(
38
+ (kind: SelectedKindInfo) => {
39
+ navigate(`/resources/${kind.name}${kind.group ? `?apiGroup=${encodeURIComponent(kind.group)}` : ''}`)
40
+ },
41
+ [navigate],
42
+ )
43
+
44
+ const sidebar = <ResourcesSidebar
45
+ selectedKind={selectedKind}
46
+ onSelectedKindChange={selectKind}
47
+ apiResources={apiResources}
48
+ resourceCounts={counts?.counts}
49
+ resourceCoverage={counts?.coverage}
50
+ resourceForbidden={counts?.forbidden}
51
+ resourceUnavailable={counts?.unavailable}
52
+ pinned={pinned}
53
+ togglePin={togglePin}
54
+ isPinned={(kind: string, group?: string) => isPinned(kind, group ?? '')}
55
+ categoryWorkspaces={categoryWorkspaces}
56
+ className={compactNavigation ? '!w-full !border-r-0' : undefined}
57
+ />
58
+ return (
59
+ <div className="flex h-full min-h-0 w-full">
60
+ {!compactNavigation && sidebar}
61
+ <DialogPortal open={navigationOpen && compactNavigation} onClose={() => setNavigationOpen(false)} ariaLabel="Resource navigation" className="flex h-[min(80vh,44rem)] w-full max-w-md flex-col overflow-hidden">
62
+ <div className="flex items-center justify-between border-b border-theme-border px-4 py-3"><h2 className="font-medium text-theme-text-primary">Resources</h2><button type="button" aria-label="Close resource navigation" onClick={() => setNavigationOpen(false)} className="rounded p-1 text-theme-text-secondary hover:bg-theme-hover"><X className="h-4 w-4" /></button></div>
63
+ <div className="flex min-h-0 flex-1">{sidebar}</div>
64
+ </DialogPortal>
65
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col bg-theme-base">
66
+ {compactNavigation && <div className="border-b border-theme-border px-5 py-2"><button type="button" aria-haspopup="dialog" aria-expanded={navigationOpen} onClick={() => setNavigationOpen(true)} className="btn-secondary inline-flex items-center gap-1.5 px-2.5 py-1 text-xs"><PanelLeft className="h-3.5 w-3.5" />Resources</button></div>}
67
+ {children}
68
+ </div>
69
+ </div>
70
+ )
71
+ }
@@ -0,0 +1,61 @@
1
+ // How much of one kind a workspace read, worded for people. The shape is
2
+ // integration.KindCoverage, which every workspace endpoint serves per kind.
3
+
4
+ export interface WorkspaceKindCoverage {
5
+ state: string
6
+ deniedNamespaces?: string[]
7
+ uncachedNamespaces?: string[]
8
+ allowedNamespaces?: string[]
9
+ }
10
+
11
+ const COVERAGE_LABEL: Record<string, string> = {
12
+ denied: 'no access',
13
+ partial: 'not read in some namespaces',
14
+ uncached: 'not cached by Radar',
15
+ syncing: 'still loading',
16
+ error: 'could not be read',
17
+ }
18
+
19
+ /** Coverage states that leave some of a kind unread. */
20
+ export const INCOMPLETE_COVERAGE_STATES = new Set(['partial', 'denied', 'syncing', 'error', 'uncached'])
21
+
22
+ // The causes the server named for the namespaces it left unread. A partial or
23
+ // uncached read can name both kinds of namespace at once.
24
+ function namedCauses(cov: WorkspaceKindCoverage | undefined, uncachedNoun: string): { denied?: string; uncached?: string } {
25
+ return {
26
+ denied: cov?.deniedNamespaces?.length ? cov.deniedNamespaces.join(', ') : undefined,
27
+ uncached: cov?.uncachedNamespaces?.length ? `${uncachedNoun} in ${cov.uncachedNamespaces.join(', ')}` : undefined,
28
+ }
29
+ }
30
+
31
+ /** How much of a kind was read, in a few words ("not cached by Radar in pg"). */
32
+ export function coverageLabel(cov: WorkspaceKindCoverage | undefined): string {
33
+ if (!cov) return 'not read by this Radar'
34
+ const { denied, uncached } = namedCauses(cov, 'not cached by Radar')
35
+ const named = [denied && `no access in ${denied}`, uncached].filter(Boolean)
36
+ if (named.length > 0) return named.join('; ')
37
+ return COVERAGE_LABEL[cov?.state ?? ''] ?? cov?.state ?? 'unknown'
38
+ }
39
+
40
+ /** Empty-state text for a collection, derived from how much of it was readable. */
41
+ export function coverageEmpty(cov: WorkspaceKindCoverage | undefined, noun: string): string {
42
+ switch (cov?.state) {
43
+ case 'full':
44
+ return `No ${noun} in this scope.`
45
+ case 'partial':
46
+ case 'uncached': {
47
+ const { denied, uncached } = namedCauses(cov, `Radar does not cache ${noun}`)
48
+ const causes = [denied && `no access in ${denied}`, uncached].filter(Boolean)
49
+ if (causes.length > 0) return `No ${noun} visible: ${causes.join('; ')}.`
50
+ return cov.state === 'uncached' ? `Radar does not cache ${noun} in this scope.` : `No ${noun} visible. Some namespaces were not read.`
51
+ }
52
+ case 'denied':
53
+ return `No access to ${noun}.`
54
+ case 'syncing':
55
+ return `${noun[0].toUpperCase()}${noun.slice(1)} are still loading.`
56
+ case 'error':
57
+ return `${noun[0].toUpperCase()}${noun.slice(1)} could not be read.`
58
+ default:
59
+ return `This kind is not installed.`
60
+ }
61
+ }
@@ -2,7 +2,7 @@
2
2
  import { act } from 'react'
3
3
  import { createRoot } from 'react-dom/client'
4
4
  import { expect, it, vi } from 'vitest'
5
- import { Mono } from './layout'
5
+ import { Mono, SectionTable } from './layout'
6
6
 
7
7
  ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
8
8
 
@@ -27,3 +27,31 @@ it('uses normal word boundaries with overflow wrapping and keeps the complete va
27
27
  host.remove()
28
28
  vi.useRealTimers()
29
29
  })
30
+
31
+ it('opens a row from the keyboard the way a click does, and leaves keys on controls inside it alone', () => {
32
+ const host = document.createElement('div')
33
+ document.body.append(host)
34
+ const root = createRoot(host)
35
+ const onInspect = vi.fn()
36
+ const inner = vi.fn()
37
+ act(() => root.render(
38
+ <SectionTable
39
+ title="Things"
40
+ columns={[{ header: 'Name', cell: (r: { name: string }) => <button type="button" onClick={inner}>{r.name}</button> }]}
41
+ rows={[{ name: 'a' }]}
42
+ rowKey={(r) => r.name}
43
+ rowResource={(r) => ({ kind: 'Schedule', group: 'velero.io', namespace: 'velero', name: r.name })}
44
+ onInspect={onInspect}
45
+ inspected={null}
46
+ empty="none"
47
+ />,
48
+ ))
49
+ const row = host.querySelector('tbody tr') as HTMLTableRowElement
50
+ expect(row.tabIndex).toBe(0)
51
+ act(() => row.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })))
52
+ expect(onInspect).toHaveBeenCalledTimes(1)
53
+ act(() => host.querySelector('tbody button')!.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })))
54
+ expect(onInspect).toHaveBeenCalledTimes(1)
55
+ act(() => root.unmount())
56
+ host.remove()
57
+ })
@@ -78,7 +78,7 @@ export function Segments<T extends string>({
78
78
  label,
79
79
  }: {
80
80
  value: T
81
- options: { id: T; label: string; count?: number | string }[]
81
+ options: { id: T; label: string; count?: ReactNode }[]
82
82
  onChange: (id: T) => void
83
83
  label: string
84
84
  }) {
@@ -128,7 +128,8 @@ export function SectionTable<T>({
128
128
  minWidth = 760,
129
129
  footer,
130
130
  }: {
131
- title: ReactNode
131
+ /** Left out where the page heading already names the table. */
132
+ title?: ReactNode
132
133
  subtitle?: ReactNode
133
134
  columns: TableColumn<T>[]
134
135
  rows: T[]
@@ -143,7 +144,7 @@ export function SectionTable<T>({
143
144
  return (
144
145
  <section>
145
146
  <div className="mb-2 flex flex-wrap items-baseline gap-x-2.5 gap-y-1">
146
- <h2 className="text-sm font-semibold text-theme-text-primary">{title}</h2>
147
+ {title && <h2 className="text-sm font-semibold text-theme-text-primary">{title}</h2>}
147
148
  {subtitle && <span className="text-xs text-theme-text-tertiary">{subtitle}</span>}
148
149
  </div>
149
150
  <div className="overflow-hidden rounded-xl border border-theme-border bg-theme-surface shadow-theme-sm">
@@ -168,11 +169,20 @@ export function SectionTable<T>({
168
169
  {rows.map((row) => {
169
170
  const res = rowResource?.(row) ?? null
170
171
  const active = !!res && sameSelectedResource(inspected, res)
172
+ const open = res && onInspect ? () => onInspect(res) : undefined
171
173
  return (
172
174
  <tr
173
175
  key={rowKey(row)}
174
- onClick={res && onInspect ? () => onInspect(res) : undefined}
175
- className={clsx(res && onInspect && 'cursor-pointer', ROW_HOVER, active && 'selection')}
176
+ onClick={open}
177
+ // Keyboard users open a row the way a click does; keys on a
178
+ // control inside the row stay that control's.
179
+ tabIndex={open ? 0 : undefined}
180
+ onKeyDown={open ? (e) => {
181
+ if (e.target !== e.currentTarget || (e.key !== 'Enter' && e.key !== ' ')) return
182
+ e.preventDefault()
183
+ open()
184
+ } : undefined}
185
+ className={clsx(open && 'cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent', ROW_HOVER, active && 'selection')}
176
186
  aria-selected={res ? active : undefined}
177
187
  >
178
188
  {columns.map((c, i) => (
@@ -0,0 +1,9 @@
1
+ import { useMemo } from 'react'
2
+ import type { SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
3
+
4
+ type Workspaces = Record<string, SidebarCategoryWorkspace>
5
+
6
+ /** Two integrations' sidebar workspaces as one map; undefined when neither applies. */
7
+ export function useMergedSidebarWorkspaces(a: Workspaces | undefined, b: Workspaces | undefined): Workspaces | undefined {
8
+ return useMemo(() => (a || b ? { ...a, ...b } : undefined), [a, b])
9
+ }