@skyhook-io/radar-app 1.17.1 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +6 -0
  2. package/package.json +10 -11
  3. package/src/App.tsx +36 -36
  4. package/src/api/client.gitops-destination.test.tsx +55 -0
  5. package/src/api/client.gitopsPoll.test.ts +99 -0
  6. package/src/api/client.helmPreview.test.tsx +48 -0
  7. package/src/api/client.resource-list.test.ts +76 -0
  8. package/src/api/client.resourceAvailability.test.ts +24 -0
  9. package/src/api/client.ts +396 -105
  10. package/src/api/client.workloadRuns.test.ts +53 -0
  11. package/src/api/config.test.ts +23 -1
  12. package/src/api/config.ts +7 -3
  13. package/src/api/diagnose.ts +4 -1
  14. package/src/api/drain-plan.test.ts +70 -40
  15. package/src/api/policy.ts +5 -5
  16. package/src/api/quotas.ts +9 -20
  17. package/src/api/radarFeatures.ts +3 -0
  18. package/src/api/resourceLists.test.ts +84 -0
  19. package/src/api/resourceLists.ts +71 -0
  20. package/src/api/traffic.scope.render.test.tsx +60 -0
  21. package/src/api/traffic.ts +3 -1
  22. package/src/components/cnpg/CNPGSummaryHost.tsx +4 -3
  23. package/src/components/cnpg/CNPGView.tsx +1 -0
  24. package/src/components/compare/CompareResourcePicker.test.tsx +58 -0
  25. package/src/components/compare/CompareViewRoute.tsx +5 -1
  26. package/src/components/compare/useCompareCandidates.ts +1 -1
  27. package/src/components/compare/useCompareLauncher.tsx +4 -2
  28. package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
  29. package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
  30. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
  31. package/src/components/diagnose/InvestigationView.tsx +2 -1
  32. package/src/components/diagnose/StoryExcerpt.tsx +24 -5
  33. package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
  34. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
  35. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -51
  36. package/src/components/diagnose/investigationEvidence/adapters/listCoverage.test.ts +415 -0
  37. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
  38. package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
  39. package/src/components/diagnose/investigationEvidence/adapters/resource.ts +107 -8
  40. package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
  41. package/src/components/diagnose/investigationEvidence/bodies/inventory.tsx +66 -16
  42. package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
  43. package/src/components/diagnose/investigationEvidence/builder.ts +13 -1
  44. package/src/components/diagnose/investigationEvidence/excerpt.ts +2 -0
  45. package/src/components/diagnose/investigationEvidence/observations.ts +21 -0
  46. package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
  47. package/src/components/diagnose/investigationEvidence/projection.test.ts +131 -1
  48. package/src/components/diagnose/investigationEvidence/types.ts +26 -0
  49. package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
  50. package/src/components/diagnose/investigationState.test.ts +36 -1
  51. package/src/components/diagnose/investigationState.ts +8 -0
  52. package/src/components/diagnose/launch.ts +2 -2
  53. package/src/components/diagnose/toolCallLabel.test.ts +9 -0
  54. package/src/components/diagnose/toolCallLabel.ts +2 -0
  55. package/src/components/dock/BottomDock.tsx +6 -3
  56. package/src/components/dock/WorkloadLogsTab.tsx +3 -0
  57. package/src/components/execution/BatchExecutionView.image-browse.test.tsx +46 -0
  58. package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
  59. package/src/components/execution/BatchExecutionView.tsx +28 -11
  60. package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
  61. package/src/components/gitops/GitOpsView.identity.test.tsx +113 -0
  62. package/src/components/gitops/GitOpsView.tsx +69 -40
  63. package/src/components/gitops/useDestinationCluster.ts +2 -1
  64. package/src/components/helm/ArtifactHubSourceSearch.test.tsx +124 -0
  65. package/src/components/helm/ArtifactHubSourceSearch.tsx +240 -0
  66. package/src/components/helm/ChartBrowser.tsx +5 -4
  67. package/src/components/helm/HelmReleaseDrawer.tsx +139 -55
  68. package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
  69. package/src/components/helm/HelmReleaseNotes.tsx +26 -0
  70. package/src/components/helm/OwnedResources.tsx +2 -2
  71. package/src/components/helm/TrackChartSourceDialog.render.test.tsx +295 -50
  72. package/src/components/helm/TrackChartSourceDialog.test.ts +3 -2
  73. package/src/components/helm/TrackChartSourceDialog.tsx +614 -85
  74. package/src/components/helm/ValuesDiffPreview.tsx +4 -1
  75. package/src/components/home/ClusterHealthCard.tsx +4 -4
  76. package/src/components/home/CostCard.test.tsx +100 -0
  77. package/src/components/home/CostCard.tsx +2 -2
  78. package/src/components/home/HelmSummary.tsx +2 -2
  79. package/src/components/home/HomeView.tsx +15 -6
  80. package/src/components/home/MCPSetupDialog.test.tsx +30 -0
  81. package/src/components/home/MCPSetupDialog.tsx +13 -6
  82. package/src/components/home/ProblemsPanel.test.tsx +1 -0
  83. package/src/components/home/mcpToolCatalog.ts +28 -2
  84. package/src/components/issues/IssuesPane.render.test.tsx +21 -0
  85. package/src/components/issues/IssuesPane.tsx +31 -7
  86. package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
  87. package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
  88. package/src/components/issues/uncheckedSources.test.ts +43 -0
  89. package/src/components/issues/uncheckedSources.ts +58 -5
  90. package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
  91. package/src/components/resource/PrometheusCharts.overlays.test.ts +45 -0
  92. package/src/components/resource/PrometheusCharts.tsx +2 -2
  93. package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
  94. package/src/components/resources/ImageFilesystemModal.tsx +11 -4
  95. package/src/components/resources/PodFilesystemModal.tsx +2 -2
  96. package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
  97. package/src/components/resources/ResourcesView.tsx +46 -69
  98. package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
  99. package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
  100. package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
  101. package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
  102. package/src/components/resources/renderers/PodRenderer.tsx +4 -1
  103. package/src/components/settings/MyPermissionsDialog.tsx +12 -9
  104. package/src/components/settings/SettingsDialog.tsx +21 -15
  105. package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
  106. package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
  107. package/src/components/traffic/TrafficSourcePill.test.tsx +110 -0
  108. package/src/components/traffic/TrafficSourcePill.tsx +111 -0
  109. package/src/components/traffic/TrafficView.tsx +21 -67
  110. package/src/components/traffic/trafficFilters.test.ts +20 -1
  111. package/src/components/traffic/trafficFilters.ts +13 -0
  112. package/src/components/ui/DiagnosticsOverlay.test.ts +25 -0
  113. package/src/components/ui/DiagnosticsOverlay.tsx +2 -1
  114. package/src/components/ui/Omnibar.note.test.tsx +141 -0
  115. package/src/components/ui/Omnibar.tsx +89 -14
  116. package/src/components/ui/RadarOmnibar.test.tsx +183 -0
  117. package/src/components/ui/RadarOmnibar.tsx +38 -4
  118. package/src/components/ui/Toast.tsx +1 -1
  119. package/src/components/ui/UpdateNotification.manual.test.tsx +177 -0
  120. package/src/components/ui/UpdateNotification.test.tsx +2 -1
  121. package/src/components/ui/UpdateNotification.tsx +29 -5
  122. package/src/components/ui/omnibar-match.test.ts +37 -0
  123. package/src/components/ui/omnibar-match.ts +23 -0
  124. package/src/components/ui/searchCoverage.fixtures.ts +16 -0
  125. package/src/components/ui/searchCoverageNote.test.ts +245 -0
  126. package/src/components/ui/searchCoverageNote.ts +222 -0
  127. package/src/components/whats-new/WhatsNew.test.ts +10 -0
  128. package/src/components/whats-new/WhatsNew.tsx +5 -4
  129. package/src/components/whats-new/WhatsNewDialog.test.tsx +20 -0
  130. package/src/components/whats-new/releaseNotes.ts +57 -5
  131. package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
  132. package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
  133. package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
  134. package/src/components/workload/NodeDrainStatus.tsx +55 -0
  135. package/src/components/workload/WorkloadView.tsx +43 -5
  136. package/src/context/ConnectionContext.test.ts +27 -1
  137. package/src/context/ConnectionContext.tsx +17 -7
  138. package/src/hooks/useResourceCounts.ts +2 -0
  139. package/src/index.css +2 -4
  140. package/src/index.ts +7 -0
  141. package/src/integrations/resourceHosts.test.tsx +1 -0
  142. package/src/integrations/resourceHosts.tsx +2 -0
  143. package/src/utils/artifacthub.test.ts +18 -0
  144. package/src/utils/artifacthub.ts +9 -0
  145. package/src/utils/navigation.ts +14 -0
  146. package/src/utils/wails-clipboard.ts +4 -2
