@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
@@ -14,6 +14,15 @@ describe("describeToolCall", () => {
14
14
  ).toBe("Listing Ingresses");
15
15
  });
16
16
 
17
+ it("scopes the runtime inventory to its namespace", () => {
18
+ expect(describeToolCall("get_runtime_versions", JSON.stringify({ runtime: "php" }))).toBe(
19
+ "Reading runtime versions of running images",
20
+ );
21
+ expect(
22
+ describeToolCall("get_runtime_versions", JSON.stringify({ namespace: "shop", runtime: "php" })),
23
+ ).toBe("Reading runtime versions of running images in shop");
24
+ });
25
+
17
26
  it("names the target from the call's arguments", () => {
18
27
  expect(
19
28
  describeToolCall(
@@ -68,6 +68,8 @@ export function describeToolCall(tool: string, args?: string): string {
68
68
  return "Running the cluster audit";
69
69
  case "get_cluster_upgrade_readiness":
70
70
  return "Checking upgrade readiness";
71
+ case "get_runtime_versions":
72
+ return scoped("Reading runtime versions of running images");
71
73
  case "apply_resource":
72
74
  return "Applying the change";
73
75
  case "patch_resource":
@@ -1,3 +1,4 @@
1
+ import { useCallback } from 'react'
1
2
  import { BottomDock as K8sBottomDock, DockTab, useDock, Input } from '@skyhook-io/k8s-ui'
2
3
  import { TerminalTab } from './TerminalTab'
3
4
  import { LogsTab } from './LogsTab'
@@ -8,7 +9,7 @@ import { TrafficFlowListTab } from './TrafficFlowListTab'
8
9
  import { useFlowSearch } from '../traffic/TrafficFlowListContext'
9
10
  import { Search } from 'lucide-react'
10
11
 
11
- function renderTabContent(tab: DockTab, isActive: boolean) {
12
+ function renderTabContent(tab: DockTab, isActive: boolean, viewNamespaces: string[]) {
12
13
  if (tab.type === 'terminal') {
13
14
  return (
14
15
  <TerminalTab
@@ -40,6 +41,7 @@ function renderTabContent(tab: DockTab, isActive: boolean) {
40
41
  namespace={tab.namespace!}
41
42
  workloadKind={tab.workloadKind!}
42
43
  workloadName={tab.workloadName!}
44
+ viewNamespaces={viewNamespaces}
43
45
  />
44
46
  )
45
47
  }
@@ -90,8 +92,9 @@ function renderTabHeaderExtra(tab: DockTab) {
90
92
  return null
91
93
  }
92
94
 
93
- export function BottomDock() {
95
+ export function BottomDock({ viewNamespaces }: { viewNamespaces: string[] }) {
94
96
  const { leftOffset, tabs } = useDock()
95
97
  const hasTrafficFlows = tabs.some(t => t.type === 'traffic-flows')
96
- return <K8sBottomDock renderTabContent={renderTabContent} renderTabHeaderExtra={renderTabHeaderExtra} leftOffset={leftOffset} defaultHeight={hasTrafficFlows ? 300 : undefined} />
98
+ const renderContent = useCallback((tab: DockTab, isActive: boolean) => renderTabContent(tab, isActive, viewNamespaces), [viewNamespaces])
99
+ return <K8sBottomDock renderTabContent={renderContent} renderTabHeaderExtra={renderTabHeaderExtra} leftOffset={leftOffset} defaultHeight={hasTrafficFlows ? 300 : undefined} />
97
100
  }
@@ -5,12 +5,14 @@ interface WorkloadLogsTabProps {
5
5
  namespace: string
6
6
  workloadKind: string
7
7
  workloadName: string
8
+ viewNamespaces?: string[]
8
9
  }
9
10
 
10
11
  export function WorkloadLogsTab({
11
12
  namespace,
12
13
  workloadKind,
13
14
  workloadName,
15
+ viewNamespaces,
14
16
  }: WorkloadLogsTabProps) {
15
17
  const normalizedKind = workloadKind.toLowerCase()
16
18
  const isScheduled = normalizedKind === 'cronjob' || normalizedKind === 'cronjobs' ||
@@ -27,6 +29,7 @@ export function WorkloadLogsTab({
27
29
  kind={workloadKind}
28
30
  namespace={namespace}
29
31
  name={workloadName}
32
+ viewNamespaces={viewNamespaces}
30
33
  />
31
34
  ) : (
32
35
  <WorkloadLogsViewer
@@ -0,0 +1,46 @@
1
+ import { renderToStaticMarkup } from 'react-dom/server'
2
+ import { describe, expect, it, vi } from 'vitest'
3
+ import { BatchExecutionFullscreen } from './BatchExecutionView'
4
+
5
+ const auth = vi.hoisted(() => ({ enabled: false }))
6
+
7
+ vi.mock('../../api/client', () => ({
8
+ useResource: () => ({}),
9
+ useWorkloadPods: () => ({}),
10
+ useJobSetResources: () => ({ data: undefined, isLoading: false }),
11
+ useWorkloadRuns: () => ({ isLoading: false, error: undefined, data: { collection: 'runs', runs: [], total: 0, truncated: false } }),
12
+ useImageMetadata: () => ({ data: undefined, isLoading: false, error: undefined }),
13
+ ApiError: class ApiError extends Error {},
14
+ }))
15
+
16
+ vi.mock('../../contexts/CapabilitiesContext', async (importOriginal) => ({
17
+ ...(await importOriginal<typeof import('../../contexts/CapabilitiesContext')>()),
18
+ useIsAuthEnabled: () => auth.enabled,
19
+ }))
20
+
21
+ const image = 'trafex/php-nginx:3.6.0'
22
+
23
+ function render() {
24
+ return renderToStaticMarkup(
25
+ <BatchExecutionFullscreen
26
+ kind="CronJob" apiKind="cronjobs" namespace="legacy" name="nightly-invoice"
27
+ resource={{ spec: { schedule: '0 3 * * *', jobTemplate: { spec: { template: { spec: { containers: [{ name: 'invoice', image }] } } } } }, status: {} }}
28
+ />,
29
+ )
30
+ }
31
+
32
+ describe('template image in the run view', () => {
33
+ it('opens the image browser when auth is off', () => {
34
+ auth.enabled = false
35
+ const html = render()
36
+ expect(html).toMatch(new RegExp(`<button[^>]*>${image}</button>`))
37
+ expect(html).not.toContain('decoration-dotted')
38
+ })
39
+
40
+ it('stays text and marks the explanation when auth is on, where a template has no Pod to browse through', () => {
41
+ auth.enabled = true
42
+ const html = render()
43
+ expect(html).not.toMatch(new RegExp(`<button[^>]*>${image}</button>`))
44
+ expect(html).toMatch(new RegExp(`<span class="[^"]*decoration-dotted[^"]*" tabindex="0">${image}<span class="sr-only">. With sign-in on, browse an image&#x27;s files from one of its Pods.</span></span>`))
45
+ })
46
+ })
@@ -2,13 +2,28 @@ import { renderToStaticMarkup } from 'react-dom/server'
2
2
  import { describe, expect, it, vi } from 'vitest'
3
3
  import { BatchExecutionFullscreen } from './BatchExecutionView'
4
4
 
5
+ const runQueryState = vi.hoisted(() => {
6
+ const state: { isLoading: boolean; error: Error | undefined } = { isLoading: false, error: undefined }
7
+ return state
8
+ })
9
+
5
10
  vi.mock('../../api/client', () => ({
6
11
  useResource: () => ({}),
7
12
  useWorkloadPods: () => ({}),
8
13
  useJobSetResources: () => ({ data: undefined, isLoading: false }),
9
- useWorkloadRuns: () => ({ data: { collection: 'runs', runs: [], total: 0, truncated: false } }),
14
+ useWorkloadRuns: () => ({ ...runQueryState, data: { collection: 'runs', runs: [], total: 0, truncated: false } }),
10
15
  }))
11
16
 
17
+ it('keeps CronJob configuration distinct from scheduling and completion', () => {
18
+ const html = renderToStaticMarkup(<BatchExecutionFullscreen
19
+ kind="CronJob" apiKind="cronjobs" namespace="default" name="nightly"
20
+ resource={{ spec: { schedule: '0 * * * *', timeZone: 'UTC', startingDeadlineSeconds: 0 }, status: {} }}
21
+ />)
22
+ expect(html).toContain('Enabled')
23
+ expect(html).toContain('>UTC<')
24
+ expect(html).toContain('>0s<')
25
+ })
26
+
12
27
  describe.each(['Job', 'CronJob', 'ScaledJob'])('%s cleanup retention display', (kind) => {
13
28
  function render(ttlSecondsAfterFinished?: number) {
14
29
  const jobSpec = { ttlSecondsAfterFinished, activeDeadlineSeconds: 60 }
@@ -34,3 +49,16 @@ describe.each(['Job', 'CronJob', 'ScaledJob'])('%s cleanup retention display', (
34
49
  expect(render()).not.toContain('TTL after finish')
35
50
  })
36
51
  })
52
+
53
+ it.each(['loading', 'error'])('keeps scheduling evidence visible while run history is %s', (state) => {
54
+ runQueryState.isLoading = state === 'loading'
55
+ runQueryState.error = state === 'error' ? new Error('history unavailable') : undefined
56
+ try {
57
+ const html = renderToStaticMarkup(<BatchExecutionFullscreen kind="CronJob" apiKind="cronjobs" namespace="default" name="nightly" resource={{ spec: {} }} leadContent={<p>Scheduling error reported</p>} />)
58
+ expect(html).toContain('Scheduling error reported')
59
+ if (state === 'error') expect(html).toContain('Run history unavailable')
60
+ } finally {
61
+ runQueryState.isLoading = false
62
+ runQueryState.error = undefined
63
+ }
64
+ })
@@ -26,6 +26,7 @@ import type { WorkloadPodInfo } from '../../types'
26
26
  import { getScaledJobStatus } from '../resources/resource-utils-keda'
27
27
  import { Tooltip } from '../ui/Tooltip'
28
28
  import { ImageFilesystemModal } from '../resources/ImageFilesystemModal'
29
+ import { useIsAuthEnabled } from '../../contexts/CapabilitiesContext'
29
30
  import { executionDefinitionDiffers, executionDefinitionSummary, type ExecutionDefinitionSummary, type ExecutionUnitSummary } from './execution-definition'
30
31
  import { batchRunHasContainerOutcome, batchRunNextStep, isFailedRunPhase, type BatchRunNextStep } from './batch-run-actions'
31
32
  import { JobSetAdmission } from './JobSetAdmission'
@@ -105,6 +106,7 @@ function mergeWorkflowArguments(base: any, overlay: any): any {
105
106
  }
106
107
 
107
108
  interface BatchExecutionProps {
109
+ leadContent?: ReactNode
108
110
  kind: string
109
111
  apiKind: string
110
112
  namespace: string
@@ -116,9 +118,11 @@ interface BatchExecutionProps {
116
118
  onSwitchToLogs?: () => void
117
119
  onSwitchToTimeline?: () => void
118
120
  onNavigateToResource?: (resource: ResourceNavigationTarget) => void
121
+ /** The view's namespace selection; narrows a cluster-scoped template's runs. */
122
+ viewNamespaces?: string[]
119
123
  }
120
124
 
121
- export function BatchExecutionFullscreen({ kind, apiKind, namespace, name, resource, selectedRunKey = '', canViewLogs = false, onSelectRun, onSwitchToLogs, onSwitchToTimeline, onNavigateToResource }: BatchExecutionProps) {
125
+ export function BatchExecutionFullscreen({ leadContent, kind, apiKind, namespace, name, resource, selectedRunKey = '', canViewLogs = false, onSelectRun, onSwitchToLogs, onSwitchToTimeline, onNavigateToResource, viewNamespaces }: BatchExecutionProps) {
122
126
  const scheduled = SCHEDULED_KINDS.has(kind)
123
127
  const clusterScoped = kind === 'ClusterWorkflowTemplate'
124
128
  const jobSetRoot = isJobSetV1Alpha2(resource)
@@ -127,7 +131,7 @@ export function BatchExecutionFullscreen({ kind, apiKind, namespace, name, resou
127
131
  const debouncedSearch = useDebouncedValue(runSearch, 250, value => value === '')
128
132
  const [roleFilter, setRoleFilter] = useState('')
129
133
  const memberOptions = { role: roleFilter, search: debouncedSearch, state: runFilter, selected: selectedRunKey }
130
- const runsQuery = useWorkloadRuns(apiKind, namespace, name, true, { refetchActive: true, clusterScoped, ...(jobSetRoot ? memberOptions : {}) })
134
+ const runsQuery = useWorkloadRuns(apiKind, namespace, name, true, { refetchActive: true, clusterScoped, namespaces: viewNamespaces, ownerUID: kind === 'CronJob' ? resource.metadata?.uid : undefined, ...(jobSetRoot ? memberOptions : {}) })
131
135
  const resourcesQuery = useJobSetResources(namespace, name, jobSetRoot ? resource.metadata?.uid : undefined, memberOptions)
132
136
  const memberCollection = runsQuery.data?.collection === 'members'
133
137
  const memberShell = memberCollection || (!runsQuery.data && jobSetRoot)
@@ -251,12 +255,18 @@ export function BatchExecutionFullscreen({ kind, apiKind, namespace, name, resou
251
255
  : 'Radar could not load retained runs.'
252
256
 
253
257
  if (runsQuery.isLoading && !jobSetRoot) {
254
- return <FetchResult loading className="h-full" />
258
+ return (
259
+ <div className="flex h-full min-h-0 flex-col">
260
+ {leadContent && <div className="p-4">{leadContent}</div>}
261
+ <FetchResult loading className="min-h-0 flex-1" />
262
+ </div>
263
+ )
255
264
  }
256
265
 
257
266
  if (runsQuery.error && !jobSetRoot) {
258
267
  return (
259
- <div className="p-4">
268
+ <div className="space-y-4 p-4">
269
+ {leadContent && <div className="space-y-4">{leadContent}</div>}
260
270
  <EmptyState
261
271
  tone="neutral"
262
272
  variant="card"
@@ -339,6 +349,7 @@ export function BatchExecutionFullscreen({ kind, apiKind, namespace, name, resou
339
349
 
340
350
  <main className="min-w-0 flex-1 overflow-auto">
341
351
  <div className="space-y-4 p-4">
352
+ {leadContent && <div className="space-y-4">{leadContent}</div>}
342
353
  {jobSetRoot && (
343
354
  <section className="rounded-lg border border-theme-border bg-theme-surface p-4" aria-label="JobSet overview">
344
355
  <JobSetRenderer data={resource} mode="overview" shownMemberCounts={shownMemberCounts} onSelectRole={memberCollection ? selectRole : undefined} />
@@ -560,7 +571,7 @@ function sourceFacts(kind: string, resource: any, runs: WorkloadRun[]) {
560
571
  const definition = executionDefinitionSummary(kind, resource)
561
572
  if (kind === 'CronJob') {
562
573
  return {
563
- state: spec.suspend ? 'Suspended' : (status.active?.length ?? 0) > 0 ? 'Active' : 'Scheduled',
574
+ state: spec.suspend ? 'Suspended' : (status.active?.length ?? 0) > 0 ? 'Active' : 'Enabled',
564
575
  stateTone: spec.suspend ? 'warning' : 'info',
565
576
  schedule: spec.schedule,
566
577
  concurrency: spec.concurrencyPolicy || 'Allow',
@@ -570,7 +581,8 @@ function sourceFacts(kind: string, resource: any, runs: WorkloadRun[]) {
570
581
  facts: [
571
582
  ['Last schedule', status.lastScheduleTime ? formatTimeAgo(status.lastScheduleTime) : 'Never'],
572
583
  ['Last success', status.lastSuccessfulTime ? formatTimeAgo(status.lastSuccessfulTime) : 'Never'],
573
- ['Starting deadline', spec.startingDeadlineSeconds ? `${spec.startingDeadlineSeconds}s` : 'None'],
584
+ ['Time zone', spec.timeZone ?? 'Controller local time (zone not reported)'],
585
+ ['Starting deadline', spec.startingDeadlineSeconds != null ? `${spec.startingDeadlineSeconds}s` : 'None'],
574
586
  ],
575
587
  definition,
576
588
  }
@@ -720,18 +732,21 @@ function ExecutionDefinitionDetails({ summary, namespace, compact = false }: { s
720
732
 
721
733
  function ExecutionUnitDetails({ unit, namespace, pullSecrets, compact }: { unit: ExecutionUnitSummary; namespace: string; pullSecrets: string[]; compact: boolean }) {
722
734
  const [browseImage, setBrowseImage] = useState(false)
735
+ const authEnabled = useIsAuthEnabled()
736
+ // With auth on, images are browsed through a Pod; a template has none.
737
+ const canBrowseImage = !authEnabled
723
738
  return (
724
739
  <>
725
740
  <div className={clsx(!compact && 'rounded-md bg-theme-elevated/40 px-3 py-2')}>
726
741
  {!compact && <div className="mb-1 flex items-center justify-between gap-3"><span className="truncate text-xs font-medium text-theme-text-primary">{unit.name}</span><span className="text-[10px] uppercase tracking-wide text-theme-text-tertiary">{unit.type}</span></div>}
727
742
  <div className="space-y-1">
728
- {unit.image && <DefinitionFact label="Image" value={unit.image} mono onClick={() => setBrowseImage(true)} tooltip="Browse image filesystem from registry" />}
743
+ {unit.image && <DefinitionFact label="Image" value={unit.image} mono onClick={canBrowseImage ? () => setBrowseImage(true) : undefined} tooltip={canBrowseImage ? 'Browse image filesystem from registry' : IMAGE_BROWSE_VIA_POD} hint={!canBrowseImage} />}
729
744
  {unit.command && <DefinitionFact label="Command" value={unit.command} mono />}
730
745
  {!compact && unit.requests && <DefinitionFact label="Requests" value={unit.requests} />}
731
746
  {!compact && unit.limits && <DefinitionFact label="Limits" value={unit.limits} />}
732
747
  </div>
733
748
  </div>
734
- {unit.image && (
749
+ {unit.image && canBrowseImage && (
735
750
  <ImageFilesystemModal
736
751
  open={browseImage}
737
752
  onClose={() => setBrowseImage(false)}
@@ -745,15 +760,17 @@ function ExecutionUnitDetails({ unit, namespace, pullSecrets, compact }: { unit:
745
760
  )
746
761
  }
747
762
 
748
- function DefinitionFact({ label, value, mono = false, onClick, tooltip }: { label: string; value: string; mono?: boolean; onClick?: () => void; tooltip?: string }) {
749
- const valueClassName = clsx('break-words text-theme-text-primary', mono && 'font-mono text-xs', onClick && 'text-accent-text hover:underline')
763
+ const IMAGE_BROWSE_VIA_POD = "With sign-in on, browse an image's files from one of its Pods."
764
+
765
+ function DefinitionFact({ label, value, mono = false, onClick, tooltip, hint = false }: { label: string; value: string; mono?: boolean; onClick?: () => void; tooltip?: string; hint?: boolean }) {
766
+ const valueClassName = clsx('break-words text-theme-text-primary', mono && 'font-mono text-xs', onClick && 'text-accent-text hover:underline', hint && 'cursor-help underline decoration-dotted decoration-theme-text-tertiary underline-offset-2')
750
767
  return (
751
768
  <div className="flex items-start justify-between gap-3 text-sm">
752
769
  <span className="shrink-0 text-theme-text-tertiary">{label}</span>
753
770
  <Tooltip content={tooltip ?? value} delay={300} wrapperClassName="min-w-0 text-right">
754
771
  {onClick
755
772
  ? <button type="button" onClick={onClick} className={clsx(valueClassName, 'text-right')}>{value}</button>
756
- : <span className={valueClassName}>{value}</span>}
773
+ : <span className={valueClassName} tabIndex={hint ? 0 : undefined}>{value}{hint && tooltip && <span className="sr-only">. {tooltip}</span>}</span>}
757
774
  </Tooltip>
758
775
  </div>
759
776
  )
@@ -0,0 +1,42 @@
1
+ import { renderToStaticMarkup } from 'react-dom/server'
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
3
+ import { BatchExecutionFullscreen } from './BatchExecutionView'
4
+ import { ScheduledWorkloadLogsViewer } from '../logs/ScheduledWorkloadLogsViewer'
5
+ import { WorkloadLogsTab } from '../dock/WorkloadLogsTab'
6
+
7
+ const runs = vi.hoisted(() => vi.fn(() => ({ data: { collection: 'runs', runs: [], total: 0, truncated: false } })))
8
+
9
+ vi.mock('../../api/client', () => ({
10
+ useResource: () => ({}),
11
+ useWorkloadPods: () => ({}),
12
+ useJobSetResources: () => ({ data: undefined, isLoading: false }),
13
+ useWorkloadRuns: runs,
14
+ }))
15
+ vi.mock('../logs/WorkloadLogsViewer', () => ({ WorkloadLogsViewer: () => null }))
16
+
17
+ const view = ['team-a', 'team-b']
18
+
19
+ function runsOptions() {
20
+ return (runs.mock.calls.at(-1) as unknown[] | undefined)?.[4]
21
+ }
22
+
23
+ beforeEach(() => runs.mockClear())
24
+
25
+ // A ClusterWorkflowTemplate's runs span namespaces; every surface listing them
26
+ // narrows them to the view's selection.
27
+ describe('cluster-scoped template runs follow the view selection', () => {
28
+ it('in the execution overview', () => {
29
+ renderToStaticMarkup(<BatchExecutionFullscreen kind="ClusterWorkflowTemplate" apiKind="clusterworkflowtemplates" namespace="" name="build" resource={{ spec: {} }} viewNamespaces={view} />)
30
+ expect(runsOptions()).toMatchObject({ clusterScoped: true, namespaces: view })
31
+ })
32
+
33
+ it('in the logs tab', () => {
34
+ renderToStaticMarkup(<ScheduledWorkloadLogsViewer kind="clusterworkflowtemplates" namespace="" name="build" viewNamespaces={view} />)
35
+ expect(runsOptions()).toMatchObject({ clusterScoped: true, namespaces: view })
36
+ })
37
+
38
+ it('in the dock', () => {
39
+ renderToStaticMarkup(<WorkloadLogsTab namespace="" workloadKind="ClusterWorkflowTemplate" workloadName="build" viewNamespaces={view} />)
40
+ expect(runsOptions()).toMatchObject({ clusterScoped: true, namespaces: view })
41
+ })
42
+ })
@@ -0,0 +1,113 @@
1
+ import { describe, expect, it, vi } from 'vitest'
2
+ import { renderToString } from 'react-dom/server'
3
+ import { MemoryRouter } from 'react-router-dom'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+
6
+ const destinationRequest = vi.hoisted(() => vi.fn())
7
+ const state = vi.hoisted(() => ({ apiVersion: 'app.k8s.io/v1beta1', loading: false, treeLoading: false, kind: 'Application', error: '', remote: false }))
8
+ vi.mock('../../api/client', async (importOriginal) => {
9
+ const actual = await importOriginal<typeof import('../../api/client')>()
10
+ return {
11
+ ...actual,
12
+ useResource: () => ({ isLoading: state.loading, error: state.error ? new Error(state.error) : null, data: state.loading || state.error ? undefined : {
13
+ apiVersion: state.apiVersion, kind: state.kind, metadata: { name: 'wordpress', namespace: 'shop' },
14
+ spec: { project: 'default', destination: { server: 'https://kubernetes.default.svc' } },
15
+ status: { sync: { status: 'Synced' }, health: { status: 'Healthy' }, conditions: [{ type: 'Ready', status: 'True' }] },
16
+ } }),
17
+ useGitOpsTree: () => ({ isLoading: state.treeLoading, error: null, data: undefined }),
18
+ useGitOpsInsights: () => ({ isLoading: false, error: null, data: state.remote ? { summary: { tool: 'argocd', remoteDestination: true }, issues: [], changes: [], history: [], plan: [], capabilities: {} } : undefined }),
19
+ }
20
+ })
21
+ vi.mock('../ui/Toast', () => ({ useToast: () => ({ showError: vi.fn(), showSuccess: vi.fn(), showToast: vi.fn() }) }))
22
+ vi.mock('../useContextSwitchFlow', () => ({ useContextSwitchFlow: () => ({ confirmDialog: null }) }))
23
+ vi.mock('./useDestinationCluster', () => ({ useDestinationCluster: (...args: unknown[]) => { destinationRequest(...args); return {} } }))
24
+ vi.mock('../../hooks/useKeyboardShortcuts', () => ({ useRegisterShortcut: () => {} }))
25
+ vi.mock('../../hooks/usePreviousIntegrationSettings', () => ({ usePreviousIntegrationSettings: () => ({}), previousSettingsNote: () => undefined }))
26
+
27
+ import { GitOpsView } from './GitOpsView'
28
+
29
+ function render(group = 'argoproj.io', kind = 'applications') {
30
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
31
+ const html = renderToString(
32
+ <QueryClientProvider client={client}>
33
+ <MemoryRouter initialEntries={[`/gitops/detail/${kind}/shop/wordpress?apiGroup=${group}`]}>
34
+ <GitOpsView namespaces={[]} onOpenResource={() => {}} />
35
+ </MemoryRouter>
36
+ </QueryClientProvider>,
37
+ )
38
+ client.clear()
39
+ return html
40
+ }
41
+
42
+ describe('GitOps detail identity', () => {
43
+ it.each([false, true])('refuses a foreign Application even while tree loading is %s', (treeLoading) => {
44
+ Object.assign(state, { apiVersion: 'app.k8s.io/v1beta1', kind: 'Application', error: '', loading: false, treeLoading })
45
+ const html = render()
46
+ expect(html).toContain('Application.app.k8s.io shop/wordpress is not a supported Argo CD or Flux resource')
47
+ expect(html).not.toContain('ArgoCD')
48
+ expect(html).not.toContain('FluxCD')
49
+ expect(html).not.toContain('Sync…')
50
+ expect(html).not.toContain('Reconcile')
51
+ })
52
+
53
+ it('keeps actions hidden until the resource confirms its group', () => {
54
+ Object.assign(state, { loading: true, treeLoading: true })
55
+ const html = render()
56
+ expect(html).not.toContain('ArgoCD')
57
+ expect(html).not.toContain('Sync…')
58
+ expect(html).not.toContain('is not a supported Argo CD or Flux resource')
59
+ })
60
+
61
+ it('keeps the Argo CD header and actions for a real Application', () => {
62
+ Object.assign(state, { apiVersion: 'argoproj.io/v1alpha1', kind: 'Application', error: '', loading: false, treeLoading: true })
63
+ const html = render()
64
+ expect(html).toContain('ArgoCD')
65
+ expect(html).toContain('Sync…')
66
+ expect(html).toContain('Healthy')
67
+ expect(html).not.toContain('is not a supported Argo CD or Flux resource')
68
+ })
69
+ it('preserves Flux reconcile controls', () => {
70
+ Object.assign(state, { apiVersion: 'kustomize.toolkit.fluxcd.io/v1', kind: 'Kustomization', loading: false, treeLoading: true, error: '', remote: false })
71
+ const html = render('kustomize.toolkit.fluxcd.io', 'kustomizations')
72
+ expect(html).toContain('FluxCD')
73
+ expect(html).toContain('Reconcile')
74
+ expect(html).not.toContain('ArgoCD')
75
+ })
76
+
77
+ it('does not classify Argo Workflows as Argo CD', () => {
78
+ Object.assign(state, { apiVersion: 'argoproj.io/v1alpha1', kind: 'Workflow', loading: false, treeLoading: false, error: '', remote: false })
79
+ const html = render('argoproj.io', 'workflows')
80
+ expect(html).toContain('Workflow.argoproj.io shop/wordpress is not a supported Argo CD or Flux resource')
81
+ expect(html).not.toContain('ArgoCD')
82
+ })
83
+
84
+ it('shows the resource read error without claiming an identity', () => {
85
+ Object.assign(state, { loading: false, error: 'access denied' })
86
+ const html = render()
87
+ expect(html).toContain('access denied')
88
+ expect(html).not.toContain('is not a supported Argo CD or Flux resource')
89
+ expect(html).not.toContain('ArgoCD')
90
+ expect(html).not.toContain('Sync…')
91
+ state.error = ''
92
+ })
93
+
94
+ it.each([
95
+ ['applications', 'Application', 'source.toolkit.fluxcd.io'],
96
+ ['kustomizations', 'Kustomization', 'source.toolkit.fluxcd.io'],
97
+ ])('rejects %s in the wrong Flux group', (plural, kind, group) => {
98
+ Object.assign(state, { apiVersion: `${group}/v1`, kind, loading: false, treeLoading: false, error: '', remote: false })
99
+ const html = render(group, plural)
100
+ expect(html).toContain('is not a supported Argo CD or Flux resource')
101
+ expect(html).not.toContain('FluxCD')
102
+ expect(html).not.toContain('Reconcile')
103
+ expect(html).not.toContain('ArgoCD')
104
+ })
105
+
106
+ it('ignores a misleading remote destination from an older backend', () => {
107
+ Object.assign(state, { apiVersion: 'app.k8s.io/v1beta1', kind: 'Application', loading: false, error: '', remote: true })
108
+ render('app.k8s.io')
109
+ expect(destinationRequest).toHaveBeenLastCalledWith(false, 'applications', 'shop', 'wordpress', 'app.k8s.io')
110
+ state.remote = false
111
+ })
112
+
113
+ })