@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.
- package/README.md +6 -0
- package/package.json +10 -11
- package/src/App.tsx +36 -36
- package/src/api/client.gitops-destination.test.tsx +55 -0
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.resource-list.test.ts +76 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +396 -105
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/quotas.ts +9 -20
- package/src/api/radarFeatures.ts +3 -0
- package/src/api/resourceLists.test.ts +84 -0
- package/src/api/resourceLists.ts +71 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/cnpg/CNPGSummaryHost.tsx +4 -3
- package/src/components/cnpg/CNPGView.tsx +1 -0
- package/src/components/compare/CompareResourcePicker.test.tsx +58 -0
- package/src/components/compare/CompareViewRoute.tsx +5 -1
- package/src/components/compare/useCompareCandidates.ts +1 -1
- package/src/components/compare/useCompareLauncher.tsx +4 -2
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/StoryExcerpt.tsx +24 -5
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -51
- package/src/components/diagnose/investigationEvidence/adapters/listCoverage.test.ts +415 -0
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/resource.ts +107 -8
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/inventory.tsx +66 -16
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/builder.ts +13 -1
- package/src/components/diagnose/investigationEvidence/excerpt.ts +2 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +21 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +131 -1
- package/src/components/diagnose/investigationEvidence/types.ts +26 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/diagnose/toolCallLabel.test.ts +9 -0
- package/src/components/diagnose/toolCallLabel.ts +2 -0
- package/src/components/dock/BottomDock.tsx +6 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.image-browse.test.tsx +46 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +28 -11
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/GitOpsView.identity.test.tsx +113 -0
- package/src/components/gitops/GitOpsView.tsx +69 -40
- package/src/components/gitops/useDestinationCluster.ts +2 -1
- package/src/components/helm/ArtifactHubSourceSearch.test.tsx +124 -0
- package/src/components/helm/ArtifactHubSourceSearch.tsx +240 -0
- package/src/components/helm/ChartBrowser.tsx +5 -4
- package/src/components/helm/HelmReleaseDrawer.tsx +139 -55
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +295 -50
- package/src/components/helm/TrackChartSourceDialog.test.ts +3 -2
- package/src/components/helm/TrackChartSourceDialog.tsx +614 -85
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +15 -6
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +1 -0
- package/src/components/home/mcpToolCatalog.ts +28 -2
- package/src/components/issues/IssuesPane.render.test.tsx +21 -0
- package/src/components/issues/IssuesPane.tsx +31 -7
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +58 -5
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resource/PrometheusCharts.overlays.test.ts +45 -0
- package/src/components/resource/PrometheusCharts.tsx +2 -2
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +46 -69
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/resources/renderers/PodRenderer.tsx +4 -1
- package/src/components/settings/MyPermissionsDialog.tsx +12 -9
- package/src/components/settings/SettingsDialog.tsx +21 -15
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficSourcePill.test.tsx +110 -0
- package/src/components/traffic/TrafficSourcePill.tsx +111 -0
- package/src/components/traffic/TrafficView.tsx +21 -67
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/DiagnosticsOverlay.test.ts +25 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +2 -1
- package/src/components/ui/Omnibar.note.test.tsx +141 -0
- package/src/components/ui/Omnibar.tsx +89 -14
- package/src/components/ui/RadarOmnibar.test.tsx +183 -0
- package/src/components/ui/RadarOmnibar.tsx +38 -4
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/UpdateNotification.manual.test.tsx +177 -0
- package/src/components/ui/UpdateNotification.test.tsx +2 -1
- package/src/components/ui/UpdateNotification.tsx +29 -5
- package/src/components/ui/omnibar-match.test.ts +37 -0
- package/src/components/ui/omnibar-match.ts +23 -0
- package/src/components/ui/searchCoverage.fixtures.ts +16 -0
- package/src/components/ui/searchCoverageNote.test.ts +245 -0
- package/src/components/ui/searchCoverageNote.ts +222 -0
- package/src/components/whats-new/WhatsNew.test.ts +10 -0
- package/src/components/whats-new/WhatsNew.tsx +5 -4
- package/src/components/whats-new/WhatsNewDialog.test.tsx +20 -0
- package/src/components/whats-new/releaseNotes.ts +57 -5
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.tsx +43 -5
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/hooks/useResourceCounts.ts +2 -0
- package/src/index.css +2 -4
- package/src/index.ts +7 -0
- package/src/integrations/resourceHosts.test.tsx +1 -0
- package/src/integrations/resourceHosts.tsx +2 -0
- package/src/utils/artifacthub.test.ts +18 -0
- package/src/utils/artifacthub.ts +9 -0
- package/src/utils/navigation.ts +14 -0
- package/src/utils/wails-clipboard.ts +4 -2
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import { useId, useState, type FormEvent } from 'react'
|
|
1
|
+
import { useEffect, useId, useRef, useState, type FormEvent } from 'react'
|
|
2
2
|
import { DialogPortal } from '@skyhook-io/k8s-ui/components/ui/DialogPortal'
|
|
3
|
-
import {
|
|
3
|
+
import { Trash2, X } from 'lucide-react'
|
|
4
4
|
import { Input } from '@skyhook-io/k8s-ui'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
useAddHelmRepository,
|
|
7
|
+
useAddOCISource,
|
|
8
|
+
useCapabilities,
|
|
9
|
+
useCloudRole,
|
|
10
|
+
useClusterInfo,
|
|
11
|
+
useHelmOCISources,
|
|
12
|
+
useHelmRepositories,
|
|
13
|
+
useHelmSourceStatus,
|
|
14
|
+
useRemoveOCISource,
|
|
15
|
+
useSetHelmSource,
|
|
16
|
+
useRadarFeature,
|
|
17
|
+
} from '../../api/client'
|
|
6
18
|
import { OperatorManagedNotice } from '../settings/OperatorManagedNotice'
|
|
7
|
-
import
|
|
19
|
+
import { ArtifactHubSourceSearch, publicChartSourceURL } from './ArtifactHubSourceSearch'
|
|
20
|
+
import type {
|
|
21
|
+
ChartSourceCandidate,
|
|
22
|
+
ChartSourceStatus,
|
|
23
|
+
HelmRepository,
|
|
24
|
+
UpgradeInfo,
|
|
25
|
+
SourceUpgradeSelection,
|
|
26
|
+
} from '../../types'
|
|
8
27
|
|
|
9
28
|
interface TrackChartSourceDialogProps {
|
|
29
|
+
operationError?: string | null
|
|
30
|
+
onSelectUpgradeSource?: (selection: SourceUpgradeSelection) => void
|
|
10
31
|
open: boolean
|
|
11
32
|
onClose: () => void
|
|
12
33
|
chartName?: string
|
|
@@ -28,13 +49,16 @@ export function isValidHelmRepositoryURL(value: string) {
|
|
|
28
49
|
export function sourceStateLabel(recorded: boolean, configured: boolean, available: boolean) {
|
|
29
50
|
if (!recorded) return 'Not recorded'
|
|
30
51
|
if (!configured) return 'Recorded · not configured here'
|
|
31
|
-
if (!available) return 'Recorded and configured · unavailable
|
|
52
|
+
if (!available) return 'Recorded and configured · source unavailable'
|
|
32
53
|
return 'Recorded · configured · available'
|
|
33
54
|
}
|
|
34
55
|
|
|
35
56
|
// What the dialog says about the release's recorded source. "Not recorded" is
|
|
36
57
|
// a claim about the release, so it shows only once the read has succeeded.
|
|
37
58
|
export function sourceStatusLine(status: ChartSourceStatus | undefined, error: unknown) {
|
|
59
|
+
if (status?.changing) return 'A Helm operation is in progress'
|
|
60
|
+
if (status?.sourceChangeRequired) return 'Source choice required after a failed chart change'
|
|
61
|
+
if (status?.confirmed === false && status.recorded) return 'Last recorded source - confirm before upgrading'
|
|
38
62
|
if (status) return sourceStateLabel(Boolean(status.recorded), status.configured, status.available)
|
|
39
63
|
if (error) return `Could not read this release's source: ${error instanceof Error ? error.message : String(error)}`
|
|
40
64
|
return 'Checking the recorded source...'
|
|
@@ -54,8 +78,14 @@ export function repositoryDisplayURL(url: string) {
|
|
|
54
78
|
// server stores names in this form, so collisions are checked on it.
|
|
55
79
|
const MAX_REPOSITORY_NAME_LENGTH = 40
|
|
56
80
|
export function normalizedRepositoryName(name: string) {
|
|
57
|
-
const base = name
|
|
58
|
-
|
|
81
|
+
const base = name
|
|
82
|
+
.trim()
|
|
83
|
+
.toLowerCase()
|
|
84
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
85
|
+
.replace(/^[-._]+|[-._]+$/g, '')
|
|
86
|
+
return base.length > MAX_REPOSITORY_NAME_LENGTH
|
|
87
|
+
? base.slice(0, MAX_REPOSITORY_NAME_LENGTH).replace(/[-._]+$/, '')
|
|
88
|
+
: base
|
|
59
89
|
}
|
|
60
90
|
|
|
61
91
|
// Name for re-adding the recorded repository on this machine. Reuses the
|
|
@@ -66,7 +96,7 @@ export function normalizedRepositoryName(name: string) {
|
|
|
66
96
|
export function recordedRepositoryName(alias: string, repositories: HelmRepository[]) {
|
|
67
97
|
const base = normalizedRepositoryName(alias)
|
|
68
98
|
if (!base) return ''
|
|
69
|
-
const taken = new Set(repositories.map(repository => normalizedRepositoryName(repository.name)))
|
|
99
|
+
const taken = new Set(repositories.map((repository) => normalizedRepositoryName(repository.name)))
|
|
70
100
|
if (!taken.has(base)) return base
|
|
71
101
|
for (let n = 2; ; n++) {
|
|
72
102
|
const suffix = `-${n}`
|
|
@@ -77,105 +107,604 @@ export function recordedRepositoryName(alias: string, repositories: HelmReposito
|
|
|
77
107
|
|
|
78
108
|
export function getSourceIssueCopy(sourceIssue: UpgradeInfo['sourceIssue'], sourceError?: string) {
|
|
79
109
|
switch (sourceIssue) {
|
|
80
|
-
case '
|
|
110
|
+
case 'release_changing':
|
|
111
|
+
return {
|
|
112
|
+
title: 'Helm operation in progress',
|
|
113
|
+
body: 'Wait for the current operation to finish, then refresh the source state.',
|
|
114
|
+
}
|
|
115
|
+
case 'source_confirmation_required':
|
|
116
|
+
return {
|
|
117
|
+
title: 'Confirm the recorded source',
|
|
118
|
+
body: 'Verify the original source, or select a source for the next upgrade.',
|
|
119
|
+
}
|
|
120
|
+
case 'source_change_required':
|
|
121
|
+
return {
|
|
122
|
+
title: 'Source choice required',
|
|
123
|
+
body: 'The previous chart change failed. Select a source and preview again before retrying.',
|
|
124
|
+
}
|
|
125
|
+
case 'repo_index_error':
|
|
126
|
+
return { title: 'A Helm repo index failed', body: 'Fix or refresh the repository before associating it.' }
|
|
81
127
|
case 'ambiguous_repository':
|
|
82
|
-
case 'ambiguous_source':
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
128
|
+
case 'ambiguous_source':
|
|
129
|
+
return {
|
|
130
|
+
title: 'Chart source unresolved',
|
|
131
|
+
body: 'Select the original source, or choose a source for the next upgrade.',
|
|
132
|
+
}
|
|
133
|
+
case 'source_unavailable':
|
|
134
|
+
return {
|
|
135
|
+
title: 'Recorded source unavailable',
|
|
136
|
+
body: 'The release provenance is preserved, but that source cannot currently be verified here.',
|
|
137
|
+
}
|
|
138
|
+
case 'untracked':
|
|
139
|
+
return {
|
|
140
|
+
title: 'Source not recorded',
|
|
141
|
+
body: 'Choose a source for the next upgrade, or record the original source.',
|
|
142
|
+
}
|
|
143
|
+
default:
|
|
144
|
+
return sourceError ? { title: 'Source unresolved', body: sourceError } : undefined
|
|
86
145
|
}
|
|
87
146
|
}
|
|
88
147
|
|
|
89
|
-
export function TrackChartSourceDialog(
|
|
148
|
+
export function TrackChartSourceDialog(props: TrackChartSourceDialogProps) {
|
|
149
|
+
return <ChartSourcePicker key={`${props.namespace}/${props.releaseName}`} {...props} />
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function sourceKey(source: ChartSourceCandidate) {
|
|
153
|
+
return `${source.type}:${publicChartSourceURL(source.url ?? source.reference) ?? source.reference}`
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function ChartSourcePicker({
|
|
157
|
+
operationError,
|
|
158
|
+
onSelectUpgradeSource,
|
|
159
|
+
open,
|
|
160
|
+
onClose,
|
|
161
|
+
chartName,
|
|
162
|
+
namespace,
|
|
163
|
+
releaseName,
|
|
164
|
+
sourceIssue,
|
|
165
|
+
sourceError,
|
|
166
|
+
}: TrackChartSourceDialogProps) {
|
|
167
|
+
const sourceFeature = useRadarFeature('helmSourceIdentity')
|
|
168
|
+
const [view, setView] = useState<'added' | 'public' | 'manual'>('added')
|
|
169
|
+
const [manualType, setManualType] = useState<'repository' | 'oci'>('repository')
|
|
170
|
+
const [selectedKey, setSelectedKey] = useState('')
|
|
171
|
+
const [filter, setFilter] = useState('')
|
|
90
172
|
const [ociPrefix, setOCIPrefix] = useState('')
|
|
91
173
|
const [repositoryName, setRepositoryName] = useState('')
|
|
92
174
|
const [repositoryURL, setRepositoryURL] = useState('')
|
|
93
|
-
const
|
|
175
|
+
const active = useRef(open)
|
|
176
|
+
const generation = useRef(0)
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
active.current = open
|
|
179
|
+
return () => {
|
|
180
|
+
active.current = false
|
|
181
|
+
generation.current += 1
|
|
182
|
+
}
|
|
183
|
+
}, [open])
|
|
184
|
+
const currentSession = () => {
|
|
185
|
+
const startedIn = generation.current
|
|
186
|
+
return () => active.current && generation.current === startedIn
|
|
187
|
+
}
|
|
188
|
+
const {
|
|
189
|
+
data: status,
|
|
190
|
+
error: statusError,
|
|
191
|
+
refetch: refetchStatus,
|
|
192
|
+
isFetching: statusFetching,
|
|
193
|
+
} = useHelmSourceStatus(namespace, releaseName, open)
|
|
94
194
|
const { data: ociSources } = useHelmOCISources()
|
|
95
195
|
const { data: clusterInfo } = useClusterInfo()
|
|
96
196
|
const { data: capabilities } = useCapabilities()
|
|
197
|
+
const { data: repositories, isLoading: repositoriesLoading } = useHelmRepositories()
|
|
97
198
|
const addOCI = useAddOCISource()
|
|
98
199
|
const removeOCI = useRemoveOCISource()
|
|
99
200
|
const addRepository = useAddHelmRepository()
|
|
100
201
|
const setSource = useSetHelmSource(namespace, releaseName)
|
|
101
|
-
const issueCopy = getSourceIssueCopy(sourceIssue, sourceError)
|
|
102
|
-
const recorded = status?.recorded
|
|
103
|
-
const configManaged = capabilities?.configManagement === 'operator'
|
|
104
|
-
// Chart sources are shared configuration that every user's upgrades resolve
|
|
105
|
-
// against, so in Radar Cloud only owners change them (the server enforces it).
|
|
106
202
|
const ownerOnly = !useCloudRole().canAtLeast('owner')
|
|
203
|
+
const configManaged = capabilities?.configManagement === 'operator'
|
|
107
204
|
const canEditSources = capabilities != null && !configManaged && !ownerOnly
|
|
205
|
+
const pending = addRepository.isPending || addOCI.isPending
|
|
206
|
+
const sourceBusy = Boolean(statusFetching || !status || status.changing || setSource.isPending || pending)
|
|
207
|
+
const configBusy = !canEditSources || repositoriesLoading || pending
|
|
108
208
|
const titleId = useId()
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
const
|
|
209
|
+
const formId = useId()
|
|
210
|
+
const panelId = useId()
|
|
211
|
+
const locations: ('added' | 'public')[] =
|
|
212
|
+
chartName && sourceFeature.support === 'supported' ? ['added', 'public'] : ['added']
|
|
213
|
+
const issueCopy = getSourceIssueCopy(sourceIssue, sourceError)
|
|
214
|
+
const recorded = status?.recorded
|
|
215
|
+
const missingRecorded =
|
|
216
|
+
status && !status.configured && recorded?.type === 'repository' && recorded.url ? recorded : undefined
|
|
217
|
+
const recordedName = missingRecorded ? recordedRepositoryName(missingRecorded.reference, repositories ?? []) : ''
|
|
218
|
+
const sources = [...(status?.suggestions ?? []).map((item) => item.source), ...(status?.candidates ?? [])]
|
|
219
|
+
if (recorded) sources.unshift(recorded)
|
|
220
|
+
const seen = new Set<string>()
|
|
221
|
+
const choices = sources.filter((source) => {
|
|
222
|
+
const key = sourceKey(source)
|
|
223
|
+
if (seen.has(key)) return false
|
|
224
|
+
seen.add(key)
|
|
225
|
+
return true
|
|
226
|
+
})
|
|
227
|
+
const selected = choices.find((source) => sourceKey(source) === selectedKey)
|
|
228
|
+
const visible = choices.filter((source) =>
|
|
229
|
+
`${source.reference} ${source.url ?? ''}`.toLowerCase().includes(filter.trim().toLowerCase()),
|
|
230
|
+
)
|
|
231
|
+
const selectedMissing = selected && missingRecorded && sourceKey(selected) === sourceKey(missingRecorded)
|
|
232
|
+
const canVerify =
|
|
233
|
+
selected &&
|
|
234
|
+
!status?.confirmed &&
|
|
235
|
+
!status?.sourceChangeRequired &&
|
|
236
|
+
(selected.type === 'oci' || status?.candidates?.some((source) => sourceKey(source) === selectedKey))
|
|
114
237
|
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
|
|
238
|
+
const showAdded = (source?: ChartSourceCandidate) => {
|
|
239
|
+
if (!active.current) return
|
|
240
|
+
setView('added')
|
|
241
|
+
setFilter('')
|
|
242
|
+
setSelectedKey(source ? sourceKey(source) : '')
|
|
243
|
+
void refetchStatus()
|
|
118
244
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
245
|
+
const addRecorded = () => {
|
|
246
|
+
if (!missingRecorded) return
|
|
247
|
+
const isCurrent = currentSession()
|
|
248
|
+
const associate = status?.confirmed !== false
|
|
249
|
+
addRepository.mutate(
|
|
250
|
+
{ name: recordedName, url: missingRecorded.url, ...(associate ? { namespace, releaseName } : {}) },
|
|
251
|
+
{
|
|
252
|
+
onSuccess: () => {
|
|
253
|
+
if (!isCurrent()) return
|
|
254
|
+
if (associate) onClose()
|
|
255
|
+
else showAdded(missingRecorded)
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
)
|
|
126
259
|
}
|
|
127
|
-
|
|
128
|
-
const addOCIPrefix = async (event: FormEvent) => {
|
|
260
|
+
const submitManual = (event: FormEvent) => {
|
|
129
261
|
event.preventDefault()
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
262
|
+
const isCurrent = currentSession()
|
|
263
|
+
if (manualType === 'oci') {
|
|
264
|
+
if (!ociPrefix.trim().startsWith('oci://')) return
|
|
265
|
+
const prefix = ociPrefix.trim().replace(/\/+$/, '')
|
|
266
|
+
addOCI.mutate(prefix, {
|
|
267
|
+
onSuccess: () => {
|
|
268
|
+
if (!isCurrent()) return
|
|
269
|
+
setOCIPrefix('')
|
|
270
|
+
showAdded(chartName ? { type: 'oci', reference: `${prefix}/${chartName}` } : undefined)
|
|
271
|
+
},
|
|
272
|
+
})
|
|
273
|
+
} else {
|
|
274
|
+
const url = repositoryURL.trim()
|
|
275
|
+
const name = repositoryName.trim()
|
|
276
|
+
if (!name || !isValidHelmRepositoryURL(url)) return
|
|
277
|
+
addRepository.mutate(
|
|
278
|
+
{ name, url },
|
|
279
|
+
{
|
|
280
|
+
onSuccess: (result) => {
|
|
281
|
+
if (!isCurrent()) return
|
|
282
|
+
setRepositoryName('')
|
|
283
|
+
setRepositoryURL('')
|
|
284
|
+
showAdded({ type: 'repository', reference: result.name, url })
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
)
|
|
288
|
+
}
|
|
134
289
|
}
|
|
290
|
+
const manualAction = (
|
|
291
|
+
<button
|
|
292
|
+
type="button"
|
|
293
|
+
onClick={() => setView(view === 'manual' ? 'added' : 'manual')}
|
|
294
|
+
className="text-sm text-accent hover:underline"
|
|
295
|
+
>
|
|
296
|
+
{view === 'manual' ? 'Back to sources' : 'Add manually'}
|
|
297
|
+
</button>
|
|
298
|
+
)
|
|
135
299
|
|
|
136
|
-
return
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
300
|
+
return (
|
|
301
|
+
<DialogPortal
|
|
302
|
+
ariaLabelledBy={titleId}
|
|
303
|
+
open={open}
|
|
304
|
+
onClose={onClose}
|
|
305
|
+
className="max-w-xl w-full max-h-[85vh] h-[36rem] flex flex-col overflow-hidden"
|
|
306
|
+
>
|
|
307
|
+
<header className="shrink-0 px-4 pt-4 pb-3">
|
|
308
|
+
<div className="flex items-center justify-between gap-3">
|
|
309
|
+
<h3 id={titleId} className="text-base font-semibold">
|
|
310
|
+
{view === 'manual' ? 'Add chart source' : 'Choose chart source'}
|
|
311
|
+
</h3>
|
|
312
|
+
<button
|
|
313
|
+
type="button"
|
|
314
|
+
onClick={onClose}
|
|
315
|
+
aria-label="Close"
|
|
316
|
+
className="p-1 rounded text-theme-text-secondary hover:bg-theme-hover"
|
|
317
|
+
>
|
|
318
|
+
<X className="w-5 h-5" />
|
|
319
|
+
</button>
|
|
320
|
+
</div>
|
|
321
|
+
<p className="mt-2 text-xs text-theme-text-tertiary">
|
|
322
|
+
{chartName && (
|
|
323
|
+
<>
|
|
324
|
+
<span className="font-medium">{chartName}</span> ·{' '}
|
|
325
|
+
</>
|
|
326
|
+
)}
|
|
327
|
+
{sourceStatusLine(status, statusError)}
|
|
328
|
+
</p>
|
|
329
|
+
{!status && statusError && (
|
|
330
|
+
<button
|
|
331
|
+
type="button"
|
|
332
|
+
onClick={() => void refetchStatus()}
|
|
333
|
+
className="text-sm text-accent hover:underline mt-1"
|
|
334
|
+
>
|
|
335
|
+
Retry
|
|
336
|
+
</button>
|
|
337
|
+
)}
|
|
338
|
+
{status?.changing && (
|
|
339
|
+
<button
|
|
340
|
+
type="button"
|
|
341
|
+
onClick={() => void refetchStatus()}
|
|
342
|
+
className="text-sm text-accent hover:underline mt-1"
|
|
343
|
+
>
|
|
344
|
+
Refresh source state
|
|
345
|
+
</button>
|
|
346
|
+
)}
|
|
347
|
+
{issueCopy &&
|
|
348
|
+
sourceIssue !== 'untracked' &&
|
|
349
|
+
sourceIssue !== 'source_unavailable' &&
|
|
350
|
+
sourceIssue !== 'source_confirmation_required' && (
|
|
351
|
+
<p className="text-xs text-theme-text-secondary mt-2">{issueCopy.body}</p>
|
|
352
|
+
)}
|
|
353
|
+
{operationError && (
|
|
354
|
+
<p role="alert" className="text-sm text-warning-text mt-2">
|
|
355
|
+
{operationError}
|
|
356
|
+
</p>
|
|
357
|
+
)}
|
|
358
|
+
</header>
|
|
359
|
+
{configManaged && (
|
|
360
|
+
<div className="shrink-0 px-4 pb-2">
|
|
361
|
+
<OperatorManagedNotice helmValue="helm.ociSources" />
|
|
362
|
+
</div>
|
|
363
|
+
)}
|
|
364
|
+
{!configManaged && ownerOnly && (
|
|
365
|
+
<p className="shrink-0 px-4 pb-2 text-xs text-theme-text-secondary">
|
|
366
|
+
Only organization owners can add or remove chart sources.
|
|
367
|
+
</p>
|
|
368
|
+
)}
|
|
369
|
+
{view !== 'manual' && (
|
|
370
|
+
<div
|
|
371
|
+
role="tablist"
|
|
372
|
+
aria-label="Chart source location"
|
|
373
|
+
className="shrink-0 flex gap-5 px-4 border-b border-theme-border"
|
|
374
|
+
>
|
|
375
|
+
{locations.map((tab, index) => (
|
|
376
|
+
<button
|
|
377
|
+
key={tab}
|
|
378
|
+
id={`${panelId}-${tab}`}
|
|
379
|
+
type="button"
|
|
380
|
+
role="tab"
|
|
381
|
+
aria-controls={panelId}
|
|
382
|
+
aria-selected={view === tab}
|
|
383
|
+
tabIndex={view === tab ? 0 : -1}
|
|
384
|
+
onKeyDown={(event) => {
|
|
385
|
+
const next =
|
|
386
|
+
event.key === 'Home'
|
|
387
|
+
? 0
|
|
388
|
+
: event.key === 'End'
|
|
389
|
+
? locations.length - 1
|
|
390
|
+
: event.key === 'ArrowRight'
|
|
391
|
+
? (index + 1) % locations.length
|
|
392
|
+
: event.key === 'ArrowLeft'
|
|
393
|
+
? (index + locations.length - 1) % locations.length
|
|
394
|
+
: undefined
|
|
395
|
+
if (next === undefined) return
|
|
396
|
+
event.preventDefault()
|
|
397
|
+
setView(locations[next])
|
|
398
|
+
setFilter('')
|
|
399
|
+
document.getElementById(`${panelId}-${locations[next]}`)?.focus()
|
|
400
|
+
}}
|
|
401
|
+
onClick={() => {
|
|
402
|
+
setView(tab === 'public' ? 'public' : 'added')
|
|
403
|
+
setFilter('')
|
|
404
|
+
}}
|
|
405
|
+
className={`py-2 text-sm border-b-2 ${view === tab ? 'border-accent text-theme-text-primary' : 'border-transparent text-theme-text-secondary'}`}
|
|
406
|
+
>
|
|
407
|
+
{tab === 'added' ? 'My Repos' : 'ArtifactHub'}
|
|
408
|
+
</button>
|
|
409
|
+
))}
|
|
410
|
+
</div>
|
|
411
|
+
)}
|
|
412
|
+
<div
|
|
413
|
+
id={panelId}
|
|
414
|
+
role={view === 'manual' ? undefined : 'tabpanel'}
|
|
415
|
+
aria-labelledby={view === 'manual' ? undefined : `${panelId}-${view}`}
|
|
416
|
+
className="flex flex-col flex-1 min-h-0"
|
|
417
|
+
>
|
|
418
|
+
{view === 'public' && open && chartName ? (
|
|
419
|
+
<ArtifactHubSourceSearch
|
|
420
|
+
chartName={chartName}
|
|
421
|
+
disabled={configBusy || sourceBusy}
|
|
422
|
+
manualAction={manualAction}
|
|
423
|
+
isConfigured={(source) =>
|
|
424
|
+
source.type === 'oci'
|
|
425
|
+
? (ociSources ?? []).some((prefix) => publicChartSourceURL(prefix) === source.prefix)
|
|
426
|
+
: (repositories ?? []).some((repository) => publicChartSourceURL(repository.url) === source.url)
|
|
427
|
+
}
|
|
428
|
+
onConfigured={(source) =>
|
|
429
|
+
showAdded(
|
|
430
|
+
source.type === 'oci'
|
|
431
|
+
? { type: 'oci', reference: source.url }
|
|
432
|
+
: { type: 'repository', reference: '', url: source.url },
|
|
433
|
+
)
|
|
434
|
+
}
|
|
435
|
+
onAdd={(chart, source) => {
|
|
436
|
+
const isCurrent = currentSession()
|
|
437
|
+
if (source.type === 'oci')
|
|
438
|
+
addOCI.mutate(source.prefix, {
|
|
439
|
+
onSuccess: () => {
|
|
440
|
+
if (isCurrent()) showAdded({ type: 'oci', reference: source.url })
|
|
441
|
+
},
|
|
442
|
+
})
|
|
443
|
+
else
|
|
444
|
+
addRepository.mutate(
|
|
445
|
+
{ name: recordedRepositoryName(chart.repository.name, repositories ?? []), url: source.url },
|
|
446
|
+
{
|
|
447
|
+
onSuccess: (result) => {
|
|
448
|
+
if (isCurrent()) showAdded({ type: 'repository', reference: result.name, url: source.url })
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
)
|
|
452
|
+
}}
|
|
453
|
+
/>
|
|
454
|
+
) : view === 'manual' ? (
|
|
455
|
+
<>
|
|
456
|
+
<div className="flex-1 min-h-0 overflow-y-auto p-4 space-y-4" aria-label="Manual source setup">
|
|
457
|
+
<div className="flex gap-3" role="group" aria-label="Source type">
|
|
458
|
+
<button
|
|
459
|
+
type="button"
|
|
460
|
+
onClick={() => setManualType('repository')}
|
|
461
|
+
aria-pressed={manualType === 'repository'}
|
|
462
|
+
className={`px-3 py-1.5 text-sm rounded-md ${manualType === 'repository' ? 'bg-theme-active' : 'text-theme-text-secondary'}`}
|
|
463
|
+
>
|
|
464
|
+
Helm repository
|
|
465
|
+
</button>
|
|
466
|
+
<button
|
|
467
|
+
type="button"
|
|
468
|
+
onClick={() => setManualType('oci')}
|
|
469
|
+
aria-pressed={manualType === 'oci'}
|
|
470
|
+
className={`px-3 py-1.5 text-sm rounded-md ${manualType === 'oci' ? 'bg-theme-active' : 'text-theme-text-secondary'}`}
|
|
471
|
+
>
|
|
472
|
+
OCI registry
|
|
473
|
+
</button>
|
|
474
|
+
</div>
|
|
475
|
+
<form id={formId} onSubmit={submitManual} className="space-y-3">
|
|
476
|
+
{manualType === 'repository' ? (
|
|
477
|
+
<>
|
|
478
|
+
<label className="block text-sm text-theme-text-secondary">
|
|
479
|
+
Repository name
|
|
480
|
+
<Input
|
|
481
|
+
value={repositoryName}
|
|
482
|
+
onChange={(event) => setRepositoryName(event.target.value)}
|
|
483
|
+
placeholder="Repository name"
|
|
484
|
+
disabled={configBusy}
|
|
485
|
+
className="mt-1 w-full"
|
|
486
|
+
/>
|
|
487
|
+
</label>
|
|
488
|
+
<label className="block text-sm text-theme-text-secondary">
|
|
489
|
+
Repository address
|
|
490
|
+
<Input
|
|
491
|
+
value={repositoryURL}
|
|
492
|
+
onChange={(event) => setRepositoryURL(event.target.value)}
|
|
493
|
+
placeholder="https://charts.example.com"
|
|
494
|
+
disabled={configBusy}
|
|
495
|
+
className="mt-1 w-full"
|
|
496
|
+
/>
|
|
497
|
+
</label>
|
|
498
|
+
</>
|
|
499
|
+
) : (
|
|
500
|
+
<label className="block text-sm text-theme-text-secondary">
|
|
501
|
+
OCI prefix
|
|
502
|
+
<Input
|
|
503
|
+
value={ociPrefix}
|
|
504
|
+
onChange={(event) => setOCIPrefix(event.target.value)}
|
|
505
|
+
placeholder="oci://registry.example.com/charts"
|
|
506
|
+
disabled={configBusy}
|
|
507
|
+
className="mt-1 w-full"
|
|
508
|
+
/>
|
|
509
|
+
</label>
|
|
510
|
+
)}
|
|
511
|
+
<p className="text-xs text-theme-text-tertiary">
|
|
512
|
+
After adding a source, choose it for an upgrade or check and record it for this release.
|
|
513
|
+
</p>
|
|
514
|
+
</form>
|
|
515
|
+
{manualType === 'oci' && ociSources && ociSources.length > 0 && (
|
|
516
|
+
<div className="space-y-2">
|
|
517
|
+
<p className="text-xs text-theme-text-tertiary">Registered OCI prefixes</p>
|
|
518
|
+
<ul className="divide-y divide-theme-border">
|
|
519
|
+
{ociSources.map((source) => (
|
|
520
|
+
<li key={source} className="flex items-center justify-between gap-2 py-2">
|
|
521
|
+
<span className="font-mono text-xs break-all">{source}</span>
|
|
522
|
+
{canEditSources && (
|
|
523
|
+
<button
|
|
524
|
+
type="button"
|
|
525
|
+
onClick={() => removeOCI.mutate(source)}
|
|
526
|
+
disabled={removeOCI.isPending}
|
|
527
|
+
aria-label={`Remove ${source}`}
|
|
528
|
+
className="p-1 shrink-0 text-theme-text-secondary hover:text-theme-text-primary disabled:opacity-50"
|
|
529
|
+
>
|
|
530
|
+
<Trash2 className="w-4 h-4" />
|
|
531
|
+
</button>
|
|
532
|
+
)}
|
|
533
|
+
</li>
|
|
534
|
+
))}
|
|
535
|
+
</ul>
|
|
536
|
+
</div>
|
|
537
|
+
)}
|
|
538
|
+
{manualType === 'oci' && clusterInfo?.inCluster && (
|
|
539
|
+
<p className="text-xs text-warning-text">
|
|
540
|
+
Private OCI sources need credentials available to the in-cluster Radar process.
|
|
541
|
+
</p>
|
|
542
|
+
)}
|
|
543
|
+
</div>
|
|
544
|
+
<footer className="shrink-0 flex items-center justify-between gap-3 px-4 py-3 border-t border-theme-border">
|
|
545
|
+
{manualAction}
|
|
546
|
+
<button
|
|
547
|
+
type="submit"
|
|
548
|
+
form={formId}
|
|
549
|
+
disabled={
|
|
550
|
+
configBusy ||
|
|
551
|
+
(manualType === 'repository'
|
|
552
|
+
? !repositoryName.trim() || !isValidHelmRepositoryURL(repositoryURL)
|
|
553
|
+
: !ociPrefix.trim().startsWith('oci://'))
|
|
554
|
+
}
|
|
555
|
+
className="btn-brand px-3 py-2 text-sm"
|
|
556
|
+
>
|
|
557
|
+
{manualType === 'repository' ? 'Add repository' : 'Register OCI source'}
|
|
558
|
+
</button>
|
|
559
|
+
</footer>
|
|
560
|
+
</>
|
|
561
|
+
) : (
|
|
562
|
+
<>
|
|
563
|
+
{choices.length > 6 && (
|
|
564
|
+
<div className="shrink-0 px-4 py-3 border-b border-theme-border">
|
|
565
|
+
<Input
|
|
566
|
+
aria-label="Filter configured sources"
|
|
567
|
+
placeholder="Filter by name or address"
|
|
568
|
+
value={filter}
|
|
569
|
+
onChange={(event) => {
|
|
570
|
+
setFilter(event.target.value)
|
|
571
|
+
setSelectedKey('')
|
|
572
|
+
}}
|
|
573
|
+
className="w-full"
|
|
574
|
+
/>
|
|
575
|
+
</div>
|
|
576
|
+
)}
|
|
577
|
+
<div className="flex-1 min-h-0 overflow-y-auto" aria-label="Configured chart sources">
|
|
578
|
+
{visible.length === 0 ? (
|
|
579
|
+
<div className="min-h-40 h-full flex flex-col items-center justify-center gap-3 p-4 text-center">
|
|
580
|
+
<p className="text-sm text-theme-text-secondary">
|
|
581
|
+
{filter ? 'No matching sources.' : 'No configured sources found.'}
|
|
582
|
+
</p>
|
|
583
|
+
{!filter && chartName && sourceFeature.support === 'supported' && (
|
|
584
|
+
<button type="button" onClick={() => setView('public')} className="btn-brand px-3 py-2 text-sm">
|
|
585
|
+
Find a public source
|
|
586
|
+
</button>
|
|
587
|
+
)}
|
|
588
|
+
</div>
|
|
589
|
+
) : (
|
|
590
|
+
visible.map((source) => {
|
|
591
|
+
const suggestion = status?.suggestions?.find((item) => sourceKey(item.source) === sourceKey(source))
|
|
592
|
+
const isRecorded = recorded && sourceKey(recorded) === sourceKey(source)
|
|
593
|
+
return (
|
|
594
|
+
<button
|
|
595
|
+
key={sourceKey(source)}
|
|
596
|
+
type="button"
|
|
597
|
+
onClick={() => setSelectedKey(sourceKey(source))}
|
|
598
|
+
aria-pressed={selectedKey === sourceKey(source)}
|
|
599
|
+
aria-label={`Choose configured source: ${source.url ?? source.reference}`}
|
|
600
|
+
className={`w-full text-left px-4 py-3 border-b border-theme-border hover:bg-theme-hover ${selectedKey === sourceKey(source) ? 'bg-theme-active' : ''}`}
|
|
601
|
+
>
|
|
602
|
+
<span className="block text-sm font-medium">
|
|
603
|
+
{source.type === 'repository' ? source.reference : 'OCI chart'}
|
|
604
|
+
<span className="ml-2 font-normal text-xs text-theme-text-tertiary">
|
|
605
|
+
{isRecorded
|
|
606
|
+
? status?.confirmed
|
|
607
|
+
? 'Current source'
|
|
608
|
+
: 'Last recorded source'
|
|
609
|
+
: source.type === 'oci'
|
|
610
|
+
? 'Registered source'
|
|
611
|
+
: 'Configured repository'}
|
|
612
|
+
</span>
|
|
613
|
+
</span>
|
|
614
|
+
<span className="block font-mono text-xs text-theme-text-secondary break-all mt-1">
|
|
615
|
+
{source.url ?? source.reference}
|
|
616
|
+
</span>
|
|
617
|
+
{((isRecorded && !status?.configured) || suggestion?.state === 'index_unavailable') && (
|
|
618
|
+
<span className="block text-xs text-warning-text mt-1">
|
|
619
|
+
{isRecorded && !status?.configured
|
|
620
|
+
? 'Not configured here'
|
|
621
|
+
: 'Refresh its index in Helm Catalog'}
|
|
622
|
+
</span>
|
|
623
|
+
)}
|
|
624
|
+
</button>
|
|
625
|
+
)
|
|
626
|
+
})
|
|
627
|
+
)}
|
|
628
|
+
</div>
|
|
629
|
+
<footer className="shrink-0 border-t border-theme-border px-4 py-3 space-y-2">
|
|
630
|
+
{selectedMissing && (
|
|
631
|
+
<p className="text-xs text-theme-text-tertiary">
|
|
632
|
+
{recordedName ? (
|
|
633
|
+
<>
|
|
634
|
+
Saved in Helm as <span className="font-mono">{recordedName}</span>.
|
|
635
|
+
{recordedName !== missingRecorded.reference && (
|
|
636
|
+
<>
|
|
637
|
+
{' '}
|
|
638
|
+
The name <span className="font-mono">{missingRecorded.reference}</span> is already taken or
|
|
639
|
+
needs normalization.
|
|
640
|
+
</>
|
|
641
|
+
)}
|
|
642
|
+
</>
|
|
643
|
+
) : (
|
|
644
|
+
'Radar picks a repository name from the address.'
|
|
645
|
+
)}
|
|
646
|
+
</p>
|
|
647
|
+
)}
|
|
648
|
+
{selected && !selectedMissing && (
|
|
649
|
+
<p className="text-xs text-theme-text-tertiary">
|
|
650
|
+
{canVerify
|
|
651
|
+
? 'Radar compares the chart information Helm saved. Matching copies can come from more than one publisher.'
|
|
652
|
+
: 'Review the chart version, settings and resource changes before applying.'}
|
|
653
|
+
</p>
|
|
654
|
+
)}
|
|
655
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
656
|
+
{manualAction}
|
|
657
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
658
|
+
{canVerify && !selectedMissing && (
|
|
659
|
+
<button
|
|
660
|
+
type="button"
|
|
661
|
+
onClick={() => {
|
|
662
|
+
const isCurrent = currentSession()
|
|
663
|
+
if (selected)
|
|
664
|
+
setSource.mutate(selected, {
|
|
665
|
+
onSuccess: () => {
|
|
666
|
+
if (isCurrent()) onClose()
|
|
667
|
+
},
|
|
668
|
+
})
|
|
669
|
+
}}
|
|
670
|
+
disabled={sourceBusy}
|
|
671
|
+
className="text-sm text-accent hover:underline disabled:opacity-50"
|
|
672
|
+
>
|
|
673
|
+
Check and record source
|
|
674
|
+
</button>
|
|
675
|
+
)}
|
|
676
|
+
{selectedMissing ? (
|
|
677
|
+
<button
|
|
678
|
+
type="button"
|
|
679
|
+
onClick={addRecorded}
|
|
680
|
+
disabled={configBusy || sourceBusy}
|
|
681
|
+
className="btn-brand px-3 py-2 text-sm"
|
|
682
|
+
>
|
|
683
|
+
{status?.confirmed !== false ? 'Add repository and use it' : 'Add repository'}
|
|
684
|
+
</button>
|
|
685
|
+
) : sourceFeature.support === 'supported' && onSelectUpgradeSource && status?.revision ? (
|
|
686
|
+
<button
|
|
687
|
+
type="button"
|
|
688
|
+
disabled={!selected || sourceBusy}
|
|
689
|
+
onClick={() => {
|
|
690
|
+
if (selected && status.revision)
|
|
691
|
+
onSelectUpgradeSource({
|
|
692
|
+
source: selected,
|
|
693
|
+
expectedRevision: status.revision,
|
|
694
|
+
expectedSource: status.recorded ?? null,
|
|
695
|
+
})
|
|
696
|
+
}}
|
|
697
|
+
className="btn-brand px-3 py-2 text-sm"
|
|
698
|
+
>
|
|
699
|
+
Select for upgrade
|
|
700
|
+
</button>
|
|
701
|
+
) : null}
|
|
702
|
+
</div>
|
|
703
|
+
</div>
|
|
704
|
+
</footer>
|
|
705
|
+
</>
|
|
706
|
+
)}
|
|
151
707
|
</div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<p className="text-xs text-theme-text-tertiary">{!recordedName
|
|
155
|
-
? 'Radar picks a name for it in Helm.'
|
|
156
|
-
: recordedName === missingRecordedRepository.reference
|
|
157
|
-
? <>Saved in Helm as <span className="font-mono">{recordedName}</span>, the name it was recorded under.</>
|
|
158
|
-
: recordedName === normalizedRepositoryName(missingRecordedRepository.reference)
|
|
159
|
-
? <>Saved in Helm as <span className="font-mono">{recordedName}</span>.</>
|
|
160
|
-
: <>Saved in Helm as <span className="font-mono">{recordedName}</span>. The name <span className="font-mono">{missingRecordedRepository.reference}</span> already points to a different repository here.</>}</p>
|
|
161
|
-
</div>}
|
|
162
|
-
{status?.candidates && status.candidates.length > 0 && <div>
|
|
163
|
-
<p className="text-xs uppercase tracking-wide text-theme-text-tertiary mb-2">Configured sources that publish {chartName || 'this chart'} at the installed version</p>
|
|
164
|
-
<div className="space-y-2">{status.candidates.map(candidate => <button key={`${candidate.type}:${candidate.url ?? candidate.reference}`} onClick={() => setSource.mutate(candidate, { onSuccess: onClose })} disabled={setSource.isPending} className="w-full text-left rounded-lg border border-theme-border px-3 py-2 hover:border-accent disabled:opacity-50"><span className="text-xs uppercase text-theme-text-tertiary">{candidate.type}</span><span className="block font-mono text-sm break-all">{candidate.url ?? candidate.reference}</span></button>)}</div>
|
|
165
|
-
{status.candidates.length > 1 && <p className="text-xs text-amber-600 mt-2">Multiple sources publish this exact chart and version. Choose explicitly; Radar will not auto-associate one.</p>}
|
|
166
|
-
</div>}
|
|
167
|
-
<form onSubmit={addRepositoryAndAssociate} className="space-y-2">
|
|
168
|
-
<p className="text-xs uppercase tracking-wide text-theme-text-tertiary">Add classic repository and associate</p>
|
|
169
|
-
<div className="grid grid-cols-1 md:grid-cols-[minmax(0,0.8fr)_minmax(0,1.8fr)_auto] gap-2"><Input value={repositoryName} onChange={event => setRepositoryName(event.target.value)} placeholder="Repository name" disabled={!canEditSources} /><Input value={repositoryURL} onChange={event => setRepositoryURL(event.target.value)} placeholder="https://charts.example.com" disabled={!canEditSources} /><button type="submit" disabled={!canEditSources || !repositoryName.trim() || !isValidHelmRepositoryURL(repositoryURL) || addRepository.isPending} className="btn-brand inline-flex items-center justify-center gap-1 px-3 py-2"><Plus className="w-4 h-4" /> Add</button></div>
|
|
170
|
-
<p className="text-xs text-theme-text-tertiary">Association succeeds only if the repository publishes {chartName || 'the installed chart'} at the exact installed version.</p>
|
|
171
|
-
</form>
|
|
172
|
-
<form onSubmit={addOCIPrefix} className="space-y-2">
|
|
173
|
-
<p className="text-xs uppercase tracking-wide text-theme-text-tertiary">Register OCI prefix</p>
|
|
174
|
-
<div className="flex gap-2"><Input value={ociPrefix} onChange={event => setOCIPrefix(event.target.value)} placeholder="oci://registry.example.com/charts" disabled={!canEditSources} /><button type="submit" disabled={!canEditSources || !ociPrefix.trim().startsWith('oci://') || addOCI.isPending} className="btn-brand px-3 py-2">Add</button></div>
|
|
175
|
-
<p className="text-xs text-theme-text-tertiary">After registration, select it in the list above. Credentials are reused from Helm and are never recorded in release provenance.</p>
|
|
176
|
-
</form>
|
|
177
|
-
{ociSources && ociSources.length > 0 && <ul className="space-y-1">{ociSources.map(source => <li key={source} className="flex items-center justify-between gap-2 rounded-lg bg-theme-elevated px-3 py-2"><span className="font-mono text-sm truncate">{source}</span>{canEditSources && <button onClick={() => removeOCI.mutate(source)} disabled={removeOCI.isPending} aria-label={`Remove ${source}`} className="p-1 hover:text-red-400 disabled:opacity-50"><Trash2 className="w-4 h-4" /></button>}</li>)}</ul>}
|
|
178
|
-
{clusterInfo?.inCluster && <p className="text-xs text-amber-600 flex items-start gap-2"><AlertTriangle className="w-4 h-4 shrink-0" />Private OCI sources require credentials available to the in-cluster Radar process.</p>}
|
|
179
|
-
</div>
|
|
180
|
-
</DialogPortal>
|
|
708
|
+
</DialogPortal>
|
|
709
|
+
)
|
|
181
710
|
}
|