package/README.md CHANGED
@@ -66,3 +66,9 @@ Host apps can override Radar's runtime behavior without passing props:
66
66
  - `setCredentialsMode(mode)` — fetch credentials mode (`same-origin` | `include` | `omit`).
67
67
 
68
68
  Call these before mounting `<RadarApp>`.
69
+
70
+ ## Resource list responses
71
+
72
+ New Radar instances advertise `features.resourceReadCoverage` and return `{items, coverage, kind, group}` for resource lists, with `columns`/`cells` when table mode is requested. `coverage` describes the scope the answer covers, what Radar read of it, and coded gaps; namespace sets are `{count, names?}`, listing every member or none, and a gap's set may instead be `{"extent": "all"}` or `{"extent": "unknown"}`. A failed read answers `{error, error_code, coverage?}`. Lists fail when there is no usable inventory: nothing readable, an oversized result, or a changed connection. Partial lists with loading gaps refetch with 5s, 10s, 20s, then 30s delays; complete coverage or a changed query resets the backoff.
73
+
74
+ Hosts making their own requests can call `normalizeResourceList(body)` from this package. It reads the body by its shape, so it needs no capabilities: a bare array or a table envelope without `coverage` (an older instance) produces `coverage.status: 'unknown'`, which cannot establish absence. The adapter returns `{items, coverage, printerTable}`. `fetchResourceList(kind, options)` uses Radar's configured API base/authentication and applies a server list budget, which older instances ignore.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyhook-io/radar-app",
3
- "version": "1.17.1",
3
+ "version": "1.18.1",
4
4
  "description": "Radar's full web UI as a reusable React component. Used by Radar's own binary and by external consumers like Radar Cloud.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,11 +38,11 @@
