@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
@@ -0,0 +1,516 @@
1
+ // @vitest-environment jsdom
2
+ import { renderToStaticMarkup } from 'react-dom/server'
3
+ import { MemoryRouter } from 'react-router-dom'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+ import { describe, expect, it, vi } from 'vitest'
6
+ import { hoursAgo, location, schedule, workspace } from './velero.fixtures'
7
+
8
+ const state = vi.hoisted(() => ({
9
+ runs: undefined as unknown,
10
+ runsBy: {} as Record<string, unknown>,
11
+ error: null as Error | null,
12
+ workspace: undefined as unknown,
13
+ activity: undefined as unknown,
14
+ stored: undefined as unknown,
15
+ deletion: { state: 'unknown' } as unknown,
16
+ }))
17
+ vi.mock('../../api/client', async (importOriginal) => ({
18
+ ...(await importOriginal<typeof import('../../api/client')>()),
19
+ useRadarFeature: () => ({ support: 'supported', guard: (f: () => unknown) => f(), gatedKey: [] }),
20
+ }))
21
+ vi.mock('../../api/velero', async (importOriginal) => ({
22
+ ...(await importOriginal<typeof import('../../api/velero')>()),
23
+ // A filtered read answers from runsBy (keyed "kind:schedule" or "kind:backup"); the lists read `runs`.
24
+ useVeleroRuns: (kind: string, _ns?: string, filter?: { schedule?: string; backup?: string }) => {
25
+ const key = filter?.schedule ? `${kind}:${filter.schedule}` : filter?.backup ? `${kind}:${filter.backup}` : ''
26
+ return { data: key ? state.runsBy[key] : state.runs, isPending: false, error: state.error }
27
+ },
28
+ useVeleroWorkspace: () => ({ data: state.workspace }),
29
+ useVeleroScheduleActivity: () => ({ data: state.activity }),
30
+ useVeleroBackupDeletion: () => ({ data: state.deletion, error: null }),
31
+ }))
32
+ vi.mock('../../api/policy', async (importOriginal) => ({
33
+ ...(await importOriginal<typeof import('../../api/policy')>()),
34
+ useVeleroStoredBackups: () => ({ data: state.stored, isPending: false, error: null }),
35
+ }))
36
+
37
+ const { parseVeleroRoute, veleroDetailKindFor, veleroDetailPath } = await import('./routes')
38
+ const { VeleroBackupRestores, VeleroLocationBackups, locationState, renderVeleroSummary } = await import('./VeleroPages')
39
+ const { VeleroBackups } = await import('./VeleroRunLists')
40
+ const { runsEmpty } = await import('./runs')
41
+ const { VeleroScheduleStateBadge } = await import('@skyhook-io/k8s-ui')
42
+ const { veleroResourceHost } = await import('./host')
43
+
44
+ describe('Velero page routes', () => {
45
+ it('reads and writes an object page, and leaves the Overview alone', () => {
46
+ expect(parseVeleroRoute('/velero/backups/velero/nightly-1').detail).toEqual({ plural: 'backups', namespace: 'velero', name: 'nightly-1' })
47
+ expect(parseVeleroRoute('/velero').detail).toBeUndefined()
48
+ expect(parseVeleroRoute('/velero/podvolumebackups/velero/x').detail).toBeUndefined()
49
+ expect(veleroDetailPath({ plural: 'schedules', namespace: 'velero', name: 'a b' }, 'ctx-1', 'runs')).toBe('/velero/schedules/velero/a%20b?ctx=ctx-1&tab=runs')
50
+ })
51
+
52
+ it('claims only Velero’s own kinds, by exact group', () => {
53
+ expect(veleroDetailKindFor('backups', 'velero.io')).toBe('backups')
54
+ expect(veleroDetailKindFor('restores', 'other.io')).toBeNull()
55
+ expect(veleroResourceHost.expandedPath?.({ kind: 'Backup', group: 'velero.io', namespace: 'velero', name: 'b' })).toBe('/velero/backups/velero/b')
56
+ expect(veleroResourceHost.detailRedirect?.({ kind: 'Restore', group: 'velero.io', namespace: 'velero', name: 'r' }, new URLSearchParams('apiGroup=velero.io&tab=yaml'))).toBe('/velero/restores/velero/r?tab=yaml')
57
+ })
58
+ })
59
+
60
+ describe('A backup’s storage location', () => {
61
+ it('is missing only when the locations were read in full', () => {
62
+ const read = workspace({ locations: [location({ name: 'default', phase: 'Available' })] })
63
+ expect(locationState('default', 'velero', read).text).toBe('available')
64
+ expect(locationState('gone', 'velero', read).text).toBe('not found: Velero has no such location')
65
+ const partial = { ...read, coverage: { ...read.coverage, backupStorageLocations: { state: 'partial' as const } } }
66
+ expect(locationState('gone', 'velero', partial).text).toBe('not read')
67
+ expect(locationState('default', 'velero', undefined).text).toBe('not read')
68
+ })
69
+ })
70
+
71
+ // renderToStaticMarkup escapes apostrophes; compare against the text a reader sees.
72
+ const text = (html: string) => html.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&amp;/g, '&')
73
+ // The rendered text of static markup, as a reader sees it.
74
+ const plainText = (html: string) => new DOMParser().parseFromString(html, 'text/html').body.textContent ?? ''
75
+ // The same, with each element's text apart, as table cells read.
76
+ function plainWords(html: string): string {
77
+ const doc = new DOMParser().parseFromString(html, 'text/html')
78
+ const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT)
79
+ const words: string[] = []
80
+ while (walker.nextNode()) words.push(walker.currentNode.textContent ?? '')
81
+ return words.join(' ').replace(/\s+/g, ' ')
82
+ }
83
+
84
+ function page(apiKind: string, resource: unknown, leadContent?: React.ReactNode) {
85
+ return text(
86
+ renderToStaticMarkup(
87
+ <QueryClientProvider client={new QueryClient()}>
88
+ <MemoryRouter>{renderVeleroSummary({ apiKind, resource, context: 'expanded', leadContent })}</MemoryRouter>
89
+ </QueryClientProvider>,
90
+ ),
91
+ )
92
+ }
93
+
94
+ const runsOf = (runs: unknown[], extra: Record<string, unknown> = {}) => ({ observedAt: '', coverage: { state: 'full' }, runs, total: runs.length, ...extra })
95
+
96
+ describe('The composed Overview', () => {
97
+ it('leads the page and the drawer alike, for the kinds that have a page', () => {
98
+ expect(renderVeleroSummary({ apiKind: 'backups', resource: { metadata: {} }, context: 'drawer' })).not.toBeNull()
99
+ expect(renderVeleroSummary({ apiKind: 'podvolumebackups', resource: { metadata: {} }, context: 'expanded' })).toBeNull()
100
+ })
101
+
102
+ it('in the drawer, reads as the page does, unframed, with a tab link that opens the page', () => {
103
+ state.workspace = workspace()
104
+ const html = text(
105
+ renderToStaticMarkup(
106
+ <QueryClientProvider client={new QueryClient()}>
107
+ <MemoryRouter>
108
+ {renderVeleroSummary({
109
+ apiKind: 'backups',
110
+ context: 'drawer',
111
+ resource: { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'default', ttl: '24h0m0s' }, status: { phase: 'Completed', expiration: new Date(Date.now() + 3_600_000).toISOString() } },
112
+ })}
113
+ </MemoryRouter>
114
+ </QueryClientProvider>,
115
+ ),
116
+ )
117
+ expect(html).toContain('At a glance')
118
+ expect(html).toContain('Kept until')
119
+ expect(html).toContain('Restores →')
120
+ expect(html).not.toContain('rounded-xl border')
121
+ })
122
+
123
+ it('reads a completed backup: when it finished, its counts, and a restore Velero never tested', () => {
124
+ state.workspace = workspace()
125
+ const html = page('backups', {
126
+ metadata: { namespace: 'velero', name: 'b' },
127
+ spec: { includedNamespaces: ['demo'], storageLocation: 'default', ttl: '24h0m0s' },
128
+ status: { phase: 'Completed', startTimestamp: hoursAgo(2.001), completionTimestamp: hoursAgo(2), expiration: new Date(Date.now() + 21.5 * 3_600_000).toISOString(), progress: { itemsBackedUp: 23, totalItems: 23 }, errors: 0, warnings: 1 },
129
+ })
130
+ expect(html).toContain('finished 2h ago · took 3s')
131
+ expect(html).toContain('23 of 23 items backed up')
132
+ expect(html).toContain('0 errors')
133
+ expect(html).toContain('1 warning')
134
+ expect(html).toContain('Show 1 warning')
135
+ expect(html).toContain('>Namespaces<')
136
+ expect(html).toContain('as declared')
137
+ expect(html).toContain('in 21h')
138
+ expect(html).toContain('Not verified — Velero never tests a restore')
139
+ expect(html).toContain('Restores →')
140
+ expect(html).toContain('On demand, not by a schedule')
141
+ })
142
+
143
+ it('shows a partly failed backup’s messages control on the page itself, whatever leads it', () => {
144
+ state.workspace = undefined
145
+ const html = page('backups', { metadata: { namespace: 'velero', name: 'b' }, spec: { labelSelector: { matchLabels: { app: 'x' } } }, status: { phase: 'PartiallyFailed', errors: 2 } }, <div>ISSUE</div>)
146
+ expect(html).toContain('ISSUE')
147
+ expect(html).toContain('Show 2 errors')
148
+ expect(html).toContain('narrowed by resource or label filters')
149
+ expect(html).toContain('Not verified')
150
+ })
151
+
152
+ it('names a previous restore separately from the current storage location’s availability', () => {
153
+ state.workspace = workspace()
154
+ const done = { phase: 'Completed', startTimestamp: hoursAgo(5), completionTimestamp: hoursAgo(5) }
155
+ const backup = { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'default' }, status: done }
156
+ const restore = (name: string, phase: string, completed?: string) => ({ namespace: 'velero', name, uid: name, phase, completed, errors: 0, warnings: 0 })
157
+ state.runsBy = { 'restores:b': runsOf([restore('r-failed', 'Failed', hoursAgo(1)), restore('r-ok', 'PartiallyFailed', hoursAgo(2)), restore('r-old', 'Completed', hoursAgo(3))]) }
158
+ const html = plainText(page('backups', backup))
159
+ expect(html).toContain('Previous restore from this backup name: r-ok · partially failed · 2h ago')
160
+ expect(html).not.toContain('Not verified')
161
+ state.runsBy = { 'restores:b': runsOf([restore('r-failed', 'Failed', hoursAgo(1))]) }
162
+ expect(page('backups', backup)).toContain('Not verified — Velero never tests a restore')
163
+ state.runsBy = { 'restores:b': runsOf([restore('r-ok', 'Completed', hoursAgo(2))]) }
164
+ state.workspace = workspace({ locations: [location({ name: 'default', phase: 'Unavailable' })] })
165
+ const unavailable = page('backups', backup)
166
+ expect(unavailable).toContain('No: its storage location is unavailable')
167
+ expect(plainText(unavailable)).toContain('Previous restore from this backup name: r-ok · completed')
168
+ state.runsBy = {}
169
+ })
170
+
171
+ it('reads a restore from a backup being deleted as uncertain: Velero would still try', () => {
172
+ state.workspace = workspace()
173
+ const backup = { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'default' }, status: { phase: 'Deleting', startTimestamp: hoursAgo(5) } }
174
+ const html = plainText(page('backups', backup))
175
+ expect(html).toContain('Uncertain: it is being deleted')
176
+ expect(html).not.toContain('No: it is being deleted')
177
+ })
178
+
179
+ it('says a backup on an unavailable location can’t be restored, even while it is being deleted', () => {
180
+ state.workspace = workspace({ locations: [location({ name: 'default', phase: 'Unavailable' })] })
181
+ const backup = { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'default' }, status: { phase: 'Deleting', startTimestamp: hoursAgo(5) } }
182
+ const html = plainText(page('backups', backup))
183
+ expect(html).toContain('No: its storage location is unavailable')
184
+ expect(html).not.toContain('Uncertain')
185
+ })
186
+
187
+ it('says a Back up now run was made by hand from its schedule', () => {
188
+ state.workspace = workspace()
189
+ const backup = {
190
+ metadata: { namespace: 'velero', name: 'nightly-20261118120000', labels: { 'velero.io/schedule-name': 'nightly' }, annotations: { 'radar.skyhook.io/submission': 'confirmation-1' } },
191
+ spec: { storageLocation: 'default' },
192
+ status: { phase: 'Completed', startTimestamp: hoursAgo(2), completionTimestamp: hoursAgo(2) },
193
+ }
194
+ expect(plainText(page('backups', backup))).toContain('Back up now, from schedule nightly')
195
+ })
196
+
197
+ it('says deletion requests remain pending while deletion is disabled', () => {
198
+ const ws = workspace()
199
+ state.workspace = { ...ws, installations: [{ ...ws.installations[0], server: { ...ws.installations[0].server, gcDisabled: false, deletionDisabled: true } }] }
200
+ const backup = { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'default' }, status: { phase: 'Completed', startTimestamp: hoursAgo(50), completionTimestamp: hoursAgo(49), expiration: hoursAgo(1) } }
201
+ expect(plainText(page('backups', backup))).toContain('Past its retention. The backup-deletion controller is disabled, so deletion requests remain pending.')
202
+ })
203
+
204
+ it('says expired backups stay while Velero’s garbage collection is disabled', () => {
205
+ const ws = workspace()
206
+ state.workspace = { ...ws, installations: [{ ...ws.installations[0], server: { ...ws.installations[0].server, gcDisabled: true } }] }
207
+ const backup = { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'default' }, status: { phase: 'Completed', startTimestamp: hoursAgo(50), completionTimestamp: hoursAgo(49), expiration: hoursAgo(1) } }
208
+ expect(plainText(page('backups', backup))).toContain('Past its retention, but Velero’s garbage collection is disabled')
209
+ })
210
+
211
+ it('says a rejected backup backed up nothing, and neither keeps nor restores anything', () => {
212
+ state.workspace = workspace()
213
+ const html = page('backups', {
214
+ metadata: { namespace: 'velero', name: 'r' },
215
+ spec: { storageLocation: 'default' },
216
+ status: { phase: 'FailedValidation', validationErrors: ['an existing backup storage location was not specified'], expiration: new Date(Date.now() + 3_600_000).toISOString() },
217
+ })
218
+ expect(html).toContain('Nothing</span> — Velero rejected it: an existing backup storage location was not specified')
219
+ expect(html).not.toContain('Kept until')
220
+ expect(html).not.toContain('>Restore<')
221
+ })
222
+
223
+ it('says no to a restore where it is certain, with the reason', () => {
224
+ state.workspace = workspace({ locations: [location({ name: 'dr', phase: 'Unavailable' })] })
225
+ const done = { phase: 'Completed', startTimestamp: hoursAgo(1), completionTimestamp: hoursAgo(1) }
226
+ expect(page('backups', { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'dr' }, status: done })).toContain('No: its storage location is unavailable')
227
+ expect(page('backups', { metadata: { namespace: 'velero', name: 'b' }, spec: { storageLocation: 'gone' }, status: done })).toContain('No: its storage location doesn’t exist')
228
+ })
229
+
230
+ it('distinguishes an unstarted run, a started failure and incomplete post-processing', () => {
231
+ state.workspace = workspace()
232
+ const summary = (phase: string, startTimestamp?: string) => plainText(page('backups', { metadata: { namespace: 'velero', name: 'b' }, spec: {}, status: { phase, startTimestamp } }))
233
+ expect(summary('New')).toContain('Not yet: Velero hasn’t started the backup.')
234
+ expect(summary('Failed', hoursAgo(1))).toContain('Some contents may have reached storage.')
235
+ for (const phase of ['InProgress', 'WaitingForPluginOperations', 'FinalizingPartiallyFailed']) {
236
+ expect(summary(phase, hoursAgo(1))).toContain('Wait for the backup to finish. Its stored contents may still be incomplete.')
237
+ }
238
+ })
239
+
240
+ it('leads with Velero’s issue as a plain banner, with its next step', () => {
241
+ state.workspace = workspace({
242
+ issues: [{
243
+ id: 'i1', severity: 'critical', category: 'location', kind: 'BackupStorageLocation', group: 'velero.io', namespace: 'velero', name: 'dr', reason: 'BackupStorageLocationUnavailable',
244
+ message: 'BackupStorageLocation "dr" is unavailable: rpc error: code = Unknown desc = NoSuchBucket: The specified bucket does not exist',
245
+ action: 'Create the bucket or point the location at one that exists',
246
+ affected: [{ kind: 'Backup', namespace: 'velero', name: 'r' }],
247
+ }],
248
+ })
249
+ const html = page('backups', { metadata: { namespace: 'velero', name: 'r' }, spec: { storageLocation: 'dr' }, status: { phase: 'FailedValidation' } }, <div>GENERIC</div>)
250
+ expect(html).not.toContain('GENERIC')
251
+ expect(html).toContain('The bucket doesn’t exist.')
252
+ expect(html).toContain('Next step: </span>Create the bucket or point the location at one that exists')
253
+ expect(html).toContain('Velero’s message')
254
+ expect(html).toContain('See in Issues →')
255
+ })
256
+
257
+ it('names Delete object in the next step of a rejected backup Velero won’t delete', () => {
258
+ const rejected = (location: string) => ({ metadata: { namespace: 'velero', name: 'adhoc', uid: 'u1' }, spec: { storageLocation: location }, status: { phase: 'FailedValidation' } })
259
+ state.workspace = workspace({
260
+ locations: [location({ name: 'default' })],
261
+ issues: [{ id: 'i2', severity: 'critical', category: 'backup', kind: 'Backup', group: 'velero.io', namespace: 'velero', name: 'adhoc', reason: 'BackupValidationFailed', message: 'backup storage location gone not found', action: 'Name an existing storage location, then create the backup again' }],
262
+ })
263
+ expect(page('backups', rejected('gone'))).toContain('Name an existing storage location, then create the backup again; to remove this backup, use Delete object (nothing of it is in storage)')
264
+ // Its location exists, so Velero acts on Delete backup: nothing to add.
265
+ expect(page('backups', rejected('default'))).not.toContain('Delete object')
266
+ })
267
+
268
+ it('gives a banner without the Issue’s own action a next step from what its message means', () => {
269
+ state.workspace = workspace({
270
+ issues: [{
271
+ id: 'i1', severity: 'critical', category: 'location', kind: 'BackupStorageLocation', group: 'velero.io', namespace: 'velero', name: 'dr', reason: 'BackupStorageLocationUnavailable',
272
+ message: 'BackupStorageLocation "dr" is unavailable: rpc error: code = Unknown desc = NoSuchBucket: The specified bucket does not exist',
273
+ }],
274
+ })
275
+ const html = page('backupstoragelocations', { metadata: { namespace: 'velero', name: 'dr' }, spec: {}, status: { phase: 'Unavailable' } })
276
+ expect(html).toContain('Next step: </span>Create the bucket, or point the storage location at an existing one')
277
+ })
278
+
279
+ it('says the runs Velero keeps are unknown when the backups were not read, never "at least 0"', () => {
280
+ const reading = schedule({ runs: { read: 'unknown', kept: 0 } })
281
+ state.workspace = workspace({ schedules: [reading] })
282
+ state.activity = { reading }
283
+ for (const [coverage, says] of [
284
+ [{ state: 'denied', deniedNamespaces: ['velero'] }, 'Unknown — no access in velero'],
285
+ [{ state: 'uncached', uncachedNamespaces: ['velero'] }, 'Unknown — not cached by Radar in velero'],
286
+ ] as const) {
287
+ state.runsBy = { 'backups:nightly': { observedAt: '', coverage, runs: [], total: 0 } }
288
+ const html = page('schedules', { metadata: { namespace: 'velero', name: 'nightly' }, spec: { template: {} } })
289
+ expect(html).toContain(says)
290
+ expect(html).not.toContain('At least 0')
291
+ expect(html).not.toContain('0 completed')
292
+ }
293
+ // A partial read still bounds the count from below.
294
+ state.runsBy = { 'backups:nightly': { observedAt: '', coverage: { state: 'partial' }, runs: [{ namespace: 'velero', name: 'nightly-1', uid: '1', phase: 'Completed', errors: 0, warnings: 0 }], total: 1 } }
295
+ expect(page('schedules', { metadata: { namespace: 'velero', name: 'nightly' }, spec: { template: {} } })).toContain('At least 1 kept')
296
+ state.runsBy = {}
297
+ })
298
+
299
+ it('reads a zero retention as the server default', () => {
300
+ state.workspace = workspace()
301
+ state.activity = { reading: schedule() }
302
+ state.runsBy = { 'backups:nightly': runsOf([]) }
303
+ const html = page('schedules', { metadata: { namespace: 'velero', name: 'nightly' }, spec: { template: { ttl: '0h0m0s' } } })
304
+ expect(html).toContain('The Velero server’s default (30 days unless it was changed)')
305
+ expect(html).not.toContain('0 hours')
306
+ state.runsBy = {}
307
+ })
308
+
309
+ it('leads a schedule that cannot run with its Velero reading, not the generic issue row', () => {
310
+ const reading = schedule({ name: 'very-long', state: 'cannotRun', attention: true, lastSubmitted: undefined, nextRun: undefined, runs: { read: 'full', kept: 0 } })
311
+ state.workspace = workspace({ schedules: [reading] })
312
+ state.activity = { reading }
313
+ state.runsBy = { 'backups:very-long': runsOf([]) }
314
+ const html = page('schedules', { metadata: { namespace: 'velero', name: 'very-long' }, spec: { template: {} } }, <div>GENERIC</div>)
315
+ expect(html).not.toContain('GENERIC')
316
+ expect(html).toContain('Schedule cannot run')
317
+ expect(html).toContain('longer than 63 characters')
318
+ expect(html).toContain('Next step: </span>Recreate the schedule with a name of 63 characters or fewer')
319
+ // Said once, in the banner; the rows say what they are.
320
+ expect(html.match(/longer than 63 characters/g)).toHaveLength(1)
321
+ expect(html).toMatch(/Last success<\/dt><dd[^>]*><span[^>]*>Never</)
322
+ expect(html).toMatch(/Next run<\/dt><dd[^>]*><span[^>]*>None</)
323
+ expect(html).not.toContain('None kept')
324
+ state.runsBy = {}
325
+ })
326
+
327
+ it('leads a location whose validation is overdue with its reading', () => {
328
+ state.workspace = workspace({ locations: [location({ name: 'dr', attention: true, validationOverdue: true, lastValidation: hoursAgo(5), frequency: { seconds: 60, source: 'server' } })] })
329
+ const html = page('backupstoragelocations', { metadata: { namespace: 'velero', name: 'dr' }, spec: {}, status: { phase: 'Available' } }, <div>GENERIC</div>)
330
+ expect(html).not.toContain('GENERIC')
331
+ expect(html).toContain('Storage location validation overdue')
332
+ expect(html).toContain('Next step: </span>Check that the Velero server is running, and read its logs')
333
+ })
334
+
335
+ it('reads a restore: where it went, what it processed, and its warnings', () => {
336
+ state.workspace = workspace()
337
+ const html = page('restores', {
338
+ metadata: { namespace: 'velero', name: 'r' },
339
+ spec: { backupName: 'b', includedNamespaces: ['demo', 'shop'], namespaceMapping: { demo: 'demo-copy' } },
340
+ status: { phase: 'PartiallyFailed', startTimestamp: hoursAgo(1), completionTimestamp: hoursAgo(1), progress: { itemsRestored: 10, totalItems: 12 }, warnings: 3, errors: 0 },
341
+ })
342
+ expect(html.indexOf('Restored into')).toBeLessThan(html.indexOf('Outcome'))
343
+ expect(plainText(html)).toContain('demo → demo-copy, shop')
344
+ expect(html).toMatch(/<button[^>]*>demo-copy<\/button>/)
345
+ expect(html).toMatch(/<button[^>]*>shop<\/button>/)
346
+ expect(html).toContain('unmapped namespaces keep their names')
347
+ expect(html).toContain('10 of 12 items processed')
348
+ expect(html).toContain('3 warnings')
349
+ expect(html).not.toContain('items restored')
350
+ })
351
+
352
+ it('says a rejected restore restored nothing, and why', () => {
353
+ state.workspace = workspace()
354
+ const html = page('restores', {
355
+ metadata: { namespace: 'velero', name: 'r' },
356
+ spec: { backupName: 'b', includedNamespaces: ['*'] },
357
+ status: { phase: 'FailedValidation', validationErrors: ['The BSL dr-replica is unavailable, cannot retrieve the backup'] },
358
+ })
359
+ expect(html).toContain('Nothing</span> — Velero rejected it: Its storage location dr-replica is unavailable')
360
+ expect(html).not.toContain('Restored into')
361
+ expect(html).not.toContain('Every namespace in the backup')
362
+ })
363
+
364
+ it('says a rejected restore restored nothing, on the Restores tab as on its page', () => {
365
+ state.runsBy = { 'restores:b': runsOf([{ namespace: 'velero', name: 'r2', uid: 'r2', phase: 'FailedValidation', errors: 0, warnings: 0, includedNamespaces: [], excludedNamespaces: [] }]) }
366
+ const html = text(renderToStaticMarkup(<QueryClientProvider client={new QueryClient()}><MemoryRouter><VeleroBackupRestores namespace="velero" name="b" /></MemoryRouter></QueryClientProvider>))
367
+ expect(html).toContain('Nothing — rejected')
368
+ expect(html).not.toContain('Every namespace in the backup')
369
+ state.runsBy = {}
370
+ })
371
+
372
+ it('shows where each restore from a backup went, on its Restores tab', () => {
373
+ state.runsBy = { 'restores:b': runsOf([{ namespace: 'velero', name: 'r1', uid: 'r1', phase: 'Completed', errors: 0, warnings: 0, includedNamespaces: ['demo', 'shop'], excludedNamespaces: [], namespaceMapping: { demo: 'demo-copy' } }]) }
374
+ const html = text(renderToStaticMarkup(<QueryClientProvider client={new QueryClient()}><MemoryRouter><VeleroBackupRestores namespace="velero" name="b" /></MemoryRouter></QueryClientProvider>))
375
+ expect(html).toContain('>Into<')
376
+ expect(plainText(html)).toContain('demo → demo-copy, shop')
377
+ expect(html).not.toContain('Nothing — rejected')
378
+ // A name never breaks at its hyphen.
379
+ expect(html).toMatch(/<span class="inline-block max-w-full truncate[^"]*">demo-copy,<\/span>/)
380
+ state.runsBy = {}
381
+ })
382
+
383
+ it('leads a schedule with its last success, next run and recent runs, and says when its last run failed', () => {
384
+ const failed = { name: 'nightly-2', phase: 'PartiallyFailed', created: hoursAgo(1), ranAt: hoursAgo(1) }
385
+ const ok = { name: 'nightly-1', phase: 'Completed', created: hoursAgo(25), ranAt: hoursAgo(25) }
386
+ const reading = schedule({ runs: { read: 'full', kept: 46, newest: failed, newestCompleted: ok, recent: [failed, ok] } })
387
+ state.workspace = workspace({ schedules: [reading] })
388
+ state.activity = { reading }
389
+ state.runsBy = { 'backups:nightly': runsOf([{ namespace: 'velero', name: 'nightly-2', uid: '2', phase: 'PartiallyFailed', errors: 1, warnings: 0 }, { namespace: 'velero', name: 'nightly-1', uid: '1', phase: 'Completed', errors: 0, warnings: 0 }]) }
390
+ const html = page('schedules', { metadata: { namespace: 'velero', name: 'nightly' }, spec: { template: { includedNamespaces: ['demo'], ttl: '720h0m0s' } } })
391
+ expect(html.indexOf('Last success')).toBeLessThan(html.indexOf('Covers'))
392
+ expect(html).toContain('1d ago')
393
+ expect(html).toContain('the newest run since then failed')
394
+ expect(html).toContain('Open backup nightly-2')
395
+ expect(html).toContain('All 46 runs →')
396
+ expect(html).toContain('46 kept · 1 completed · 1 failed or partially failed')
397
+ expect(html).not.toContain('Schedule activity')
398
+ expect(renderToStaticMarkup(<VeleroScheduleStateBadge reading={reading} />)).toContain('Last run failed')
399
+ })
400
+
401
+ it('reads an unavailable location in plain words, with Velero’s message a click away', () => {
402
+ state.workspace = workspace({ locations: [location({ name: 'dr', phase: 'Unavailable', default: false, defaultSource: 'spec', message: 'rpc error: code = Unknown desc = AccessDenied: Access Denied status code: 403' })] })
403
+ state.stored = { backups: [{ namespace: 'velero', name: 'x', phase: 'Failed' }, { namespace: 'velero', name: 'y', phase: 'Completed' }], restorable: 1, expired: 0, stored: 2 }
404
+ const html = page('backupstoragelocations', {
405
+ metadata: { namespace: 'velero', name: 'dr' },
406
+ spec: { provider: 'aws', objectStorage: { bucket: 'radar-dr', prefix: 'velero' } },
407
+ status: { phase: 'Unavailable', lastSyncedTime: hoursAgo(0.05) },
408
+ })
409
+ expect(html).toContain('Velero’s credentials can’t access the bucket')
410
+ expect(html).toContain('Velero’s message')
411
+ expect(html).toContain('last sync attempt 3m ago')
412
+ const plain = plainText(html)
413
+ expect(plain).toContain('No — default is the default location')
414
+ expect(html).toContain('aws · s3://radar-dr/velero')
415
+ expect(plain).toContain('2 backups · 1 completed · 0 expired · 1 failed')
416
+ expect(plain).toContain('Backups →')
417
+ expect(plain).toContain('None of them can be restored while the location is unavailable')
418
+ expect(plain).toMatch(/Last checked \d+s ago — failed/)
419
+ expect(plain).not.toContain('Last validated')
420
+ expect(plain).toMatch(/Every 1m · last sync attempt/)
421
+ })
422
+
423
+ it('marks a Back up now run among a location’s backups', () => {
424
+ state.stored = { backups: [{ namespace: 'velero', name: 'nightly-1', phase: 'Completed', manual: true }, { namespace: 'velero', name: 'nightly-0', phase: 'Completed' }], restorable: 2, expired: 0, stored: 2 }
425
+ const html = renderToStaticMarkup(<MemoryRouter><VeleroLocationBackups namespace="velero" name="dr" /></MemoryRouter>)
426
+ expect(html.match(/>manual</g)).toHaveLength(1)
427
+ })
428
+
429
+ it('lists a location’s backups with the failed ones a segment away', () => {
430
+ state.stored = { backups: [{ namespace: 'velero', name: 'x', phase: 'Failed' }, { namespace: 'velero', name: 'y', phase: 'Completed' }, { namespace: 'velero', name: 'z', phase: 'PartiallyFailed' }], restorable: 1, expired: 0, stored: 3 }
431
+ const html = plainWords(renderToStaticMarkup(<MemoryRouter><VeleroLocationBackups namespace="velero" name="dr" /></MemoryRouter>))
432
+ expect(html).toContain('3 · 1 completed · 0 expired · 2 failed')
433
+ expect(html).toMatch(/Failed 2/)
434
+ })
435
+
436
+ it('scopes a zero failure count to the backups shown when the location was clipped', () => {
437
+ state.stored = { backups: [{ namespace: 'velero', name: 'recent', phase: 'Completed' }], restorable: 200, expired: 0, stored: 201, truncated: true }
438
+ const html = plainWords(renderToStaticMarkup(<MemoryRouter><VeleroLocationBackups namespace="velero" name="dr" /></MemoryRouter>))
439
+ expect(html).toContain('Failed 0 shown')
440
+ expect(html).toContain('0 failed among the newest 1')
441
+ })
442
+ })
443
+
444
+ describe('The Backups list', () => {
445
+ const run = (name: string, phase: string, schedule?: string, namespace = 'velero') => ({ namespace, name, uid: `${namespace}/${name}`, phase, schedule, started: '2026-11-16T10:00:00Z', errors: 0, warnings: 0 })
446
+ const render = (url: string) =>
447
+ renderToStaticMarkup(
448
+ <MemoryRouter initialEntries={[url]}>
449
+ <VeleroBackups data={workspace({ locations: [location({ name: 'default' })] })} installation={null} onInstallation={() => {}} onInspect={() => {}} inspected={null} onCreate={() => {}} />
450
+ </MemoryRouter>,
451
+ )
452
+ const response = (runs: unknown[], coverage = 'full') => ({ observedAt: '', coverage: { state: coverage }, runs, total: runs.length })
453
+
454
+ it('opens on every run, newest first, with the failed ones counted and a way to create one', () => {
455
+ state.runs = response([run('running-1', 'InProgress'), run('ok-1', 'Completed'), { ...run('bad-1', 'PartiallyFailed'), reason: 'found a backup with status "InProgress" during the server starting, mark it as "Failed"' }, run('rejected-1', 'FailedValidation')])
456
+ const html = text(render('/resources/backups?apiGroup=velero.io'))
457
+ expect(html).toContain('running-1')
458
+ expect(html).toContain('ok-1')
459
+ expect(html).toContain('bad-1')
460
+ expect(html.indexOf('All')).toBeLessThan(html.indexOf('Failed'))
461
+ expect(html).toMatch(/Failed<span[^>]*><span class="text-red[^"]*">2</)
462
+ expect(html).toContain('Velero restarted while this backup ran')
463
+ expect(html).toContain('On demand')
464
+ // jsdom has no matchMedia, so this is the narrow list: nothing past Started.
465
+ expect(html).toContain('>Started<')
466
+ expect(html).not.toContain('>Expires<')
467
+ expect(html).not.toContain('>Errors · warnings<')
468
+ expect(html).toContain('Create Backup')
469
+ expect(html).toContain('Search backups')
470
+ })
471
+
472
+ it('on a narrow screen folds where a backup is stored and when it expires into Started, its counts under its outcome, and cuts run names in the middle', () => {
473
+ state.runs = response([{ ...run('nightly-20261117041210', 'PartiallyFailed', 'nightly'), storageLocation: 'default', errors: 1, expiration: new Date(Date.now() + 5 * 3_600_000).toISOString() }])
474
+ const html = text(render('/resources/backups?apiGroup=velero.io'))
475
+ expect(html).not.toContain('>Stored in<')
476
+ expect(html).toContain('in default')
477
+ expect(html).toMatch(/expires <span[^>]*><span>in [45]h</)
478
+ expect(html).toMatch(/text-red[^"]*">1 error</)
479
+ expect(html).not.toContain('0 warnings')
480
+ expect(html).toContain('<span class="min-w-0 truncate">nightly-20261117</span><span class="shrink-0">041210</span>')
481
+ })
482
+
483
+ it('marks a Back up now run as manual, and says an empty search was over the newest runs when the list was cut', () => {
484
+ state.runs = { ...response([{ ...run('nightly-20261117041210', 'Completed', 'nightly'), manual: true }]), total: 6000, truncated: true }
485
+ const html = text(render('/resources/backups?apiGroup=velero.io'))
486
+ expect(html).toContain('schedule nightly')
487
+ expect(html).toMatch(/ · manual/)
488
+ type RunsData = Parameters<typeof runsEmpty>[0]['data']
489
+ const cut = { ...response([run('a', 'Completed')]), total: 6000, truncated: true } as unknown as RunsData
490
+ expect(runsEmpty({ data: cut, isPending: false, error: null }, 'backups', 'No backups match')).toBe('No backups match in the newest 1.')
491
+ expect(runsEmpty({ data: response([run('a', 'Completed')]) as unknown as RunsData, isPending: false, error: null }, 'backups', 'No backups match')).toBe('No backups match.')
492
+ })
493
+
494
+ it('takes no label filter from a link: a schedule’s runs are on its page', () => {
495
+ state.runs = response([run('a-1', 'Completed', 'a'), run('b-1', 'Completed', 'b')])
496
+ const html = render('/resources/backups?apiGroup=velero.io&labels=velero.io/schedule-name%3Da')
497
+ expect(html).toContain('a-1')
498
+ expect(html).toContain('b-1')
499
+ })
500
+
501
+ it('gives lower bounds over a partial read, and never says there are none', () => {
502
+ state.runs = response([run('bad-1', 'Failed')], 'partial')
503
+ const html = render('/resources/backups?apiGroup=velero.io')
504
+ expect(html).toContain('≥1')
505
+ expect(html).toContain('Counts are lower bounds')
506
+ })
507
+
508
+ it('keeps rows from before a failed refresh, and says so', () => {
509
+ state.runs = response([run('bad-1', 'Failed')])
510
+ state.error = new Error('boom')
511
+ const html = render('/resources/backups?apiGroup=velero.io')
512
+ expect(html).toContain('bad-1')
513
+ expect(html).toContain('The last refresh of backups failed')
514
+ state.error = null
515
+ })
516
+ })