@skyhook-io/radar-app 1.20.0 → 1.20.3
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/package.json +1 -1
- package/src/App.tsx +18 -11
- package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
- package/src/api/client.pauseDeployment.test.tsx +77 -0
- package/src/api/client.restartError.test.ts +14 -0
- package/src/api/client.revisionRefresh.test.tsx +44 -0
- package/src/api/client.rollbackError.test.ts +14 -0
- package/src/api/client.ts +287 -21
- package/src/api/helmInventory.test.tsx +108 -0
- package/src/api/networkAttachments.test.tsx +120 -0
- package/src/api/networkAttachments.ts +30 -0
- package/src/api/radarFeatures.test.ts +5 -0
- package/src/api/radarFeatures.ts +5 -0
- package/src/api/secretsStore.test.ts +33 -0
- package/src/api/secretsStore.ts +37 -0
- package/src/components/ConnectionErrorView.test.tsx +11 -0
- package/src/components/ConnectionErrorView.tsx +19 -0
- package/src/components/ContextSwitcher.tsx +9 -2
- package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
- package/src/components/applications/ApplicationsView.tsx +8 -11
- package/src/components/cost/CostView.tsx +27 -9
- package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
- package/src/components/curl/ServiceCurlButton.tsx +2 -2
- package/src/components/diagnose/InvestigationView.tsx +12 -3
- package/src/components/diagnose/investigationCase.test.tsx +41 -0
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +61 -16
- package/src/components/diagnose/investigationEvidence/adapters/listings.ts +34 -4
- package/src/components/diagnose/investigationEvidence/adapters/resource.ts +3 -2
- package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
- package/src/components/dock/TerminalPreferences.test.tsx +68 -0
- package/src/components/dock/TerminalPreferences.tsx +73 -0
- package/src/components/gitops/GitOpsView.tsx +1 -9
- package/src/components/helm/HelmDrawerFrame.tsx +101 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +47 -98
- package/src/components/helm/HelmView.tsx +215 -71
- package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
- package/src/components/helm/NotCheckedBadge.tsx +39 -0
- package/src/components/helm/ObservedHelmNotice.tsx +146 -0
- package/src/components/helm/ObservedHelmRelease.test.tsx +261 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +80 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +228 -0
- package/src/components/helm/OwnedResources.test.tsx +86 -0
- package/src/components/helm/OwnedResources.tsx +69 -10
- package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
- package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
- package/src/components/home/ClusterHealthCard.test.ts +44 -1
- package/src/components/home/ClusterHealthCard.tsx +49 -14
- package/src/components/home/HelmSummary.tsx +38 -19
- package/src/components/home/HelmSummary.unread.test.ts +16 -0
- package/src/components/home/HomeAgentBlock.tsx +7 -0
- package/src/components/home/MCPSetupDialog.test.tsx +38 -12
- package/src/components/home/MCPSetupDialog.tsx +5 -2
- package/src/components/home/mcpToolCatalog.ts +45 -5
- package/src/components/issues/uncheckedSources.test.ts +2 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/resource/RightsizingStrip.test.ts +57 -0
- package/src/components/resource/RightsizingStrip.tsx +53 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
- package/src/components/resources/ImageFilesystemModal.tsx +98 -6
- package/src/components/resources/PodFileUploadPanel.tsx +150 -0
- package/src/components/resources/PodFilesystemModal.tsx +246 -3
- package/src/components/resources/pod-file-upload.test.tsx +223 -0
- package/src/components/resources/pod-file-upload.ts +266 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
- package/src/components/resources/renderers/PodRenderer.tsx +26 -1
- package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
- package/src/components/resources/renderers/ServiceRenderer.test.tsx +15 -2
- package/src/components/resources/renderers/ServiceRenderer.tsx +1 -1
- package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.test.tsx +160 -0
- package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.tsx +128 -0
- package/src/components/rightsizing/RightsizingScanView.tsx +16 -1
- package/src/components/rightsizing/model.test.ts +11 -0
- package/src/components/rightsizing/model.ts +3 -1
- package/src/components/rightsizing/presentation.test.ts +46 -0
- package/src/components/rightsizing/presentation.ts +17 -2
- package/src/components/traffic/TrafficView.tsx +27 -27
- package/src/components/traffic/trafficFilters.test.ts +18 -1
- package/src/components/traffic/trafficFilters.ts +30 -1
- package/src/components/ui/Omnibar.tsx +4 -1
- package/src/components/ui/RadarOmnibar.test.tsx +55 -2
- package/src/components/ui/RadarOmnibar.tsx +7 -1
- package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
- package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
- package/src/components/ui/UpdateNotification.test.tsx +23 -1
- package/src/components/ui/UpdateNotification.tsx +26 -2
- package/src/components/ui/omnibar-match.test.ts +7 -0
- package/src/components/ui/omnibar-match.ts +1 -0
- package/src/components/ui/searchCoverageNote.test.ts +17 -0
- package/src/components/ui/searchCoverageNote.ts +31 -7
- package/src/components/useContextSwitchFlow.tsx +9 -1
- package/src/components/whats-new/releaseNotes.ts +1 -1
- package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
- package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
- package/src/components/workload/WorkloadView.tsx +51 -11
- package/src/context/ConnectionContext.test.ts +1 -0
- package/src/context/ConnectionContext.tsx +2 -2
- package/src/contexts/CapabilitiesContext.tsx +2 -0
- package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
- package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
- package/src/integrations/resourceHosts.test.tsx +2 -2
- package/src/integrations/resourceHosts.tsx +9 -0
- package/src/utils/namespacePick.test.ts +87 -0
- package/src/utils/namespacePick.ts +88 -0
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { useState, useMemo, useRef, useEffect, useCallback, forwardRef } from 'react'
|
|
2
2
|
import { useRegisterShortcuts } from '../../hooks/useKeyboardShortcuts'
|
|
3
3
|
import { Package, Search, ArrowUpCircle, LayoutGrid, List, Shield, GitBranch, ChevronRight, RotateCcw, Clock } from 'lucide-react'
|
|
4
|
-
import { PaneLoader, PageHeader, SortableTh, FreshnessControl, type SortDir, Input, usePhoneLayout } from '@skyhook-io/k8s-ui'
|
|
4
|
+
import { CertaintyGlyph, PaneLoader, PageHeader, SortableTh, FreshnessControl, type SortDir, Input, usePhoneLayout } from '@skyhook-io/k8s-ui'
|
|
5
5
|
import { useConnection } from '../../context/ConnectionContext'
|
|
6
6
|
import { clsx } from 'clsx'
|
|
7
|
-
import {
|
|
8
|
-
import type { HelmOperation, HelmRelease, SelectedHelmRelease, UpgradeInfo, ChartSource } from '../../types'
|
|
7
|
+
import { useHelmInventory, useHelmBatchUpgradeInfo, isForbiddenError } from '../../api/client'
|
|
8
|
+
import type { HelmOperation, HelmRelease, ObservedHelmRelease, SelectedHelmRelease, UpgradeInfo, ChartSource } from '../../types'
|
|
9
9
|
import { getStatusColor, formatAge, isHelmReleaseActionable } from './helm-utils'
|
|
10
10
|
import { SEVERITY_BADGE, SEVERITY_DOT, SEVERITY_TEXT } from '../../utils/badge-colors'
|
|
11
11
|
import { Tooltip } from '../ui/Tooltip'
|
|
12
12
|
import { ChartBrowser } from './ChartBrowser'
|
|
13
13
|
import { InstallWizard } from './InstallWizard'
|
|
14
|
+
import { ObservedHelmNotice } from './ObservedHelmNotice'
|
|
15
|
+
import { NotCheckedBadge } from './NotCheckedBadge'
|
|
14
16
|
|
|
15
17
|
type ViewTab = 'releases' | 'charts'
|
|
16
18
|
|
|
17
19
|
interface HelmViewProps {
|
|
18
20
|
namespaces: string[]
|
|
19
21
|
selectedRelease?: SelectedHelmRelease | null
|
|
20
|
-
onReleaseClick?: (namespace: string, name: string, storageNamespace?: string) => void
|
|
22
|
+
onReleaseClick?: (namespace: string, name: string, storageNamespace?: string, observed?: boolean) => void
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmViewProps) {
|
|
@@ -25,7 +27,13 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
25
27
|
const [searchTerm, setSearchTerm] = useState('')
|
|
26
28
|
const [selectedChart, setSelectedChart] = useState<{ repo: string; chart: string; version: string; source: ChartSource } | null>(null)
|
|
27
29
|
|
|
28
|
-
const { data:
|
|
30
|
+
const { data: inventory, isPending: isLoading, error: releasesError, dataUpdatedAt: releasesUpdatedAt, isFetching: releasesFetching, refetch: refetchReleases } = useHelmInventory(namespaces)
|
|
31
|
+
const releases = inventory?.releases
|
|
32
|
+
const observed = inventory?.observed
|
|
33
|
+
const degraded = Boolean(inventory?.storageDenied)
|
|
34
|
+
// Revision and update time exist only on rows from Helm's storage.
|
|
35
|
+
const showHelmColumns = !degraded || Boolean(releases?.length)
|
|
36
|
+
const rowCount = inventory ? inventory.releases.length + inventory.observed.length : undefined
|
|
29
37
|
const isForbidden = isForbiddenError(releasesError)
|
|
30
38
|
const releasesErrorMessage = releasesError instanceof Error ? releasesError.message : 'Failed to load Helm releases'
|
|
31
39
|
|
|
@@ -37,7 +45,9 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
37
45
|
const upgradeErrorMessage = upgradeError instanceof Error ? upgradeError.message : 'Upgrade checks failed'
|
|
38
46
|
|
|
39
47
|
const { connection } = useConnection()
|
|
40
|
-
|
|
48
|
+
// A manual refetch ignores the query's enabled flag, and with no rows from
|
|
49
|
+
// Helm there is nothing to check.
|
|
50
|
+
const refetchAll = () => Promise.all([refetchReleases(), ...(releases?.length ? [refetchUpgradeInfo()] : [])])
|
|
41
51
|
|
|
42
52
|
// Filter releases by search term
|
|
43
53
|
// Resources-table cycle: asc → desc → off (null restores the server's order).
|
|
@@ -58,21 +68,24 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
58
68
|
const effectiveSort = isPhone && sort && PHONE_HIDDEN_SORT_KEYS.has(sort.key) ? null : sort
|
|
59
69
|
|
|
60
70
|
const filteredReleases = useMemo(() => {
|
|
61
|
-
|
|
71
|
+
const rows: HelmListRow[] = [
|
|
72
|
+
...(releases ?? []).map((release): HelmListRow => ({ observed: false, release })),
|
|
73
|
+
...(observed ?? []).map((release): HelmListRow => ({ observed: true, release })),
|
|
74
|
+
]
|
|
62
75
|
const term = searchTerm.trim().toLowerCase()
|
|
63
76
|
const filtered = term
|
|
64
|
-
?
|
|
65
|
-
(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
? rows.filter(
|
|
78
|
+
(row) =>
|
|
79
|
+
row.release.name.toLowerCase().includes(term) ||
|
|
80
|
+
row.release.namespace.toLowerCase().includes(term) ||
|
|
81
|
+
row.release.chart?.toLowerCase().includes(term) ||
|
|
82
|
+
(row.observed && row.release.otherCharts?.some((label) => label.toLowerCase().includes(term)))
|
|
69
83
|
)
|
|
70
|
-
:
|
|
84
|
+
: rows
|
|
71
85
|
|
|
72
86
|
if (!effectiveSort) return filtered
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, [releases, searchTerm, effectiveSort])
|
|
87
|
+
return [...filtered].sort((a, b) => compareRows(a, b, effectiveSort.key, effectiveSort.dir === 'asc' ? 1 : -1))
|
|
88
|
+
}, [releases, observed, searchTerm, effectiveSort])
|
|
76
89
|
|
|
77
90
|
// Keyboard navigation state
|
|
78
91
|
const searchInputRef = useRef<HTMLInputElement>(null)
|
|
@@ -153,8 +166,8 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
153
166
|
category: 'Helm',
|
|
154
167
|
scope: 'helm',
|
|
155
168
|
handler: () => {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
169
|
+
const row = getHighlightedRelease()
|
|
170
|
+
if (row) onReleaseClick?.(row.release.namespace, row.release.name, row.release.storageNamespace, row.observed)
|
|
158
171
|
},
|
|
159
172
|
enabled: highlightedIndex >= 0,
|
|
160
173
|
},
|
|
@@ -219,9 +232,9 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
219
232
|
>
|
|
220
233
|
<List className="w-4 h-4" />
|
|
221
234
|
Installed
|
|
222
|
-
{
|
|
235
|
+
{rowCount !== undefined && (
|
|
223
236
|
<span className="badge-sm bg-theme-elevated">
|
|
224
|
-
{
|
|
237
|
+
{rowCount}
|
|
225
238
|
</span>
|
|
226
239
|
)}
|
|
227
240
|
</button>
|
|
@@ -262,6 +275,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
262
275
|
Upgrade checks failed: {upgradeErrorMessage}
|
|
263
276
|
</div>
|
|
264
277
|
)}
|
|
278
|
+
{inventory && degraded && <ObservedHelmNotice inventory={inventory} />}
|
|
265
279
|
{isLoading ? (
|
|
266
280
|
<PaneLoader className="h-full" />
|
|
267
281
|
) : isForbidden ? (
|
|
@@ -284,6 +298,12 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
284
298
|
Retry
|
|
285
299
|
</button>
|
|
286
300
|
</div>
|
|
301
|
+
) : degraded && rowCount === 0 ? (
|
|
302
|
+
<div className="flex flex-col items-center justify-center gap-2 px-6 py-16 text-center text-theme-text-tertiary">
|
|
303
|
+
<Package className="w-12 h-12 text-theme-text-disabled" />
|
|
304
|
+
<span className="text-theme-text-secondary">No releases found on the objects you can read</span>
|
|
305
|
+
<span className="max-w-lg text-sm">This doesn’t mean there are no releases: they may be in namespaces you can’t read, or have no objects.</span>
|
|
306
|
+
</div>
|
|
287
307
|
) : filteredReleases.length === 0 ? (
|
|
288
308
|
<div className="flex flex-col items-center justify-center h-full text-theme-text-tertiary gap-2">
|
|
289
309
|
<Package className="w-12 h-12 text-theme-text-disabled" />
|
|
@@ -296,7 +316,7 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
296
316
|
Clear search
|
|
297
317
|
</button>
|
|
298
318
|
)}
|
|
299
|
-
{!searchTerm && (
|
|
319
|
+
{!searchTerm && !degraded && (
|
|
300
320
|
<button
|
|
301
321
|
onClick={() => setActiveTab('charts')}
|
|
302
322
|
className="mt-2 px-4 py-2 text-sm text-skyhook-400 hover:text-skyhook-300 border border-skyhook-500/30 rounded-lg hover:bg-skyhook-500/10 transition-colors"
|
|
@@ -316,27 +336,29 @@ export function HelmView({ namespaces, selectedRelease, onReleaseClick }: HelmVi
|
|
|
316
336
|
<SortableTh label="Chart" sortKey="chart" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-[22%] phone:hidden" />
|
|
317
337
|
<SortableTh label="App Version" sortKey="appVersion" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-24 hidden xl:table-cell" />
|
|
318
338
|
<SortableTh label="Status" sortKey="status" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-40 phone:w-[6.5rem]" />
|
|
319
|
-
<SortableTh label="Rev" sortKey="revision" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-16 phone:hidden" />
|
|
320
|
-
<SortableTh label="Updated" sortKey="updated" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-24 phone:hidden" />
|
|
339
|
+
{showHelmColumns && <SortableTh label="Rev" sortKey="revision" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-16 phone:hidden" />}
|
|
340
|
+
{showHelmColumns && <SortableTh label="Updated" sortKey="updated" activeKey={effectiveSort?.key ?? null} direction={effectiveSort?.dir ?? 'asc'} onSort={onSort} className="w-24 phone:hidden" />}
|
|
321
341
|
</tr>
|
|
322
342
|
</thead>
|
|
323
343
|
<tbody className="table-divide-subtle">
|
|
324
|
-
{filteredReleases.map((
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
ref
|
|
328
|
-
|
|
329
|
-
upgradeInfo={upgradeInfo?.releases[releaseIdentityKey(release)]}
|
|
330
|
-
isSelected={
|
|
344
|
+
{filteredReleases.map((row, index) => {
|
|
345
|
+
const { release } = row
|
|
346
|
+
const shared = {
|
|
347
|
+
ref: index === highlightedIndex ? highlightedRowRef : null,
|
|
348
|
+
isSelected:
|
|
331
349
|
selectedRelease?.namespace === release.namespace &&
|
|
332
350
|
selectedRelease?.name === release.name &&
|
|
333
|
-
(selectedRelease?.storageNamespace || selectedRelease?.namespace) === (release.storageNamespace || release.namespace)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
351
|
+
(selectedRelease?.storageNamespace || selectedRelease?.namespace) === (release.storageNamespace || release.namespace),
|
|
352
|
+
isHighlighted: index === highlightedIndex,
|
|
353
|
+
onClick: () => onReleaseClick?.(release.namespace, release.name, release.storageNamespace, row.observed),
|
|
354
|
+
onMouseEnter: () => setHighlightedIndex(-1),
|
|
355
|
+
}
|
|
356
|
+
return row.observed ? (
|
|
357
|
+
<ObservedReleaseRow key={releaseIdentityKey(release)} {...shared} release={row.release} showHelmColumns={showHelmColumns} />
|
|
358
|
+
) : (
|
|
359
|
+
<ReleaseRow key={releaseIdentityKey(release)} {...shared} release={row.release} upgradeInfo={upgradeInfo?.releases[releaseIdentityKey(release)]} />
|
|
360
|
+
)
|
|
361
|
+
})}
|
|
340
362
|
</tbody>
|
|
341
363
|
</table>
|
|
342
364
|
)}
|
|
@@ -371,6 +393,9 @@ type HelmSortKey = 'name' | 'namespace' | 'chart' | 'appVersion' | 'status' | 'r
|
|
|
371
393
|
// Columns the release table hides on phones (the phone: classes on the headers).
|
|
372
394
|
const PHONE_HIDDEN_SORT_KEYS: ReadonlySet<HelmSortKey> = new Set<HelmSortKey>(['namespace', 'chart', 'revision', 'updated'])
|
|
373
395
|
|
|
396
|
+
// A row read from Helm's storage, or one built from the stamps on its objects.
|
|
397
|
+
type HelmListRow = { observed: false; release: HelmRelease } | { observed: true; release: ObservedHelmRelease }
|
|
398
|
+
|
|
374
399
|
function compareReleases(a: HelmRelease, b: HelmRelease, key: HelmSortKey): number {
|
|
375
400
|
let cmp: number
|
|
376
401
|
switch (key) {
|
|
@@ -386,6 +411,18 @@ function compareReleases(a: HelmRelease, b: HelmRelease, key: HelmSortKey): numb
|
|
|
386
411
|
return cmp || a.name.localeCompare(b.name)
|
|
387
412
|
}
|
|
388
413
|
|
|
414
|
+
// A value only Helm's storage has is unknown on an observed row, and unknown
|
|
415
|
+
// sorts last in both directions rather than passing for a low value.
|
|
416
|
+
export function compareRows(a: HelmListRow, b: HelmListRow, key: HelmSortKey, direction: 1 | -1): number {
|
|
417
|
+
if (!a.observed && !b.observed) return compareReleases(a.release, b.release, key) * direction
|
|
418
|
+
if (key === 'status' || key === 'revision' || key === 'updated') {
|
|
419
|
+
if (a.observed !== b.observed) return a.observed ? 1 : -1
|
|
420
|
+
return a.release.name.localeCompare(b.release.name)
|
|
421
|
+
}
|
|
422
|
+
const cmp = String(a.release[key] ?? '').localeCompare(String(b.release[key] ?? ''))
|
|
423
|
+
return (cmp || a.release.name.localeCompare(b.release.name)) * direction
|
|
424
|
+
}
|
|
425
|
+
|
|
389
426
|
interface ReleaseRowProps {
|
|
390
427
|
release: HelmRelease
|
|
391
428
|
upgradeInfo?: UpgradeInfo
|
|
@@ -395,6 +432,8 @@ interface ReleaseRowProps {
|
|
|
395
432
|
onMouseEnter?: () => void
|
|
396
433
|
}
|
|
397
434
|
|
|
435
|
+
type ObservedReleaseRowProps = Omit<ReleaseRowProps, 'release' | 'upgradeInfo'> & { release: ObservedHelmRelease; showHelmColumns: boolean }
|
|
436
|
+
|
|
398
437
|
// Get actionable tooltip content for health issues
|
|
399
438
|
function getActionableTooltip(issue: string | undefined, summary: string | undefined, health: string): React.ReactNode {
|
|
400
439
|
const issueDetails: Record<string, { description: string; action: string }> = {
|
|
@@ -501,36 +540,60 @@ function operationSummary(operation: HelmOperation): string {
|
|
|
501
540
|
}
|
|
502
541
|
}
|
|
503
542
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const listOperation = getListOperation(release)
|
|
543
|
+
function ReleaseHealthBadge({ release, observed }: { release: Pick<HelmRelease, 'resourceHealth' | 'healthIssue' | 'healthSummary'>; observed?: boolean }) {
|
|
544
|
+
if (!release.resourceHealth || release.resourceHealth === 'unknown') return null
|
|
507
545
|
|
|
508
|
-
//
|
|
509
|
-
|
|
510
|
-
|
|
546
|
+
// Healthy objects say nothing about Helm's status, and a failed release can
|
|
547
|
+
// have them, so an observed row states the count instead of a green mark.
|
|
548
|
+
const neutral = observed && release.resourceHealth === 'healthy'
|
|
549
|
+
if (neutral && !release.healthSummary) return null
|
|
511
550
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
551
|
+
const healthStyles: Record<string, { badge: string; dot: string }> = {
|
|
552
|
+
healthy: { badge: SEVERITY_BADGE.success, dot: SEVERITY_DOT.success },
|
|
553
|
+
degraded: { badge: SEVERITY_BADGE.warning, dot: SEVERITY_DOT.warning },
|
|
554
|
+
unhealthy: { badge: SEVERITY_BADGE.error, dot: SEVERITY_DOT.error },
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
const style = healthStyles[release.resourceHealth] || healthStyles.healthy
|
|
558
|
+
const tooltipContent = observed ? (
|
|
559
|
+
<div className="max-w-xs">
|
|
560
|
+
{getActionableTooltip(release.healthIssue, release.healthSummary, release.resourceHealth)}
|
|
561
|
+
<div className="mt-1 text-[10px] text-theme-text-secondary">Health of the objects you can read. It doesn’t tell you the release’s Helm status.</div>
|
|
562
|
+
</div>
|
|
563
|
+
) : getActionableTooltip(release.healthIssue, release.healthSummary, release.resourceHealth)
|
|
564
|
+
|
|
565
|
+
return (
|
|
566
|
+
<Tooltip content={tooltipContent}>
|
|
567
|
+
<span className={clsx(
|
|
568
|
+
'badge-sm shrink-0',
|
|
569
|
+
neutral ? SEVERITY_BADGE.neutral : style.badge
|
|
570
|
+
)}>
|
|
571
|
+
{!neutral && <span className={clsx('w-1.5 h-1.5 rounded-full', style.dot)} />}
|
|
572
|
+
{release.healthIssue || (neutral || release.resourceHealth !== 'healthy' ? release.healthSummary : null)}
|
|
573
|
+
</span>
|
|
574
|
+
</Tooltip>
|
|
575
|
+
)
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const UNREAD_FROM_HELM = 'Helm records this in its release Secret, which Radar can’t read here.'
|
|
517
579
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
{release.healthIssue || (release.resourceHealth !== 'healthy' ? release.healthSummary : null)}
|
|
529
|
-
</span>
|
|
530
|
-
</Tooltip>
|
|
531
|
-
)
|
|
580
|
+
function observedChartLabel(release: ObservedHelmRelease): { text: string; tooltip: string; known: boolean } {
|
|
581
|
+
if (release.chart) {
|
|
582
|
+
if (release.chartVersions?.length) {
|
|
583
|
+
return { text: `${release.chart}, mixed versions`, tooltip: `Its objects carry different versions of ${release.chart}: ${release.chartVersions.join(', ')}.`, known: true }
|
|
584
|
+
}
|
|
585
|
+
const text = release.chartVersion ? `${release.chart}-${release.chartVersion}` : release.chart
|
|
586
|
+
return { text, tooltip: release.chartVersion ? text : `${text}. Its version couldn’t be read from its objects.`, known: true }
|
|
587
|
+
}
|
|
588
|
+
if (release.otherCharts?.length) {
|
|
589
|
+
return { text: 'Several charts', tooltip: `Its objects name these charts, and none matches the release name: ${release.otherCharts.join(', ')}`, known: false }
|
|
532
590
|
}
|
|
591
|
+
return { text: 'Unknown', tooltip: 'Its objects have no helm.sh/chart label.', known: false }
|
|
592
|
+
}
|
|
533
593
|
|
|
594
|
+
const ObservedReleaseRow = forwardRef<HTMLTableRowElement, ObservedReleaseRowProps>(
|
|
595
|
+
function ObservedReleaseRow({ release, showHelmColumns, isSelected, isHighlighted, onClick, onMouseEnter }, ref) {
|
|
596
|
+
const chart = observedChartLabel(release)
|
|
534
597
|
return (
|
|
535
598
|
<tr
|
|
536
599
|
ref={ref}
|
|
@@ -549,16 +612,97 @@ const ReleaseRow = forwardRef<HTMLTableRowElement, ReleaseRowProps>(
|
|
|
549
612
|
<div className="flex min-w-0 items-center gap-2 phone:flex-wrap phone:gap-y-1">
|
|
550
613
|
<Package className="w-4 h-4 text-theme-text-tertiary shrink-0" />
|
|
551
614
|
<span className="min-w-0 truncate text-sm font-medium text-theme-text-primary phone:max-w-[calc(100%-1.5rem)] phone:shrink-0">{release.name}</span>
|
|
552
|
-
{
|
|
553
|
-
{
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
615
|
+
<ReleaseHealthBadge release={release} observed />
|
|
616
|
+
{release.managedByFluxHelmRelease && <FluxBadge release={release.managedByFluxHelmRelease} />}
|
|
617
|
+
</div>
|
|
618
|
+
<span className="hidden truncate pl-6 text-xs text-theme-text-tertiary phone:block">{release.namespace}</span>
|
|
619
|
+
</td>
|
|
620
|
+
<td className="px-4 py-3 w-[18%] phone:hidden">
|
|
621
|
+
<Tooltip content={release.namespace}>
|
|
622
|
+
<span className="block truncate text-sm text-theme-text-secondary">{release.namespace}</span>
|
|
623
|
+
</Tooltip>
|
|
624
|
+
</td>
|
|
625
|
+
<td className="px-4 py-3 w-[22%] phone:hidden">
|
|
626
|
+
<Tooltip content={chart.tooltip}>
|
|
627
|
+
<span className={clsx('text-sm truncate block', chart.known ? 'text-theme-text-secondary' : 'text-theme-text-tertiary')}>{chart.text}</span>
|
|
628
|
+
</Tooltip>
|
|
629
|
+
</td>
|
|
630
|
+
<td className="px-4 py-3 w-24 hidden xl:table-cell">
|
|
631
|
+
{release.appVersion ? (
|
|
632
|
+
<span className="text-sm text-theme-text-secondary">{release.appVersion}</span>
|
|
633
|
+
) : release.appVersions?.length ? (
|
|
634
|
+
<Tooltip content={`Its objects carry different app versions: ${release.appVersions.join(', ')}.`}>
|
|
635
|
+
<span className="text-sm text-theme-text-secondary cursor-help">Mixed</span>
|
|
636
|
+
</Tooltip>
|
|
637
|
+
) : (
|
|
638
|
+
<Tooltip content="No app version could be read from its objects.">
|
|
639
|
+
<span className="text-sm text-theme-text-disabled cursor-help">—</span>
|
|
640
|
+
</Tooltip>
|
|
641
|
+
)}
|
|
642
|
+
</td>
|
|
643
|
+
<td className="px-4 py-3 w-40 phone:w-[6.5rem] phone:px-3">
|
|
644
|
+
<div className="flex flex-wrap items-center gap-1">
|
|
645
|
+
<Tooltip content={UNREAD_FROM_HELM}>
|
|
646
|
+
<span className={clsx('badge', SEVERITY_BADGE.neutral)}>Unknown</span>
|
|
647
|
+
</Tooltip>
|
|
648
|
+
{(release.chartVersions?.length || release.appVersions?.length) ? (
|
|
649
|
+
<Tooltip content={`Its objects carry different versions (${[...(release.chartVersions ?? []), ...(release.appVersions ?? [])].join(', ')}), as an interrupted upgrade can leave them. Helm’s own status can’t be read here.`}>
|
|
650
|
+
<span className={clsx('badge-sm', SEVERITY_BADGE.warning)}>versions differ</span>
|
|
560
651
|
</Tooltip>
|
|
561
|
-
)}
|
|
652
|
+
) : null}
|
|
653
|
+
</div>
|
|
654
|
+
</td>
|
|
655
|
+
{showHelmColumns && (
|
|
656
|
+
<>
|
|
657
|
+
<td className="px-4 py-3 w-16 phone:hidden">
|
|
658
|
+
<CertaintyGlyph certainty="unknown" title={UNREAD_FROM_HELM} />
|
|
659
|
+
</td>
|
|
660
|
+
<td className="px-4 py-3 w-24 phone:hidden">
|
|
661
|
+
<CertaintyGlyph certainty="unknown" title={UNREAD_FROM_HELM} />
|
|
662
|
+
</td>
|
|
663
|
+
</>
|
|
664
|
+
)}
|
|
665
|
+
</tr>
|
|
666
|
+
)
|
|
667
|
+
})
|
|
668
|
+
|
|
669
|
+
function FluxBadge({ release }: { release?: string }) {
|
|
670
|
+
return (
|
|
671
|
+
<Tooltip content={release ? `Installed by Flux helm-controller via HelmRelease ${release}. Manage its source in GitOps.` : "The owning Flux HelmRelease's namespace isn't available in this view, or Radar couldn't check your access. Manage this release through Flux; direct Helm changes may be reconciled back."}>
|
|
672
|
+
<span className="badge-sm shrink-0 border border-theme-border bg-theme-elevated text-theme-text-secondary">
|
|
673
|
+
<GitBranch className="w-3 h-3" />
|
|
674
|
+
Flux
|
|
675
|
+
</span>
|
|
676
|
+
</Tooltip>
|
|
677
|
+
)
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
const ReleaseRow = forwardRef<HTMLTableRowElement, ReleaseRowProps>(
|
|
681
|
+
function ReleaseRow({ release, upgradeInfo, isSelected, isHighlighted, onClick, onMouseEnter }, ref) {
|
|
682
|
+
const listOperation = getListOperation(release)
|
|
683
|
+
|
|
684
|
+
return (
|
|
685
|
+
<tr
|
|
686
|
+
ref={ref}
|
|
687
|
+
onClick={onClick}
|
|
688
|
+
onMouseEnter={onMouseEnter}
|
|
689
|
+
className={clsx(
|
|
690
|
+
'cursor-pointer transition-colors',
|
|
691
|
+
isSelected
|
|
692
|
+
? 'selection-strong hover:bg-skyhook-500/30'
|
|
693
|
+
: isHighlighted
|
|
694
|
+
? 'selection selection-ring'
|
|
695
|
+
: 'hover:bg-theme-surface/50'
|
|
696
|
+
)}
|
|
697
|
+
>
|
|
698
|
+
<td className="px-4 py-3 phone:px-3">
|
|
699
|
+
<div className="flex min-w-0 items-center gap-2 phone:flex-wrap phone:gap-y-1">
|
|
700
|
+
<Package className="w-4 h-4 text-theme-text-tertiary shrink-0" />
|
|
701
|
+
<span className="min-w-0 truncate text-sm font-medium text-theme-text-primary phone:max-w-[calc(100%-1.5rem)] phone:shrink-0">{release.name}</span>
|
|
702
|
+
<ReleaseHealthBadge release={release} />
|
|
703
|
+
<NotCheckedBadge count={release.statusUnreadCount} />
|
|
704
|
+
{listOperation && <HelmOperationChip operation={listOperation} />}
|
|
705
|
+
{(release.managedByFlux || release.managedByFluxHelmRelease) && <FluxBadge release={release.managedByFluxHelmRelease} />}
|
|
562
706
|
{upgradeInfo?.updateAvailable && (
|
|
563
707
|
<Tooltip content={`Upgrade available: ${release.chartVersion} → ${upgradeInfo.latestVersion}`}>
|
|
564
708
|
<span className={clsx('badge-sm shrink-0', SEVERITY_BADGE.warning)}>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
3
|
+
import { NotCheckedBadge, notCheckedTooltip } from './NotCheckedBadge'
|
|
4
|
+
|
|
5
|
+
vi.mock('../../api/client', () => ({
|
|
6
|
+
useRadarFeature: () => ({ support: 'supported' }),
|
|
7
|
+
}))
|
|
8
|
+
|
|
9
|
+
const { HelmSummary } = await import('../home/HelmSummary')
|
|
10
|
+
|
|
11
|
+
describe('the "not checked" mark on a release', () => {
|
|
12
|
+
it('shows the count when objects were left out', () => {
|
|
13
|
+
expect(renderToStaticMarkup(<NotCheckedBadge count={2} />)).toContain('2 objects not checked')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('is absent when everything was checked', () => {
|
|
17
|
+
expect(renderToStaticMarkup(<NotCheckedBadge count={0} />)).toBe('')
|
|
18
|
+
expect(renderToStaticMarkup(<NotCheckedBadge />)).toBe('')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('does not call an unanswered check a denial', () => {
|
|
22
|
+
expect(notCheckedTooltip(1, 'unconfirmed')).not.toMatch(/can’t read/)
|
|
23
|
+
expect(notCheckedTooltip(1, 'denied')).toMatch(/can’t read/)
|
|
24
|
+
expect(notCheckedTooltip(2, 'either')).toMatch(/can’t read them, or Radar couldn’t confirm/)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('separates unchecked object status from release health', () => {
|
|
28
|
+
const reasons: Parameters<typeof notCheckedTooltip>[1][] = ['denied', 'either']
|
|
29
|
+
for (const reason of reasons) {
|
|
30
|
+
expect(notCheckedTooltip(2, reason)).toContain('Release health uses workload and Pod status.')
|
|
31
|
+
expect(notCheckedTooltip(2, reason)).toContain('This count can include other objects.')
|
|
32
|
+
expect(notCheckedTooltip(2, reason)).not.toContain('Health covers only')
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('explains that a release badge counts only health-relevant objects', () => {
|
|
37
|
+
expect(notCheckedTooltip(1, 'either', 'health')).toContain('workloads or Pods')
|
|
38
|
+
expect(notCheckedTooltip(1, 'either', 'health')).not.toContain('can include other objects')
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('the Home Helm card', () => {
|
|
43
|
+
const row = { namespace: 'team-a', chart: 'platform-app', chartVersion: '0.1.0', status: 'deployed' }
|
|
44
|
+
|
|
45
|
+
it('marks only the release whose health left objects out', () => {
|
|
46
|
+
const html = renderToStaticMarkup(
|
|
47
|
+
<HelmSummary
|
|
48
|
+
onNavigate={() => {}}
|
|
49
|
+
data={{
|
|
50
|
+
total: 2,
|
|
51
|
+
releases: [
|
|
52
|
+
{ ...row, name: 'payments', resourceHealth: 'unknown', statusUnreadCount: 1 },
|
|
53
|
+
{ ...row, name: 'billing', resourceHealth: 'healthy' },
|
|
54
|
+
],
|
|
55
|
+
}}
|
|
56
|
+
/>,
|
|
57
|
+
)
|
|
58
|
+
expect(html.match(/not checked/g)).toHaveLength(1)
|
|
59
|
+
expect(html.indexOf('1 object not checked')).toBeGreaterThan(html.indexOf('payments'))
|
|
60
|
+
expect(html.indexOf('1 object not checked')).toBeLessThan(html.indexOf('billing'))
|
|
61
|
+
})
|
|
62
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { clsx } from 'clsx'
|
|
2
|
+
import { SEVERITY_BADGE } from '../../utils/badge-colors'
|
|
3
|
+
import { Tooltip } from '../ui/Tooltip'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Why some of a release's objects weren't checked. "denied": the caller can't
|
|
7
|
+
* read them. "unconfirmed": the access check went unanswered. "either": both,
|
|
8
|
+
* or not known which (a count alone doesn't say).
|
|
9
|
+
*/
|
|
10
|
+
export type NotCheckedReason = 'denied' | 'unconfirmed' | 'either'
|
|
11
|
+
|
|
12
|
+
export function notCheckedTooltip(count: number, reason: NotCheckedReason = 'either', scope: 'objects' | 'health' = 'objects'): string {
|
|
13
|
+
const one = count === 1
|
|
14
|
+
const objects = `${count} of this release’s ${scope === 'health' ? 'workloads or Pods' : 'objects'}`
|
|
15
|
+
const coverage = scope === 'health'
|
|
16
|
+
? 'Release health covers only the workloads and Pods that were checked.'
|
|
17
|
+
: 'Release health uses workload and Pod status. This count can include other objects.'
|
|
18
|
+
switch (reason) {
|
|
19
|
+
case 'denied':
|
|
20
|
+
return `You can’t read ${objects}, so ${one ? 'it wasn’t' : 'they weren’t'} checked. ${coverage}`
|
|
21
|
+
case 'unconfirmed':
|
|
22
|
+
return `Radar couldn’t confirm your access to ${objects}, so ${one ? 'it wasn’t' : 'they weren’t'} checked. Refresh to try again.`
|
|
23
|
+
default:
|
|
24
|
+
return `${objects.charAt(0).toUpperCase()}${objects.slice(1)} ${one ? 'wasn’t' : 'weren’t'} checked: you can’t read ${one ? 'it' : 'them'}, or Radar couldn’t confirm your access. ${coverage}`
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Grey "N not checked" mark for a release whose health leaves objects out. */
|
|
29
|
+
export function NotCheckedBadge({ count }: { count?: number }) {
|
|
30
|
+
if (!count || count <= 0) return null
|
|
31
|
+
return (
|
|
32
|
+
<Tooltip content={<div className="max-w-xs">{notCheckedTooltip(count, 'either', 'health')}</div>}>
|
|
33
|
+
<span className={clsx('badge-sm shrink-0 whitespace-nowrap', SEVERITY_BADGE.neutral)}>
|
|
34
|
+
<span className="w-1.5 h-1.5 rounded-full bg-theme-text-tertiary" />
|
|
35
|
+
{count} {count === 1 ? 'object' : 'objects'} not checked
|
|
36
|
+
</span>
|
|
37
|
+
</Tooltip>
|
|
38
|
+
)
|
|
39
|
+
}
|