38
38
  "react-markdown": "^10.1.0",
39
39
  "react-virtuoso": "^4.18.16",
40
40
  "remark-gfm": "^4.0.1",
41
- "shiki": "^4.4.2",
42
- "yaml": "^2.9.0"
41
+ "shiki": "^4.5.0",
42
+ "yaml": "^2.9.1"
43
43
  },
44
44
  "peerDependencies": {
45
- "@skyhook-io/k8s-ui": ">=1.17.1",
45
+ "@skyhook-io/k8s-ui": ">=1.18.1",
46
46
  "@tanstack/react-query": ">=5",
47
47
  "@xyflow/react": ">=12.0.0",
48
48
  "clsx": ">=2",
@@ -57,23 +57,22 @@
57
57
  "@eslint/js": "^10.0.1",
58
58
  "@playwright/test": "^1.62.0",
59
59
  "@skyhook-io/k8s-ui": "*",
60
- "@tailwindcss/typography": "^0.5.20",
61
60
  "@tailwindcss/vite": "^4.3.3",
62
61
  "@tanstack/react-query": "^5.103.1",
63
62
  "@types/node": "^26.6.2",
64
63
  "@types/react": "^19.3.0",
65
64
  "@types/react-dom": "^19.3.0",
66
- "@vitejs/plugin-react": "^6.1.1",
67
- "@xyflow/react": "^12.11.2",
65
+ "@vitejs/plugin-react": "^6.1.2",
66
+ "@xyflow/react": "^12.12.0",
68
67
  "clsx": "^2.1.1",
69
68
  "elkjs": "^0.11.1",
70
- "eslint": "^10.11.0",
69
+ "eslint": "^10.13.0",
71
70
  "eslint-plugin-react-hooks": "^7.1.1",
72
71
  "eslint-plugin-react-refresh": "^0.5.3",
73
72
  "globals": "^17.11.0",
74
73
  "lucide-react": "^1.48.0",
75
- "postcss": "^8.5.28",
76
- "prettier": "^3.9.9",
74
+ "postcss": "^8.5.30",
75
+ "prettier": "^3.9.10",
77
76
  "react": "^19.3.0",
78
77
  "react-dom": "^19.3.0",
79
78
  "react-router-dom": "^7.18.4",
@@ -81,7 +80,7 @@
81
80
  "tailwindcss": "^4.3.3",
82
81
  "typescript": "^6.0.2",
83
82
  "typescript-eslint": "^8.71.0",
84
- "vite": "^8.3.1"
83
+ "vite": "^8.3.4"
85
84
  },
