@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
@@ -66,13 +66,16 @@ describe('manual Desktop version checks', () => {
66
66
  expect(container.textContent).toContain('Radar 1.2.3')
67
67
  })
68
68
 
69
- it('publishes a fresh available update and clears its dismissal', () => {
69
+ it('publishes a fresh available update, clears its dismissal and leaves the announcement to the card', () => {
70
70
  localStorage.setItem('radar-update-dismissed', '1.3.0')
71
71
  const info = { ...current, updateAvailable: true, latestVersion: '1.3.0' }
72
+ act(() => { window.dispatchEvent(new Event('radar:check-for-updates')) })
72
73
  act(() => { window.dispatchEvent(new CustomEvent('radar:update-check-result', { detail: info })) })
73
74
  expect(client.getQueryData(['version-check', '/desktop/api'])).toEqual(info)
74
75
  expect(localStorage.getItem('radar-update-dismissed')).toBeNull()
75
- expect(container.textContent).toContain('Radar 1.3.0 is available')
76
+ act(() => { vi.advanceTimersByTime(DURATION_TOAST_EXIT) })
77
+ // The card shares the toast's corner; a toast saying the same would cover it.
78
+ expect(container.querySelector('[role="status"]')).toBeNull()
76
79
  })
77
80
 
78
81
  it('reports failure without replacing known version data', () => {
@@ -3,6 +3,9 @@ import { renderToString } from 'react-dom/server'
3
3
  import { beforeEach, describe, expect, it, vi } from 'vitest'
4
4
 
5
5
  let deploymentMode = 'local'
6
+ let installMethod = 'direct'
7
+ let manualUpdate: 'appimage' | 'package' | 'download' | undefined
8
+ let applied = false
6
9
 
7
10
  vi.mock('../../api/client', () => ({
8
11
  useCapabilities: () => ({ data: { deployment: { mode: deploymentMode } } }),
@@ -11,7 +14,8 @@ vi.mock('../../api/client', () => ({
11
14
  currentVersion: '1.2.3',
12
15
  latestVersion: '1.3.0',
13
16
  updateAvailable: true,
14
- installMethod: 'direct',
17
+ installMethod,
18
+ manualUpdate,
15
19
  releaseUrl: 'https://github.com/skyhook-io/radar/releases/tag/v1.3.0',
16
20
  // Off, so the Product Hunt launch day doesn't take the corner whatever today is.
17
21
  productHuntLaunch: { enabled: false, url: '', start: '0001-01-01T00:00:00Z', end: '0001-01-01T00:00:00Z' },
@@ -19,10 +23,11 @@ vi.mock('../../api/client', () => ({
19
23
  }),
20
24
  useStartDesktopUpdate: () => ({ mutate: vi.fn(), isPending: false }),
21
25
  useDesktopUpdateStatus: () => ({ data: undefined }),
22
- useApplyDesktopUpdate: () => ({ mutate: vi.fn() }),
26
+ useApplyDesktopUpdate: () => ({ mutate: vi.fn(), isPending: false, isSuccess: applied }),
23
27
  }))
24
28
 
25
- import { UpdateNotification } from './UpdateNotification'
29
+ import { UpdateNotification, manualCheckToast } from './UpdateNotification'
30
+ import type { VersionInfo } from '../../api/client'
26
31
  import { ToastProvider } from './Toast'
27
32
 
28
33
  function renderNotification() {
@@ -37,6 +42,9 @@ function renderNotification() {
37
42
  describe('UpdateNotification', () => {
38
43
  beforeEach(() => {
39
44
  deploymentMode = 'local'
45
+ installMethod = 'direct'
46
+ manualUpdate = undefined
47
+ applied = false
40
48
  })
41
49
 
42
50
  it('keeps the update popup for local installations', () => {
@@ -45,8 +53,51 @@ describe('UpdateNotification', () => {
45
53
  expect(html).toContain('1.3.0')
46
54
  })
47
55
 
56
+ it('offers the in-app update to desktop installs that can replace themselves', () => {
57
+ installMethod = 'desktop'
58
+ const html = renderNotification()
59
+ // The in-app update button plus the dismiss button.
60
+ expect(html.match(/<button/g)).toHaveLength(2)
61
+ expect(html).not.toContain('href="https://github.com/skyhook-io/radar/releases/tag/v1.3.0"')
62
+ })
63
+
64
+ it.each(['appimage', 'package', 'download'] as const)('links %s desktop installs to the release instead of updating in place', how => {
65
+ installMethod = 'desktop'
66
+ manualUpdate = how
67
+ const html = renderNotification()
68
+ expect(html).toContain('href="https://github.com/skyhook-io/radar/releases/tag/v1.3.0"')
69
+ // Only the dismiss button: no in-app update.
70
+ expect(html.match(/<button/g)).toHaveLength(1)
71
+ })
72
+
73
+ it('keeps showing the restart once the new version is in place', () => {
74
+ installMethod = 'desktop'
75
+ applied = true
76
+ const html = renderNotification()
77
+ expect(html).toContain('Applying Update...')
78
+ expect(html).not.toContain('Update Available')
79
+ })
80
+
48
81
  it('suppresses the update popup for shared in-cluster viewers', () => {
49
82
  deploymentMode = 'in-cluster'
50
83
  expect(renderNotification()).toBe('')
51
84
  })
52
85
  })
86
+
87
+ describe('manualCheckToast', () => {
88
+ const info = (over: Partial<VersionInfo>) => ({ currentVersion: '1.2.3', latestVersion: '1.3.0', updateAvailable: false, ...over }) as VersionInfo
89
+
90
+ it('leaves a found update to the card, which shares its corner', () => {
91
+ expect(manualCheckToast(info({ updateAvailable: true }), true)).toBeNull()
92
+ })
93
+
94
+ it('announces a found update when the card is held back', () => {
95
+ expect(manualCheckToast(info({ updateAvailable: true }), false)?.message).toBe('Radar 1.3.0 is available')
96
+ })
97
+
98
+ it('still answers when there is nothing to update to, or the check failed', () => {
99
+ expect(manualCheckToast(info({}), true)?.message).toBe("You're up to date")
100
+ expect(manualCheckToast(info({ buildChannel: 'development' }), true)?.message).toBe('Latest Radar release: 1.3.0')
101
+ expect(manualCheckToast(info({ error: 'offline' }), true)).toMatchObject({ type: 'error', detail: 'offline' })
102
+ })
103
+ })
@@ -32,6 +32,20 @@ export function isUpdateDismissed(latestVersion: string): boolean {
32
32
  }
33
33
  }
34
34
 
35
+ type ManualCheckToast = { message: string; type: 'info' | 'success' | 'error'; detail?: string }
36
+
37
+ // The answer to Help → Check for Updates. A found update is announced by the
38
+ // update card, which shares the toast's corner, so the toast only says so when
39
+ // something else holds that corner and the card waits.
40
+ export function manualCheckToast(info: VersionInfo, cardShows: boolean): ManualCheckToast | null {
41
+ if (info.error) return { message: 'Could not check for updates', type: 'error', detail: info.error }
42
+ if (info.updateAvailable) return cardShows ? null : { message: `Radar ${info.latestVersion} is available`, type: 'info' }
43
+ if (info.buildChannel === 'development') {
44
+ return { message: `Latest Radar release: ${info.latestVersion}`, type: 'info', detail: 'You are running a development build.' }
45
+ }
46
+ return { message: "You're up to date", type: 'success', detail: `Radar ${info.currentVersion}` }
47
+ }
48
+
35
49
  export function UpdateNotification({ placement = 'floating' }: { placement?: 'floating' | 'settings' }) {
36
50
  const inSettings = placement === 'settings'
37
51
  const [expanded, setExpanded] = useState(false)
@@ -39,7 +53,7 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
39
53
  const triggerRef = useRef<HTMLButtonElement>(null)
40
54
  const panelId = useId()
41
55
  const queryClient = useQueryClient()
42
- const { showToast } = useToast()
56
+ const { showToast, dismissToast } = useToast()
43
57
  const { data: capabilities } = useCapabilities()
44
58
  const deploymentMode = capabilities ? (capabilities.deployment?.mode ?? 'local') : undefined
45
59
  const { data: versionInfo } = useVersionCheck()
@@ -52,7 +66,8 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
52
66
  const startUpdate = useStartDesktopUpdate()
53
67
  const applyUpdate = useApplyDesktopUpdate()
54
68
  const isDesktop = versionInfo?.installMethod === 'desktop'
55
- const { data: updateStatus } = useDesktopUpdateStatus(desktopUpdating || (inSettings && expanded && isDesktop))
69
+ const desktopSelfUpdate = isDesktop && !versionInfo?.manualUpdate
70
+ const { data: updateStatus } = useDesktopUpdateStatus(desktopUpdating || (inSettings && expanded && desktopSelfUpdate))
56
71
 
57
72
  useEffect(() => {
58
73
  if (!expanded) return
@@ -71,21 +86,15 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
71
86
  }
72
87
  const resultHandler = (event: Event) => {
73
88
  const info = (event as CustomEvent<VersionInfo>).detail
74
- if (info.error) {
75
- showToast('Could not check for updates', { id, type: 'error', detail: info.error })
76
- return
77
- }
78
- void queryClient.cancelQueries({ queryKey: ['version-check', getApiBase()], exact: true })
79
- setDismissed(false)
80
- try { localStorage.removeItem(DISMISSED_KEY) } catch { /* ignore */ }
81
- queryClient.setQueryData(['version-check', getApiBase()], info)
82
- if (info.updateAvailable) {
83
- showToast(`Radar ${info.latestVersion} is available`, { id, type: 'info' })
84
- } else if (info.buildChannel === 'development') {
85
- showToast(`Latest Radar release: ${info.latestVersion}`, { id, type: 'info', detail: 'You are running a development build.' })
86
- } else {
87
- showToast("You're up to date", { id, type: 'success', detail: `Radar ${info.currentVersion}` })
89
+ if (!info.error) {
90
+ void queryClient.cancelQueries({ queryKey: ['version-check', getApiBase()], exact: true })
91
+ setDismissed(false)
92
+ try { localStorage.removeItem(DISMISSED_KEY) } catch { /* ignore */ }
93
+ queryClient.setQueryData(['version-check', getApiBase()], info)
88
94
  }
95
+ const toast = manualCheckToast(info, cardCanShowRef.current)
96
+ if (toast) showToast(toast.message, { id, type: toast.type, detail: toast.detail })
97
+ else dismissToast(id)
89
98
  }
90
99
 
91
100
  window.addEventListener('radar:check-for-updates', handler)
@@ -94,7 +103,7 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
94
103
  window.removeEventListener('radar:check-for-updates', handler)
95
104
  window.removeEventListener('radar:update-check-result', resultHandler)
96
105
  }
97
- }, [queryClient, inSettings, showToast])
106
+ }, [queryClient, inSettings, showToast, dismissToast])
98
107
 
99
108
  // Runs until the launch window is over, so a notice already on screen when
100
109
  // the launch day starts steps aside too.
@@ -135,6 +144,12 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
135
144
  return () => window.removeEventListener(USAGE_PROMPT_VISIBILITY_EVENT, onUsagePrompt)
136
145
  }, [inSettings])
137
146
 
147
+ // Whether a found update would show the card now; read by the manual
148
+ // check's result, which clears the card's dismissal first.
149
+ const cardCanShow = deploymentMode !== undefined && deploymentMode !== 'cloud' && deploymentMode !== 'in-cluster' && !launchHoldsCorner && !usagePromptShowing
150
+ const cardCanShowRef = useRef(cardCanShow)
151
+ useEffect(() => { cardCanShowRef.current = cardCanShow }, [cardCanShow])
152
+
138
153
  // Stop polling when update reaches a terminal state
139
154
  useEffect(() => {
140
155
  if (updateStatus?.state === 'error' || updateStatus?.state === 'idle') {
@@ -185,7 +200,10 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
185
200
  }
186
201
 
187
202
  // Determine what the current effective state is
188
- const effectiveState: DesktopUpdateState = updateStatus?.state ?? 'idle'
203
+ // The updater is idle again once the new version is in place, before Radar
204
+ // restarts; the card keeps showing the restart rather than offering the
205
+ // update again.
206
+ const effectiveState: DesktopUpdateState = applyUpdate.isPending || applyUpdate.isSuccess ? 'applying' : updateStatus?.state ?? 'idle'
189
207
 
190
208
  const panel = shouldRender && (
191
209
  <div
@@ -213,8 +231,25 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
213
231
  {!inSettings && <>You're on {versionInfo.currentVersion}.</>}
214
232
  </p>
215
233
 
234
+ {/* Desktop that cannot replace itself: how to update, and the download */}
235
+ {isDesktop && versionInfo.manualUpdate && versionInfo.releaseUrl && (
236
+ <>
237
+ <p className="text-xs text-theme-text-secondary mt-1">
238
+ {MANUAL_UPDATE_TEXT[versionInfo.manualUpdate]}
239
+ </p>
240
+ <a
241
+ href={versionInfo.releaseUrl}
242
+ target="_blank"
243
+ rel="noopener noreferrer"
244
+ className="inline-flex items-center gap-1 mt-2 text-xs font-medium text-accent-text hover:underline"
245
+ >
246
+ Download from GitHub →
247
+ </a>
248
+ </>
249
+ )}
250
+
216
251
  {/* Desktop: in-app update flow */}
217
- {isDesktop && (
252
+ {desktopSelfUpdate && (
218
253
  <DesktopUpdateControls
219
254
  state={effectiveState}
220
255
  progress={updateStatus?.progress}
@@ -308,6 +343,12 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
308
343
  )
309
344
  }
310
345
 
346
+ const MANUAL_UPDATE_TEXT: Record<NonNullable<VersionInfo['manualUpdate']>, string> = {
347
+ appimage: "This AppImage can't update itself. Download the new one and use it in place of this file.",
348
+ package: 'Download the new .deb or .rpm and install it with your package manager, such as apt or dnf.',
349
+ download: "Radar can't replace itself in this folder. Download the new version and copy it over this one, as an administrator if the folder needs it.",
350
+ }
351
+
311
352
  function CopyIcon({ copied, failed }: { copied: boolean; failed: boolean }) {
312
353
  if (copied) return <Check className="w-3.5 h-3.5 text-green-400 shrink-0" />
313
354
  if (failed) return <X className="w-3.5 h-3.5 text-red-400 shrink-0" />
@@ -18,10 +18,14 @@ import {
18
18
  Server,
19
19
  Megaphone,
20
20
  } from "lucide-react";
21
+ import { SlackIcon } from "../community";
21
22
  import { useNamespaces, useContexts } from "../../api/client";
22
23
  import { CORE_RESOURCES, useAPIResources } from "../../api/apiResources";
23
24
  import { getResourceIcon } from "../../utils/resource-icons";
24
- import { parseContextForSwitcher, parseContextName } from "../../utils/context-name";
25
+ import {
26
+ parseContextForSwitcher,
27
+ parseContextName,
28
+ } from "../../utils/context-name";
25
29
 
26
30
  export type MainView =
27
31
  | "home"
@@ -128,6 +132,7 @@ export interface CommandItemCallbacks {
128
132
  onShowDiagnostics?: () => void;
129
133
  // Present only when release notes exist for this version.
130
134
  onShowWhatsNew?: () => void;
135
+ onOpenCommunity?: () => void;
131
136
  }
132
137
 
133
138
  const VIEW_ENTRIES: {
@@ -276,6 +281,23 @@ export function useCommandItems(cb: CommandItemCallbacks): CommandItem[] {
276
281
  searchTerms: ["release notes", "changelog", "updates", "new features"],
277
282
  });
278
283
  }
284
+ if (cb.onOpenCommunity) {
285
+ result.push({
286
+ id: "action-community",
287
+ label: "Radar community on Slack",
288
+ category: "Actions",
289
+ icon: SlackIcon,
290
+ action: () => cb.onOpenCommunity?.(),
291
+ searchTerms: [
292
+ "slack",
293
+ "community",
294
+ "help",
295
+ "support",
296
+ "chat",
297
+ "question",
298
+ ],
299
+ });
300
+ }
279
301
  if (cb.onShowDiagnostics) {
280
302
  result.push({
281
303
  id: "action-diagnostics",
@@ -300,5 +322,6 @@ export function useCommandItems(cb: CommandItemCallbacks): CommandItem[] {
300
322
  cb.onToggleTheme,
301
323
  cb.onShowDiagnostics,
302
324
  cb.onShowWhatsNew,
325
+ cb.onOpenCommunity,
303
326
  ]);
304
327
  }
@@ -4,6 +4,13 @@ import { contentMatchLabel, partialSearchNotices } from './omnibar-match'
4
4
  const site = (s: string) => ({ token: 't', site: s, score: 12 })
5
5
 
6
6
  describe('contentMatchLabel', () => {
7
+ it('names Event content without claiming Events have a spec', () => {
8
+ for (const path of ['reason', 'message', 'type', 'involvedObject.name', 'related.name']) {
9
+ expect(contentMatchLabel([site(`content:${path}`)])).toBe('in event')
10
+ }
11
+ expect(contentMatchLabel([site('content:reason'), site('content:message')])).toBe('in event')
12
+ expect(contentMatchLabel([site('content:reason'), site('name')])).toBe('')
13
+ })
7
14
  it('names a match inside Trivy findings', () => {
8
15
  expect(contentMatchLabel([site('content:report.vulnerabilities[3]')])).toBe('in findings')
9
16
  })
@@ -5,6 +5,7 @@ import type { SearchMatchedField } from '../../api/client'
5
5
  // reports keep their findings under `report`, not a spec.
6
6
  export function contentMatchLabel(matched: SearchMatchedField[] | undefined): string {
7
7
  if (!matched?.length || !matched.every((m) => m.site.startsWith('content:'))) return ''
8
+ if (matched.every((m) => /^content:(reason|message|type|involvedObject|related)(\.|$)/.test(m.site))) return 'in event'
8
9
  return matched.every((m) => m.site.startsWith('content:report.')) ? 'in findings' : 'in spec'
9
10
  }
10
11
 
@@ -7,6 +7,23 @@ const searchCoverageNote = (entries: SearchCoverageEntry[] | undefined, opts: Pa
7
7
  const entry = (kind: string, reason: string, group = '', count?: number): SearchCoverageEntry => ({ kind, group, reason, count })
8
8
 
9
9
  describe('searchCoverageNote', () => {
10
+ it('keeps collection limits visible beside an Event search action', () => {
11
+ const searchEvents = vi.fn()
12
+ const note = noteFor({ status: 'complete', narrowedBy: ['kind_collection'], gaps: [] }, { hits: [], query: 'CertificateExpirationWarning', searchEvents })
13
+ expect(note?.parts?.[0].text).toContain("doesn't watch every kind")
14
+ expect(note?.parts?.[1].text).toBe("Kubernetes Events aren't included in a broad search.")
15
+ expect(note?.parts?.[1].action).toMatchObject({ label: 'Search Events', keepOpen: true })
16
+ note?.parts?.[1].action?.onSelect()
17
+ expect(searchEvents).toHaveBeenCalledOnce()
18
+ })
19
+
20
+ it('does not offer Event search for unread scope, existing hits or older coverage', () => {
21
+ const opts = { hits: [], query: 'CertificateExpirationWarning', searchEvents: vi.fn() }
22
+ expect(searchCoverageNote([entry('*', 'kind_sync_pending')], opts)?.action).toBeUndefined()
23
+ expect(noteFor(undefined, opts)).toBeUndefined()
24
+ expect(noteFor({ status: 'complete', gaps: [] }, { ...opts, hits: [{ kind: 'Pod' }] })).toBeUndefined()
25
+ })
26
+
10
27
  it('explains an empty search narrowed by kind collection, without an action', () => {
11
28
  expect(noteFor({ status: 'complete', narrowedBy: ['kind_collection'], gaps: [] }, { hits: [] })).toEqual({
12
29
  text: "Radar doesn't watch every kind; search kind:<name> to include one.",
@@ -21,6 +21,9 @@ export interface SearchCoverageNoteOptions {
21
21
  hits?: { kind: string; group?: string }[]
22
22
  query?: string
23
23
  recheckKind?: (kind: string) => void
24
+ /** Opt into Event search without changing the current terms or namespace. */
25
+ searchEvents?: () => void
26
+ eventSearchNeedsUpgrade?: boolean
24
27
  /** Re-querying a still-loading search ran out of budget. */
25
28
  pendingExhausted?: boolean
26
29
  /** Returns how to open a kind's resource list, or undefined when the host can't. */
@@ -110,6 +113,14 @@ function failedKinds(entries: SearchCoverageEntry[], label: (e: SearchCoverageEn
110
113
  return { text: `${shown.join(', ')} and ${more} more ${more === 1 ? 'kind' : 'kinds'}`, one: false }
111
114
  }
112
115
 
116
+ function queryKinds(query: string): string[] {
117
+ const tokens = query.match(/(?:[^\s"]|"[^"]*(?:"|$))+/g) ?? []
118
+ return tokens.flatMap((token) => {
119
+ const match = /^(?:kind|k):(.+)$/i.exec(token.replaceAll('"', ''))
120
+ return match ? [match[1].toLowerCase()] : []
121
+ })
122
+ }
123
+
113
124
  // Radar's ⌘K note for one search: what happened to the kinds and namespaces
114
125
  // the query named, whether results are still loading, and which kinds failed
115
126
  // to read. Broad searches keep access exclusions quiet; namespace collection
@@ -121,12 +132,26 @@ export function searchCoverageNote(coverage: SearchCoverage | undefined, opts: S
121
132
  if (coverage?.gaps.length === 0) {
122
133
  // Collection limits come from how Radar is installed, and nothing else
123
134
  // in the omnibar shows them, so they are said with hits too.
124
- if (coverage.narrowedBy?.includes('namespace_collection')) {
125
- return { text: "Radar collects some kinds only in some namespaces; matches for them elsewhere won't show." }
126
- }
127
- if (coverage.narrowedBy?.includes('kind_collection') && !opts.hits?.length) {
128
- return { text: "Radar doesn't watch every kind; search kind:<name> to include one." }
135
+ const collection = coverage.narrowedBy?.includes('namespace_collection')
136
+ ? "Radar collects some kinds only in some namespaces; matches for them elsewhere won't show."
137
+ : coverage.narrowedBy?.includes('kind_collection') && !opts.hits?.length
138
+ ? "Radar doesn't watch every kind; search kind:<name> to include one."
139
+ : undefined
140
+ const kinds = queryKinds(opts.query ?? '')
141
+ const emptyBroadSearch = opts.hits?.length === 0 && kinds.length === 0
142
+ const needsUpgrade = opts.eventSearchNeedsUpgrade && (emptyBroadSearch || kinds.some((kind) => kind === 'event' || kind === 'events' || kind === 'ev'))
143
+ if (opts.query?.trim() && (needsUpgrade || (opts.searchEvents && emptyBroadSearch))) {
144
+ const eventNote: OmnibarNotePart = needsUpgrade ? {
145
+ text: 'Update the connected Radar server to search Event reasons and messages.',
146
+ } : {
147
+ text: "Kubernetes Events aren't included in a broad search.",
148
+ action: opts.searchEvents ? { label: 'Search Events', onSelect: opts.searchEvents, keepOpen: true } : undefined,
149
+ }
150
+ return collection
151
+ ? { text: [collection, eventNote.text, eventNote.action?.label].filter(Boolean).join(' '), parts: [{ text: collection }, eventNote] }
152
+ : eventNote
129
153
  }
154
+ if (collection) return { text: collection }
130
155
  }
131
156
  return undefined
132
157
  }
@@ -149,8 +174,7 @@ export function searchCoverageNote(coverage: SearchCoverage | undefined, opts: S
149
174
  if (failed.length) {
150
175
  const { text, one } = failedKinds(failed, (e) => label(e))
151
176
  const warning = `Couldn't read ${text}; matches of ${one ? 'that kind' : 'those kinds'} may be missing.`
152
- const tokens = (opts.query ?? '').match(/(?:[^\s"]|"[^"]*(?:"|$))+/g) ?? []
153
- const namedKind = tokens.some((token) => /^(kind|k):.+/i.test(token.replaceAll('"', '')))
177
+ const namedKind = queryKinds(opts.query ?? '').length > 0
154
178
  const retry = !namedKind && failed.find((e) => e.kind !== '*' && e.reason === 'read_error')
155
179
  const unnamedRetry = !namedKind && !retry && failed.some((e) => e.kind === '*' && e.count && e.reason === 'read_error')
156
180
  if (unnamedRetry) {
@@ -4,6 +4,7 @@ import { pluralize } from '@skyhook-io/k8s-ui'
4
4
  import { useSwitchContext, fetchSessionCounts, SwitchContextError, type SessionCounts } from '../api/client'
5
5
  import { useContextSwitch } from '../context/ContextSwitchContext'
6
6
  import { useToast } from './ui/Toast'
7
+ import { Tooltip } from './ui/Tooltip'
7
8
  import { useDock } from './dock'
8
9
  import type { ContextInfo, SelectedResource } from '../types'
9
10
  import { parseContextForSwitcher } from '../utils/context-name'
@@ -130,7 +131,10 @@ export function useContextSwitchFlow() {
130
131
  )}
131
132
  </ul>
132
133
  <p className="text-xs text-theme-text-tertiary">
133
- Switch to: <span className="text-theme-text-secondary">{parseContextForSwitcher(pending.context).clusterName}</span>
134
+ Switch to:{' '}
135
+ <Tooltip content={shortNameHides(pending.context) ? pending.context.name : ''}>
136
+ <span className="text-theme-text-secondary">{parseContextForSwitcher(pending.context).clusterName}</span>
137
+ </Tooltip>
134
138
  </p>
135
139
  </div>
136
140
  <div className="px-4 py-3 border-t border-theme-border flex justify-end gap-2">
@@ -162,3 +166,7 @@ export function useContextSwitchFlow() {
162
166
  confirmDialog,
163
167
  }
164
168
  }
169
+
170
+ function shortNameHides(context: ContextInfo) {
171
+ return parseContextForSwitcher(context).clusterName !== context.name
172
+ }
@@ -0,0 +1,165 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot } from 'react-dom/client'
4
+ import { afterEach, describe, expect, it, vi } from 'vitest'
5
+ import { schedule as reading } from './velero.fixtures'
6
+
7
+ ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
8
+
9
+ const state = vi.hoisted(() => ({ support: 'supported', mutate: vi.fn(), reading: undefined as unknown, serverStopped: false, backupsDisabled: false, toast: vi.fn() }))
10
+ vi.mock('../../api/client', () => ({ useRadarFeature: () => ({ support: state.support }) }))
11
+ vi.mock('../../api/velero', () => ({
12
+ useVeleroBackupNow: () => ({ mutate: state.mutate, reset: vi.fn(), isPending: false }),
13
+ useVeleroScheduleActivity: () => ({ data: state.reading ? { reading: state.reading, serverStopped: state.serverStopped } : undefined }),
14
+ useVeleroWorkspace: () => ({ data: { installations: [{ namespace: 'velero', server: { source: 'deployment', backupsDisabled: state.backupsDisabled } }] } }),
15
+ }))
16
+ vi.mock('../ui/Toast', () => ({ showApiSuccess: state.toast }))
17
+
18
+ const { VeleroBackupNow } = await import('./VeleroBackupNow')
19
+
20
+ const nightly = {
21
+ metadata: { namespace: 'velero', name: 'nightly', resourceVersion: '42' },
22
+ spec: { schedule: '0 1 * * *', template: { includedNamespaces: ['payments'], storageLocation: 'primary', ttl: '168h0m0s' } },
23
+ }
24
+
25
+ // Every root is unmounted after its test: a mounted dialog keeps scheduling
26
+ // its close animation, which would otherwise run after the environment is gone.
27
+ const roots: ReturnType<typeof createRoot>[] = []
28
+ function render(node: React.ReactNode) {
29
+ const host = document.createElement('div')
30
+ document.body.append(host)
31
+ const root = createRoot(host)
32
+ roots.push(root)
33
+ act(() => root.render(node))
34
+ return root
35
+ }
36
+ afterEach(() => {
37
+ act(() => roots.splice(0).forEach((r) => r.unmount()))
38
+ document.body.innerHTML = ''
39
+ state.support = 'supported'
40
+ state.reading = undefined
41
+ state.serverStopped = false
42
+ state.backupsDisabled = false
43
+ state.toast.mockReset()
44
+ state.mutate.mockReset()
45
+ })
46
+
47
+ const buttonNamed = (label: string) => [...document.querySelectorAll('button')].find((b) => b.textContent?.trim() === label)
48
+
49
+ describe('Back up now', () => {
50
+ it('says a wildcard exclusion narrows what is backed up', () => {
51
+ for (const field of ['excludedNamespaceScopedResources', 'excludedClusterScopedResources']) {
52
+ render(<VeleroBackupNow schedule={{ ...nightly, spec: { ...nightly.spec, template: { ...nightly.spec.template, [field]: ['*'] } } }} />)
53
+ act(() => buttonNamed('Back up now')!.click())
54
+ expect(document.body.textContent).toContain('narrowed by resource or label filters')
55
+ act(() => roots.splice(0).forEach((r) => r.unmount()))
56
+ document.body.innerHTML = ''
57
+ }
58
+ })
59
+
60
+ it('reads a zero retention as the server default, as Velero does', () => {
61
+ render(<VeleroBackupNow schedule={{ ...nightly, spec: { ...nightly.spec, template: { ...nightly.spec.template, ttl: '0s' } } }} />)
62
+ act(() => buttonNamed('Back up now')!.click())
63
+ expect(document.body.textContent).toContain('The Velero server’s default (30 days unless it was changed)')
64
+ expect(document.body.textContent).not.toContain('0 hours')
65
+ })
66
+
67
+ it('shows what will be backed up, and binds the backup to the schedule reviewed', () => {
68
+ render(<VeleroBackupNow schedule={nightly} />)
69
+ act(() => buttonNamed('Back up now')!.click())
70
+ const dialog = document.body.textContent ?? ''
71
+ expect(dialog).toContain('payments')
72
+ expect(dialog).toContain('primary')
73
+ expect(dialog).toContain('7 days')
74
+ expect(dialog).toContain("The schedule's next run waits while this backup is queued or running.")
75
+ const confirm = [...document.querySelectorAll('button')].filter((b) => b.textContent?.trim() === 'Back up now').at(-1)!
76
+ act(() => confirm.click())
77
+ expect(state.mutate).toHaveBeenCalledWith(
78
+ expect.objectContaining({ namespace: 'velero', name: 'nightly', resourceVersion: '42', backupName: expect.stringMatching(/^nightly-\d{14}$/), submission: expect.stringMatching(/^[A-Za-z0-9-]{8,64}$/) }),
79
+ expect.anything(),
80
+ )
81
+ })
82
+
83
+ it('keeps the schedule it showed, and refuses one that changed while it was open', () => {
84
+ const root = render(<VeleroBackupNow schedule={nightly} />)
85
+ act(() => buttonNamed('Back up now')!.click())
86
+ const edited = { ...nightly, metadata: { ...nightly.metadata, resourceVersion: '43' }, spec: { ...nightly.spec, template: { ...nightly.spec.template, storageLocation: 'elsewhere' } } }
87
+ act(() => root.render(<VeleroBackupNow schedule={edited} />))
88
+ const text = document.body.textContent ?? ''
89
+ expect(text).toContain('primary')
90
+ expect(text).not.toContain('elsewhere')
91
+ expect(text).toContain('This schedule changed while this was open')
92
+ const confirm = [...document.querySelectorAll('button')].filter((b) => b.textContent?.trim() === 'Back up now').at(-1)!
93
+ expect(confirm.disabled).toBe(true)
94
+ })
95
+
96
+ it('cannot start a backup that would fail', () => {
97
+ state.reading = reading({ name: 'nightly', state: 'cannotRun', attention: true })
98
+ render(<VeleroBackupNow schedule={nightly} />)
99
+ expect(buttonNamed('Back up now')!.disabled).toBe(true)
100
+ })
101
+
102
+ it('says the backup was created, with a way to open it', () => {
103
+ state.mutate.mockImplementation((_vars: unknown, opts: { onSuccess: (b: unknown) => void }) => opts.onSuccess({ namespace: 'velero', name: 'nightly-20261115210509' }))
104
+ const onNavigate = vi.fn()
105
+ render(<VeleroBackupNow schedule={nightly} onNavigate={onNavigate} />)
106
+ act(() => buttonNamed('Back up now')!.click())
107
+ const confirm = [...document.querySelectorAll('button')].filter((b) => b.textContent?.trim() === 'Back up now').at(-1)!
108
+ act(() => confirm.click())
109
+ expect(state.toast).toHaveBeenCalledWith('Backup nightly-20261115210509 created', undefined, expect.objectContaining({ label: 'Open' }))
110
+ state.toast.mock.calls[0][2].onClick()
111
+ expect(onNavigate).toHaveBeenCalledWith({ kind: 'Backup', group: 'velero.io', namespace: 'velero', name: 'nightly-20261115210509' })
112
+ })
113
+
114
+ // A stopped server would only queue it, so "now" would not be true.
115
+ it('is unavailable while the Velero server is stopped, whatever the schedule reads', () => {
116
+ state.reading = reading({ name: 'nightly', state: 'due' })
117
+ state.serverStopped = true
118
+ render(<VeleroBackupNow schedule={nightly} />)
119
+ expect(buttonNamed('Back up now')!.disabled).toBe(true)
120
+ })
121
+
122
+ it('says when resource or label filters narrow what it backs up', () => {
123
+ const filtered = { ...nightly, spec: { ...nightly.spec, template: { ...nightly.spec.template, excludedNamespaces: ['kube-system'], labelSelector: { matchLabels: { app: 'api' } } } } }
124
+ render(<VeleroBackupNow schedule={filtered} />)
125
+ act(() => buttonNamed('Back up now')!.click())
126
+ const dialog = document.body.textContent ?? ''
127
+ expect(dialog).toContain('payments, except kube-system')
128
+ expect(dialog).toContain('narrowed by resource or label filters')
129
+ })
130
+
131
+ it('is unavailable when Velero runs restore-only', () => {
132
+ state.backupsDisabled = true
133
+ render(<VeleroBackupNow schedule={nightly} />)
134
+ expect(buttonNamed('Back up now')!.disabled).toBe(true)
135
+ })
136
+
137
+ // Velero rejects a backup to a ReadOnly location; the attempt is still the user's to make.
138
+ it('warns, without refusing, when the schedule writes to a read-only location', () => {
139
+ state.reading = reading({ name: 'nightly', state: 'cannotRun', reason: 'locationReadOnly', attention: true, location: { name: 'primary', readOnly: true } })
140
+ render(<VeleroBackupNow schedule={nightly} />)
141
+ const button = buttonNamed('Back up now')!
142
+ expect(button.disabled).toBe(false)
143
+ act(() => button.click())
144
+ expect(document.body.textContent).toContain('Storage location primary is read-only, so Velero will reject this backup.')
145
+ })
146
+
147
+ it('is absent on a Radar without the action', () => {
148
+ state.support = 'unsupported'
149
+ render(<VeleroBackupNow schedule={nightly} />)
150
+ expect(buttonNamed('Back up now')).toBeUndefined()
151
+ })
152
+
153
+ // The server can stop while the confirmation is open.
154
+ it('refuses to confirm once the server has stopped', () => {
155
+ state.reading = reading({ name: 'nightly', state: 'onSchedule' })
156
+ const root = render(<VeleroBackupNow schedule={nightly} />)
157
+ act(() => buttonNamed('Back up now')!.click())
158
+ state.serverStopped = true
159
+ act(() => root.render(<VeleroBackupNow schedule={{ ...nightly }} />))
160
+ const confirm = [...document.querySelectorAll('button')].filter((b) => b.textContent?.trim() === 'Back up now').at(-1)!
161
+ expect(confirm.disabled).toBe(true)
162
+ expect(document.body.textContent).toContain('Start it first')
163
+ })
164
+ })
165
+