86
85
  "sideEffects": [
87
86
  "*.css"
package/src/App.tsx CHANGED
@@ -9,7 +9,7 @@ import { DebugOverlay } from './components/DebugOverlay'
9
9
  import { GlobalDiagnoseButton } from './components/diagnose/LocalDiagnoseAction'
10
10
  import { investigationWorkspaceSearch, isInvestigationWorkspacePath, useDiagnoseLayout } from './components/diagnose/DiagnoseContext'
11
11
  import { DiagnoseSurface } from './components/diagnose/DiagnoseSurface'
12
- import { TopologyGraph, TopologySearch, TopologyBreadcrumb, TopologyFilterSidebar, TopologyControls, FreshnessControl, gitOpsRouteForKind, gitOpsRouteForResource, ScopePill, PaneLoader } from '@skyhook-io/k8s-ui'
12
+ import { TopologyGraph, TopologySearch, TopologyBreadcrumb, TopologyFilterSidebar, TopologyControls, FreshnessControl, gitOpsRouteForKind, gitOpsRouteForResource, ScopePill, PaneLoader, usePhoneLayout } from '@skyhook-io/k8s-ui'
13
13
  import { resetNavigationMap } from '@skyhook-io/k8s-ui/utils/navigation'
14
14
  import { topologyNodeResourceKind } from '@skyhook-io/k8s-ui/utils/topology-neighborhood'
15
15
  import { useAPIResources, findAPIResourceForRoute } from './api/apiResources'
@@ -45,7 +45,7 @@ import { navigateFromPrimaryRail } from './components/nav/navigation'
45
45
  import { useNavRailPinned } from './hooks/useNavRailPinned'
46
46
  import { useMediaQuery } from './hooks/useMediaQuery'
47
47
  import { ContextSwitchProvider, useContextSwitch } from './context/ContextSwitchContext'
48
- import { ConnectionProvider, useConnection } from './context/ConnectionContext'
48
+ import { ConnectionProvider, useConnection, refreshQueriesAfterReconnect } from './context/ConnectionContext'
49
49
  import { ConnectionErrorView } from './components/ConnectionErrorView'
50
50
  import { SyncProgressPanel } from './components/SyncProgressPanel'
51
51
  import { NoClusterAccessBanner } from './components/NoClusterAccessBanner'
@@ -77,7 +77,7 @@ import { SettingsDialog, type SettingsSectionId } from './components/settings/Se
77
77
  import type { APIResource, TopologyNode, GroupingMode, MainView, SelectedResource, SelectedHelmRelease, NodeKind, TopologyMode, Topology, K8sEvent } from './types'
78
78
  import { createViewMemory } from './utils/viewMemory'
79
79
  import { createKindFilterStore } from './utils/kindFilterStore'
80
- import { kindToPluralWithGroup, pluralToKind, openExternal, apiVersionToGroup, relatedResourcePath, searchHitToSelectedResource, withCrossViewParams, writeViewParams, CROSS_VIEW_PARAMS } from './utils/navigation'
80
+ import { kindToPluralWithGroup, pluralToKind, openExternal, apiVersionToGroup, relatedResourcePath, searchHitToSelectedResource, withCrossViewParams, writeViewParams, CROSS_VIEW_PARAMS, namespacesFromSearch } from './utils/navigation'
81
81
  import { findSelectedTopologyNode } from './utils/topology-selection'
82
82
  import { type OmnibarHandle } from './components/ui/Omnibar'
83
83
  import { RadarOmnibar } from './components/ui/RadarOmnibar'
@@ -132,6 +132,11 @@ const FLEET_MODE_KINDS = new Set<NodeKind>([
132
132
  // Extended MainView type that includes traffic and cost
133
133
  type ExtendedMainView = MainView | 'traffic' | 'cost' | 'capacity' | 'cnpg' | 'workload' | 'checks' | 'gitops' | 'compare' | 'helmCompare' | 'issues' | 'applications' | 'investigations'
134
134
 
135
+ // Views that have been laid out for phone width (640px and below). The rest
136
+ // keep their desktop width on a phone and scroll sideways; add a view here in
137
+ // the PR that gives it a phone layout.
138
+ const PHONE_READY_VIEWS: ReadonlySet<ExtendedMainView> = new Set<ExtendedMainView>(['issues'])
139
+
135
140
  // Extract view from URL path
136
141
  function getViewFromPath(pathname: string): ExtendedMainView {
137
142
  if (pathname.replace(/\/+$/, '') === '/helm/compare') return 'helmCompare'
@@ -416,24 +421,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
416
421
  }
417
422
  }, [navigate])
418
423
 
419
- // Parse namespaces from URL (supports both 'namespaces' and legacy 'namespace')
420
- const parseNamespacesFromURL = (params: URLSearchParams): string[] => {
421
- // Prefer 'namespaces' (plural, comma-separated)
422
- const nsParam = params.get('namespaces')
423
- if (nsParam) {
424
- return nsParam.split(',').map(s => s.trim()).filter(Boolean)
425
- }
426
- // Fall back to 'namespace' (singular) for backward compatibility
427
- const ns = params.get('namespace')
428
- if (ns) {
429
- return [ns]
430
- }
431
- return []
432
- }
433
-
434
424
  // Initialize state from URL
435
425
  const getInitialState = () => {
436
- const namespaces = parseNamespacesFromURL(searchParams)
426
+ const namespaces = namespacesFromSearch(searchParams)
437
427
  return {
438
428
  namespaces,
439
429
  topologyMode: (searchParams.get('mode') as TopologyMode) || 'resources',
@@ -675,8 +665,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
675
665
  // actually renders) — see further down.
676
666
  const drawerExpanded = !!selectedResource && searchParams.get('full') === '1'
677
667
 
678
- // On mobile there's no room for the side drawer — a resource detail is always full-screen.
679
- const isMobile = useMediaQuery('(max-width: 639px)')
668
+ // On a phone there's no room for the side drawer: a resource detail is always full-screen.
669
+ const isMobile = usePhoneLayout()
670
+ // Views with a deliberate phone layout. On a phone every other view keeps
671
+ // its desktop width and scrolls sideways rather than squeezing.
672
+ const phoneScroll = isMobile && !PHONE_READY_VIEWS.has(mainView)
680
673
 
681
674
  // On a history Pop (back/forward) the URL is authoritative. The URL-write
682
675
  // effect, running with not-yet-synced state, would otherwise write the stale
@@ -1236,11 +1229,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
1236
1229
  onContextChanged: (context) => {
1237
1230
  resetNavigationMap()
1238
1231
 
1239
- // Clear all React Query caches when cluster context changes
1240
- // This ensures helm releases, resources, etc. are refetched from the new cluster
1241
- // removeQueries clears cached data, invalidateQueries triggers refetch
1242
- queryClient.removeQueries()
1243
- queryClient.invalidateQueries()
1232
+ // Reconnects also emit context_changed. Preserve only this context's drain record.
1233
+ refreshQueriesAfterReconnect(queryClient, connection.context, context)
1244
1234
 
1245
1235
  // Cancel any pending SSE-driven invalidation — old cluster's events are irrelevant
1246
1236
  if (fastInvalidationRef.current.timer !== null) clearTimeout(fastInvalidationRef.current.timer)
@@ -1442,11 +1432,13 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
1442
1432
  const setActiveNamespace = useSetActiveNamespace()
1443
1433
  // Defer the state flip to onSuccess. Setting namespaces to [] before the
1444
1434
  // server-side pref has actually been cleared makes React Query refetch
1445
- // under the new empty key while the server still returns the previous
1446
- // pick's scope, caching stale data under the new key with no later
1447
- // invalidation. onSettled would do the same on errors, leaving the UI
1448
- // showing "All namespaces" while data is still namespace-scoped — onSuccess
1449
- // keeps state aligned with the server.
1435
+ // under the new empty key while a Radar that applies the stored pick to
1436
+ // reads naming no namespace (Hub embeds this UI against such Radars) returns
1437
+ // the previous pick's scope, caching stale data under the new key with no
1438
+ // later invalidation.
1439
+ // onSettled would do the same on errors, leaving the UI showing "All
1440
+ // namespaces" while data is still namespace-scoped — onSuccess keeps state
1441
+ // aligned with the server.
1450
1442
  //
1451
1443
  // Don't touch the URL here either: setSearchParams on a still-set state
1452
1444
  // trips the URL→state sync into firing setNamespaces([]) and a duplicate
@@ -1587,7 +1579,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
1587
1579
  // server while the per-user pick was still narrowed — the picker would
1588
1580
  // show the server scope but lists/dashboard would stay on "all namespaces".
1589
1581
  useEffect(() => {
1590
- const urlNamespaces = parseNamespacesFromURL(searchParams)
1582
+ const urlNamespaces = namespacesFromSearch(searchParams)
1591
1583
  debugNamespaceLog('app:url-sync', {
1592
1584
  search: searchParams.toString(),
1593
1585
  urlNamespaces,
@@ -1816,10 +1808,14 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
1816
1808
  {/* Preserve the ~800px content floor: the rail is a fixed-width sibling, so
1817
1809
  the outer minimum must include it (176px pinned / 56px collapsed) or the
1818
1810
  content column (min-w-0, shrinkable) would fall below the old desktop
1819
- floor at small windows. Embedded mode has no rail → plain 800. */}
1811
+ floor at small windows. Embedded mode has no rail → plain 800.
1812
+ Phones get a 360px floor instead (the narrowest current phones): the
1813
+ content column clips horizontally, so the 800px floor hid the right half
1814
+ of every view with no way to scroll to it. Views without a phone layout
1815
+ scroll sideways at desktop width instead (see PHONE_READY_VIEWS). */}
1820
1816
  <div
1821
1817
  className={`relative flex bg-theme-base ${navCustomization.embedded ? 'h-full min-h-0' : 'h-screen'}`}
1822
- style={{ minWidth: 800 + (showNavRail ? (navRailEffectivePinned ? 176 : 56) : 0) }}
1818
+ style={{ minWidth: (isMobile ? 360 : 800) + (showNavRail ? (navRailEffectivePinned ? 176 : 56) : 0) }}
1823
1819
  >
1824
1820
  {showNavRail && (
1825
1821
  <PrimaryNavRail
@@ -2077,7 +2073,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2077
2073
  {/* inert while a fullscreen detail overlay covers the views — keeps the
2078
2074
  retained background list out of the focus order + a11y tree (the visual
2079
2075
  cover already blocks pointer events). */}
2080
- {(contentReady || shellDuringSync) && <div className="flex-1 flex overflow-hidden" inert={expandedView}>
2076
+ {(contentReady || shellDuringSync) && <div className={phoneScroll ? 'flex-1 flex overflow-x-auto overflow-y-hidden' : 'flex-1 flex overflow-hidden'} inert={expandedView}>
2077
+ {/* A view without a phone layout keeps its desktop width on a phone and
2078
+ scrolls sideways; `contents` leaves every other layout untouched. */}
2079
+ <div className={phoneScroll ? 'flex flex-1 min-h-0 min-w-[800px]' : 'contents'}>
2081
2080
  {/* Search included, not just the path: selection inside a view rides in
2082
2081
  the query (?resource=, ?release=), so a path-only key would still
2083
2082
  strand a crash on the view that produced it. */}
@@ -2428,6 +2427,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2428
2427
  {!viewsSyncGated && mainView === 'compare' && <CompareViewRoute />}
2429
2428
 
2430
2429
  </ErrorBoundary>
2430
+ </div>
2431
2431
  </div>}
2432
2432
  </div>{/* /body frame */}
2433
2433
 
@@ -2570,7 +2570,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2570
2570
  {!navCustomization.embedded && <UsageDataPrompt status={usageData.data} />}
2571
2571
 
2572
2572
  {/* Bottom Dock for Terminal/Logs */}
2573
- <BottomDock />
2573
+ <BottomDock viewNamespaces={namespaces} />
2574
2574
 
2575
2575
  {/* Spacer for dock */}
2576
2576
  <DockSpacer />
@@ -0,0 +1,55 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+ import { afterEach, beforeEach, expect, it, vi } from 'vitest'
6
+ import { useGitOpsDestination } from './client'
7
+
8
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
9
+ let root: Root
10
+ let host: HTMLDivElement
11
+ let client: QueryClient
12
+ const requests: string[] = []
13
+
14
+ function Destination({ group }: { group?: string }) {
15
+ useGitOpsDestination('applications', 'shop', 'wordpress', true, group)
16
+ return null
17
+ }
18
+
19
+ beforeEach(() => {
20
+ requests.length = 0
21
+ vi.stubGlobal('fetch', async (input: string | URL | Request) => {
22
+ requests.push(String(input))
23
+ return new Response(JSON.stringify({ server: 'https://destination.example.com', contexts: [] }), { status: 200 })
24
+ })
25
+ client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
26
+ host = document.createElement('div')
27
+ root = createRoot(host)
28
+ })
29
+
30
+ afterEach(async () => {
31
+ await act(async () => root.unmount())
32
+ client.clear()
33
+ vi.unstubAllGlobals()
34
+ })
35
+
36
+ async function render(group?: string) {
37
+ await act(async () => root.render(<QueryClientProvider client={client}><Destination group={group} /></QueryClientProvider>))
38
+ }
39
+
40
+ it('binds destination requests and cached results to the API group', async () => {
41
+ await render('argoproj.io')
42
+ await vi.waitFor(() => expect(requests).toHaveLength(1))
43
+ await render('app.k8s.io')
44
+ await vi.waitFor(() => expect(requests).toHaveLength(2))
45
+ expect(requests[0]).toBe('/api/gitops/destination/applications/shop/wordpress?group=argoproj.io')
46
+ expect(requests[1]).toBe('/api/gitops/destination/applications/shop/wordpress?group=app.k8s.io')
47
+ const entries = client.getQueryCache().findAll({ queryKey: ['gitops-destination'] })
48
+ expect(entries.map((entry) => entry.queryKey.at(-1))).toEqual(['argoproj.io', 'app.k8s.io'])
49
+ })
50
+
51
+ it('preserves the unqualified request used by existing callers', async () => {
52
+ await render()
53
+ await vi.waitFor(() => expect(requests).toHaveLength(1))
54
+ expect(requests[0]).toBe('/api/gitops/destination/applications/shop/wordpress')
55
+ })
@@ -0,0 +1,99 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import {
3
+ ApiError,
4
+ gitopsInsightsRefetchInterval,
5
+ gitopsTreeRefetchInterval,
6
+ } from "./client";
7
+
8
+ type TreeQuery = Parameters<typeof gitopsTreeRefetchInterval>[0];
9
+ type InsightQuery = Parameters<typeof gitopsInsightsRefetchInterval>[0];
10
+ const outage = new TypeError("Failed to fetch");
11
+ const tree = (status: string, data: TreeQuery["state"]["data"], error: unknown = outage): TreeQuery => ({
12
+ state: { status, data, error: status === "error" ? error : null },
13
+ });
14
+ const insight = (status: string, data: InsightQuery["state"]["data"], error: unknown = outage): InsightQuery => ({
15
+ state: { status, data, error: status === "error" ? error : null },
16
+ });
17
+ const gone = new ApiError("Application not found", 404);
18
+
19
+ describe("gitopsTreeRefetchInterval", () => {
20
+ it("asks every 2s while Radar connects to argocd-server", () => {
21
+ expect(gitopsTreeRefetchInterval(tree("success", { healthApiPending: true }))).toBe(2000);
22
+ });
23
+
24
+ it("asks every 30s while Radar retries, no faster than the server re-checks", () => {
25
+ expect(gitopsTreeRefetchInterval(tree("success", { healthApiRetrying: true }))).toBe(30_000);
26
+ });
27
+
28
+ it("stops once health is in", () => {
29
+ expect(gitopsTreeRefetchInterval(tree("success", {}))).toBe(false);
30
+ });
31
+
32
+ it("keeps asking slowly after a failed fetch, so a brief outage doesn't strand the page", () => {
33
+ expect(gitopsTreeRefetchInterval(tree("error", { healthApiRetrying: true }))).toBe(30_000);
34
+ expect(gitopsTreeRefetchInterval(tree("error", { healthApiPending: true }))).toBe(30_000);
35
+ });
36
+
37
+ it("keeps asking through a long Radar or proxy outage", () => {
38
+ expect(gitopsTreeRefetchInterval(tree("error", { healthApiRetrying: true }, new ApiError("Bad Gateway", 502)))).toBe(30_000);
39
+ });
40
+
41
+ it("stops once Radar answers that the Application is gone or can't be read", () => {
42
+ expect(gitopsTreeRefetchInterval(tree("error", { healthApiRetrying: true }, gone))).toBe(false);
43
+ expect(gitopsTreeRefetchInterval(tree("error", { healthApiPending: true }, new ApiError("Forbidden", 403)))).toBe(false);
44
+ });
45
+
46
+ it("does not start polling after a failed fetch of a settled page", () => {
47
+ expect(gitopsTreeRefetchInterval(tree("error", {}))).toBe(false);
48
+ });
49
+ });
50
+
51
+ describe("gitopsInsightsRefetchInterval", () => {
52
+ it("asks every 2s while a sync runs", () => {
53
+ expect(
54
+ gitopsInsightsRefetchInterval(
55
+ insight("success", { summary: { operationPhase: "Running" } }),
56
+ ),
57
+ ).toBe(2000);
58
+ });
59
+
60
+ it("asks every 2s while Radar connects", () => {
61
+ expect(
62
+ gitopsInsightsRefetchInterval(
63
+ insight("success", { capabilities: { argoConnecting: true } }),
64
+ ),
65
+ ).toBe(2000);
66
+ });
67
+
68
+ it("asks every 30s while Radar retries", () => {
69
+ expect(
70
+ gitopsInsightsRefetchInterval(
71
+ insight("success", { capabilities: { argoRetrying: true } }),
72
+ ),
73
+ ).toBe(30_000);
74
+ expect(
75
+ gitopsInsightsRefetchInterval(
76
+ insight("success", { summary: { resourceHealthApiRetrying: true } }),
77
+ ),
78
+ ).toBe(30_000);
79
+ });
80
+
81
+ it("keeps asking slowly after a failed fetch, including during a running sync", () => {
82
+ expect(
83
+ gitopsInsightsRefetchInterval(insight("error", { capabilities: { argoRetrying: true } })),
84
+ ).toBe(30_000);
85
+ expect(
86
+ gitopsInsightsRefetchInterval(insight("error", { summary: { operationPhase: "Running" } })),
87
+ ).toBe(30_000);
88
+ });
89
+
90
+ it("stops once Radar answers that the Application is gone", () => {
91
+ expect(
92
+ gitopsInsightsRefetchInterval(insight("error", { capabilities: { argoRetrying: true } }, gone)),
93
+ ).toBe(false);
94
+ });
95
+
96
+ it("does not poll a settled page", () => {
97
+ expect(gitopsInsightsRefetchInterval(insight("success", {}))).toBe(false);
98
+ });
99
+ });
@@ -0,0 +1,48 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot } from 'react-dom/client'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+ import { afterEach, expect, it, vi } from 'vitest'
6
+ import { HelmSourceSelectionError, useHelmPreviewValues } from './client'
7
+
8
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
9
+ afterEach(() => {
10
+ vi.unstubAllGlobals()
11
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
12
+ })
13
+
14
+ it.each([
15
+ { code: undefined, sourceError: false },
16
+ { code: 'release_changing', sourceError: false },
17
+ { code: 'chart_source_changed', sourceError: true },
18
+ { code: 'chart_source_required', sourceError: true },
19
+ ])('classifies a preview conflict by error code: $code', async ({ code, sourceError }) => {
20
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(
21
+ JSON.stringify({ error: 'preview conflict', errorCode: code }),
22
+ { status: 409, headers: { 'Content-Type': 'application/json' } },
23
+ )))
24
+ let mutate: ReturnType<typeof useHelmPreviewValues>['mutateAsync'] | undefined
25
+ function Probe() {
26
+ mutate = useHelmPreviewValues().mutateAsync
27
+ return null
28
+ }
29
+ const client = new QueryClient({ defaultOptions: { mutations: { retry: false } } })
30
+ const root = createRoot(document.createElement('div'))
31
+ try {
32
+ await act(async () => root.render(<QueryClientProvider client={client}><Probe /></QueryClientProvider>))
33
+ let failure: unknown
34
+ await act(async () => {
35
+ if (!mutate) throw new Error('Preview hook did not mount')
36
+ try {
37
+ await mutate({ namespace: 'default', name: 'demo', values: {} })
38
+ } catch (error) {
39
+ failure = error
40
+ }
41
+ })
42
+ expect(failure).toBeInstanceOf(Error)
43
+ expect(failure instanceof HelmSourceSelectionError).toBe(sourceError)
44
+ } finally {
45
+ await act(async () => root.unmount())
46
+ client.clear()
47
+ }
48
+ })
@@ -0,0 +1,76 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest'
2
+ import { ApiError, fetchResourceList, isListTooLargeError, isUnretryableReadError } from './client'
3
+ import { setApiBase, setAuthHeadersProvider, setCredentialsMode } from './config'
4
+
5
+ afterEach(() => {
6
+ vi.unstubAllGlobals()
7
+ setApiBase('/api')
8
+ setAuthHeadersProvider(() => ({}))
9
+ setCredentialsMode('same-origin')
10
+ })
11
+
12
+ const coverage = { status: 'complete', scope: { type: 'all_namespaces' }, read: { type: 'all_namespaces' }, gaps: [] }
13
+ const envelope = { items: [], kind: 'pods', coverage, columns: null, cells: null }
14
+
15
+ describe('resource list transport', () => {
16
+ it('uses the configured cluster route and auth with a bounded list', async () => {
17
+ setApiBase('/c/cluster/api')
18
+ setAuthHeadersProvider(() => ({ Authorization: 'Bearer test' }))
19
+ setCredentialsMode('include')
20
+ const mock = vi.fn(async (url: RequestInfo | URL, init?: RequestInit) => {
21
+ expect(url).toBe('/c/cluster/api/resources/pods?namespaces=alpha&maxItems=25000')
22
+ expect(init?.credentials).toBe('include')
23
+ expect(new Headers(init?.headers).get('Authorization')).toBe('Bearer test')
24
+ return new Response(JSON.stringify(envelope), { status: 200 })
25
+ })
26
+ vi.stubGlobal('fetch', mock)
27
+ expect((await fetchResourceList('pods', { namespaces: ['alpha'] })).coverage).toEqual(coverage)
28
+ expect(mock).toHaveBeenCalledTimes(1)
29
+ })
30
+ it('uses the summary budget only for summary requests', async () => {
31
+ vi.stubGlobal('fetch', vi.fn(async (url: RequestInfo | URL) => {
32
+ expect(url).toBe('/api/resources/pods?include=summary&maxItems=50000')
33
+ return new Response(JSON.stringify(envelope), { status: 200 })
34
+ }))
35
+ await fetchResourceList('pods', { summary: true })
36
+ })
37
+ it('reads an older Radar array, sent the same budget it ignores, without inventing complete coverage', async () => {
38
+ const mock = vi.fn(async (url: RequestInfo | URL) => {
39
+ expect(url).toBe('/api/resources/pods?maxItems=25000')
40
+ return new Response('[{"metadata":{"name":"api"}}]', { status: 200 })
41
+ })
42
+ vi.stubGlobal('fetch', mock)
43
+ const result = await fetchResourceList('pods')
44
+ expect(result.items).toEqual([{ metadata: { name: 'api' } }])
45
+ expect(result.coverage).toEqual({ status: 'unknown' })
46
+ expect(mock).toHaveBeenCalledTimes(1)
47
+ })
48
+ it('preserves oversized-list errors instead of returning empty rows', async () => {
49
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ error: 'Too many resources to load; select fewer namespaces', error_code: 'list_too_large', count: 30000, limit: 25000 }), { status: 400, headers: { 'Content-Type': 'application/json' } })))
50
+ const error = await fetchResourceList('pods').catch((e: unknown) => e)
51
+ expect(error).toMatchObject({ status: 400, data: { error_code: 'list_too_large', count: 30000 } })
52
+ expect(isListTooLargeError(error)).toBe(true)
53
+ expect(isListTooLargeError(new ApiError('failed', 400, { error: 'failed', error_code: 'kind_unknown' }))).toBe(false)
54
+ })
55
+ })
56
+
57
+ describe('read errors that a retry cannot answer', () => {
58
+ const failure = (status: number, error_code?: string) => new ApiError('failed', status, error_code ? { error: 'failed', error_code } : { error: 'failed' })
59
+
60
+ it('stops on a request, access or collection problem', () => {
61
+ expect(isUnretryableReadError(failure(400, 'list_too_large'))).toBe(true)
62
+ expect(isUnretryableReadError(failure(400, 'kind_unknown'))).toBe(true)
63
+ expect(isUnretryableReadError(failure(409, 'radar_namespace_not_collected'))).toBe(true)
64
+ expect(isUnretryableReadError(failure(403, 'user_forbidden'))).toBe(true)
65
+ expect(isUnretryableReadError(failure(503, 'kind_sync_timed_out'))).toBe(true)
66
+ // The spellings Radar releases before the shared vocabulary sent.
67
+ expect(isUnretryableReadError(failure(403, 'rbac_denied'))).toBe(true)
68
+ expect(isUnretryableReadError(failure(503, 'kind_sync_failed'))).toBe(true)
69
+ })
70
+ it('retries what may answer on its own', () => {
71
+ expect(isUnretryableReadError(failure(503, 'kind_sync_pending'))).toBe(false)
72
+ expect(isUnretryableReadError(failure(500, 'read_error'))).toBe(false)
73
+ expect(isUnretryableReadError(failure(503))).toBe(false)
74
+ expect(isUnretryableReadError(new Error('network'))).toBe(false)
75
+ })
76
+ })
@@ -0,0 +1,24 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest'
2
+ import { ApiError, fetchResourceAvailability } from './client'
3
+
4
+ afterEach(() => vi.unstubAllGlobals())
5
+
6
+ describe('resource availability checks', () => {
7
+ it.each([200, 404])('uses a body-free HEAD lookup for resource status %s', async status => {
8
+ const fetch = vi.fn<typeof globalThis.fetch>(async () => new Response(null, { status, headers: { 'X-Radar-Resource-Read': 'true' } }))
9
+ vi.stubGlobal('fetch', fetch)
10
+ expect(await fetchResourceAvailability('secrets', 'apps', 'credentials')).toBe(status === 200 ? 'present' : 'missing')
11
+ expect(fetch).toHaveBeenCalledOnce()
12
+ expect(fetch.mock.calls[0]?.[1]).toMatchObject({ method: 'HEAD' })
13
+ })
14
+
15
+ it.each([403, 404, 503])('does not classify an upstream HTTP %s as a missing resource', async status => {
16
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(null, { status })))
17
+ await expect(fetchResourceAvailability('configmaps', 'apps', 'overrides')).rejects.toBeInstanceOf(ApiError)
18
+ })
19
+
20
+ it.each([200, 405])('keeps older Radar navigation without claiming availability for HTTP %s', async status => {
21
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(null, { status })))
22
+ expect(await fetchResourceAvailability('secrets', 'apps', 'credentials')).toBe('unchecked')
23
+ })
24
+ })