@skyhook-io/radar-app 1.19.0 → 1.20.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 +1 -1
- package/package.json +5 -5
- package/src/App.tsx +37 -9
- package/src/api/application-evidence.ts +63 -0
- package/src/api/argoSync.test.ts +22 -0
- package/src/api/client.audit-gating.test.tsx +48 -0
- package/src/api/client.kueuePosition.test.ts +32 -0
- package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
- package/src/api/client.resource-identity.test.ts +3 -0
- package/src/api/client.resourceIssues.test.tsx +239 -0
- package/src/api/client.resourcePath.test.ts +3 -0
- package/src/api/client.ts +353 -64
- package/src/api/config.ts +21 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/helmInventory.test.tsx +108 -0
- package/src/api/radarFeatures.render.test.tsx +33 -1
- package/src/api/radarFeatures.test.ts +47 -0
- package/src/api/radarFeatures.ts +42 -1
- package/src/api/rbac.settled.test.tsx +42 -0
- package/src/api/rbac.test.ts +18 -0
- package/src/api/rbac.ts +37 -7
- package/src/api/traffic.ts +9 -4
- package/src/api/usage-data.fixtures.ts +3 -1
- package/src/api/usage-data.test.tsx +134 -0
- package/src/api/usage-data.ts +35 -7
- package/src/api/workloadPodsPolling.test.ts +26 -0
- package/src/components/CloudConnectFlow.test.tsx +86 -0
- package/src/components/CloudConnectFlow.tsx +65 -27
- package/src/components/CloudFunnelButton.test.tsx +140 -5
- package/src/components/CloudFunnelButton.tsx +50 -9
- package/src/components/ConnectionErrorView.test.tsx +34 -0
- package/src/components/ConnectionErrorView.tsx +35 -11
- package/src/components/ContextSwitcher.tsx +5 -2
- package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
- package/src/components/SwitchAwareConnectionError.tsx +85 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
- package/src/components/capacity/CapacityDemand.tsx +3 -2
- package/src/components/capacity/demandSummary.test.ts +38 -0
- package/src/components/capacity/shared.tsx +12 -1
- package/src/components/cost/ApplicationCostTab.tsx +4 -0
- package/src/components/cost/CostTrendChart.tsx +2 -0
- package/src/components/cost/WorkloadCostTab.tsx +4 -0
- package/src/components/cost/source.test.ts +5 -0
- package/src/components/cost/source.ts +11 -0
- package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
- package/src/components/curl/ServiceCurlButton.tsx +2 -2
- package/src/components/diagnose/AIMarkdown.tsx +3 -0
- package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
- package/src/components/diagnose/AgentSetupNotice.tsx +21 -3
- package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
- package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +1 -1
- package/src/components/diagnose/DiagnoseContext.tsx +68 -2
- package/src/components/diagnose/DiagnoseSurface.tsx +58 -113
- package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
- package/src/components/diagnose/Home.test.tsx +26 -0
- package/src/components/diagnose/Home.tsx +20 -1
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +45 -22
- package/src/components/diagnose/InvestigationView.tsx +94 -26
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
- package/src/components/diagnose/LocalDiagnoseAction.tsx +354 -35
- package/src/components/diagnose/NextStepJump.test.tsx +92 -0
- package/src/components/diagnose/NextStepJump.tsx +75 -0
- package/src/components/diagnose/QuestionComposer.tsx +8 -0
- package/src/components/diagnose/exampleInvestigation.events.json +191 -0
- package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
- package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
- package/src/components/diagnose/exampleInvestigation.ts +121 -0
- package/src/components/diagnose/investigationCase.test.tsx +50 -1
- package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +50 -2
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +51 -16
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
- 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/builder.ts +30 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
- package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationState.ts +28 -0
- package/src/components/diagnose/lastInvestigation.test.ts +95 -0
- package/src/components/diagnose/lastInvestigation.ts +58 -0
- package/src/components/diagnose/launch.test.ts +125 -1
- package/src/components/diagnose/launch.ts +57 -10
- package/src/components/diagnose/toolCallLabel.test.ts +10 -4
- package/src/components/execution/BatchExecutionView.tsx +24 -11
- package/src/components/execution/JobSetAdmission.test.tsx +42 -0
- package/src/components/execution/JobSetAdmission.tsx +18 -3
- package/src/components/execution/JobSetMemberComparison.tsx +2 -1
- package/src/components/execution/runState.test.ts +14 -0
- package/src/components/execution/runState.ts +8 -0
- package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
- package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
- package/src/components/gitops/GitOpsView.tsx +86 -17
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
- package/src/components/gitops/destination-toast.test.ts +1 -1
- package/src/components/gitops/destination-toast.ts +2 -2
- package/src/components/helm/HelmDrawerFrame.tsx +101 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +23 -86
- package/src/components/helm/HelmView.tsx +213 -71
- 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.tsx +4 -2
- package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
- package/src/components/home/ClusterHealthCard.tsx +28 -5
- package/src/components/home/HelmSummary.tsx +23 -4
- package/src/components/home/HelmSummary.unread.test.ts +16 -0
- package/src/components/home/HomeAgentBlock.test.tsx +31 -3
- package/src/components/home/HomeAgentBlock.tsx +20 -4
- package/src/components/home/HomeDiagramCard.tsx +47 -0
- package/src/components/home/HomeView.tsx +81 -41
- package/src/components/home/MCPSetupDialog.test.tsx +126 -10
- package/src/components/home/MCPSetupDialog.tsx +33 -5
- package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
- package/src/components/home/ProblemsPanel.test.tsx +3 -1
- package/src/components/home/TopologyPreview.test.tsx +73 -0
- package/src/components/home/TopologyPreview.tsx +120 -233
- package/src/components/home/TrafficSummary.test.tsx +63 -0
- package/src/components/home/TrafficSummary.tsx +135 -138
- package/src/components/home/mcpToolCatalog.ts +67 -14
- package/src/components/issues/IssuesPane.test.ts +11 -0
- package/src/components/issues/IssuesPane.tsx +15 -5
- package/src/components/issues/uncheckedSources.test.ts +22 -1
- package/src/components/issues/uncheckedSources.ts +21 -0
- package/src/components/kueue/KueuePendingPosition.tsx +35 -0
- package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
- package/src/components/kueue/useRelatedReads.test.ts +56 -0
- package/src/components/kueue/useRelatedReads.ts +205 -0
- package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
- package/src/components/logs/MultiPodLogsTab.tsx +120 -0
- package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
- package/src/components/logs/PodLogsUnavailable.tsx +21 -0
- package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
- package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
- package/src/components/logs/RayClusterLogsTab.tsx +109 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
- package/src/components/logs/rayClusterPods.ts +32 -0
- package/src/components/outageSince.test.ts +21 -0
- package/src/components/outageSince.ts +10 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
- package/src/components/resource/PrometheusCharts.tsx +3 -40
- package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
- package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
- package/src/components/resources/crd/host.tsx +14 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
- package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
- package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
- package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
- package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
- package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
- package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
- package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
- package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
- 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/traffic/TrafficView.tsx +3 -3
- package/src/components/ui/command-items-crd.test.tsx +23 -0
- package/src/components/ui/command-items.ts +2 -1
- package/src/components/useContextSwitchFlow.test.tsx +61 -0
- package/src/components/useContextSwitchFlow.tsx +21 -4
- package/src/components/whats-new/WhatsNew.test.ts +10 -3
- package/src/components/whats-new/WhatsNew.tsx +5 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +17 -3
- package/src/components/whats-new/releaseNotes.ts +77 -4
- package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
- package/src/components/workload/RelatedFindingsSection.tsx +80 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +85 -98
- package/src/components/workload/issueResourceOpener.test.ts +20 -0
- package/src/components/workload/issueResourceOpener.ts +17 -0
- package/src/context/ConnectionContext.tsx +133 -60
- package/src/context/ConnectionProvider.retry.test.tsx +176 -0
- package/src/context/ContextSwitchContext.tsx +14 -1
- package/src/context/DiagnoseCustomization.tsx +3 -0
- package/src/context/clusterConnected.ts +10 -0
- package/src/contexts/CapabilitiesContext.tsx +8 -4
- package/src/hooks/useElementSize.ts +30 -0
- package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
- package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
- package/src/integrations/resourceHost.test.tsx +1 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +21 -4
- package/src/integrations/resourceHosts.tsx +17 -0
- package/src/main.tsx +5 -0
- package/src/utils/related-findings.ts +46 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, type ReactElement } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
6
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
7
|
+
import type { HelmInventory, ObservedHelmRelease } from '../../types'
|
|
8
|
+
import { ApiError, isHelmReleaseReadDenied } from '../../api/client'
|
|
9
|
+
import { compareRows, HelmView } from './HelmView'
|
|
10
|
+
import { ObservedHelmNotice } from './ObservedHelmNotice'
|
|
11
|
+
|
|
12
|
+
const inventoryState = vi.hoisted(() => ({
|
|
13
|
+
current: { data: undefined, isPending: false, error: null } as { data?: unknown; isPending: boolean; error: unknown },
|
|
14
|
+
refetchUpgrades: vi.fn(),
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
vi.mock('../../api/client', async (importOriginal) => ({
|
|
18
|
+
...(await importOriginal<typeof import('../../api/client')>()),
|
|
19
|
+
useHelmInventory: () => ({ ...inventoryState.current, dataUpdatedAt: 0, isFetching: false, refetch: vi.fn() }),
|
|
20
|
+
useHelmBatchUpgradeInfo: () => ({ data: undefined, isLoading: false, error: null, refetch: inventoryState.refetchUpgrades }),
|
|
21
|
+
}))
|
|
22
|
+
vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { state: 'connected' } }) }))
|
|
23
|
+
vi.mock('../../hooks/useKeyboardShortcuts', () => ({ useRegisterShortcuts: () => undefined }))
|
|
24
|
+
vi.mock('./ChartBrowser', () => ({ ChartBrowser: () => null }))
|
|
25
|
+
vi.mock('@skyhook-io/k8s-ui', async (importOriginal) => ({
|
|
26
|
+
...(await importOriginal<typeof import('@skyhook-io/k8s-ui')>()),
|
|
27
|
+
FreshnessControl: ({ onRefresh }: { onRefresh: () => void }) => <button onClick={onRefresh}>Refresh</button>,
|
|
28
|
+
}))
|
|
29
|
+
vi.mock('./InstallWizard', () => ({ InstallWizard: () => null }))
|
|
30
|
+
|
|
31
|
+
;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
|
|
32
|
+
|
|
33
|
+
let root: Root | undefined
|
|
34
|
+
|
|
35
|
+
function mount(element: ReactElement): HTMLElement {
|
|
36
|
+
const container = document.createElement('div')
|
|
37
|
+
document.body.appendChild(container)
|
|
38
|
+
root = createRoot(container)
|
|
39
|
+
act(() => root!.render(element))
|
|
40
|
+
return container
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
act(() => root?.unmount())
|
|
45
|
+
root = undefined
|
|
46
|
+
document.body.innerHTML = ''
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const observed: ObservedHelmRelease = { name: 'api', namespace: 'team-b', chart: 'api', chartVersion: '1.2.3', appVersion: '9.9', resourceCount: 3, resourceHealth: 'healthy', healthSummary: '1/1 ready' }
|
|
50
|
+
|
|
51
|
+
function denied(rows: ObservedHelmRelease[]): HelmInventory {
|
|
52
|
+
return { releases: [], observed: rows, storageDenied: { count: 2, names: ['team-a', 'team-b'] }, objectCoverage: { status: 'complete', gaps: [] } }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function renderView(state: Partial<typeof inventoryState.current>) {
|
|
56
|
+
inventoryState.current = { data: undefined, isPending: false, error: null, ...state }
|
|
57
|
+
return mount(
|
|
58
|
+
<QueryClientProvider client={new QueryClient()}>
|
|
59
|
+
<MemoryRouter>
|
|
60
|
+
<HelmView namespaces={[]} />
|
|
61
|
+
</MemoryRouter>
|
|
62
|
+
</QueryClientProvider>,
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function row(container: HTMLElement, name: string): string {
|
|
67
|
+
const match = [...container.querySelectorAll('tbody tr')].find((tr) => tr.textContent?.startsWith(name))
|
|
68
|
+
expect(match).toBeDefined()
|
|
69
|
+
return match!.textContent ?? ''
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
describe('Helm list without Secret access', () => {
|
|
73
|
+
it('never shows a status, revision or update time for an observed row', () => {
|
|
74
|
+
const text = row(renderView({ data: denied([observed]) }), 'api')
|
|
75
|
+
expect(text).toContain('Unknown')
|
|
76
|
+
expect(text).toContain('api-1.2.3')
|
|
77
|
+
expect(text).not.toMatch(/deployed/i)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('names several charts instead of picking one, and an unlabelled chart as unknown', () => {
|
|
81
|
+
const container = renderView({ data: denied([
|
|
82
|
+
{ name: 'umbrella', namespace: 'team-b', otherCharts: ['parent-2.0.0', 'sub-0.5.0'], resourceCount: 4 },
|
|
83
|
+
{ name: 'plain', namespace: 'team-b', resourceCount: 1 },
|
|
84
|
+
]) })
|
|
85
|
+
expect(row(container, 'umbrella')).toContain('Several charts')
|
|
86
|
+
expect(row(container, 'plain').match(/Unknown/g)).toHaveLength(2)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('says versions are mixed rather than picking one', () => {
|
|
90
|
+
const text = row(renderView({ data: denied([
|
|
91
|
+
{ name: 'api', namespace: 'team-b', chart: 'api', chartVersions: ['1.0.0', '2.0.0'], appVersions: ['1', '2'], resourceCount: 4 },
|
|
92
|
+
]) }), 'api')
|
|
93
|
+
expect(text).toContain('api, mixed versions')
|
|
94
|
+
expect(text).toContain('Mixed')
|
|
95
|
+
expect(text).toContain('versions differ')
|
|
96
|
+
expect(text).not.toContain('api-2.0.0')
|
|
97
|
+
expect(row(renderView({ data: denied([observed]) }), 'api')).not.toContain('versions differ')
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('finds a release with several charts by any of their names', () => {
|
|
101
|
+
const container = renderView({ data: denied([
|
|
102
|
+
{ name: 'umbrella', namespace: 'team-b', otherCharts: ['parent-2.0.0', 'sub-0.5.0'], resourceCount: 4 },
|
|
103
|
+
observed,
|
|
104
|
+
]) })
|
|
105
|
+
const search = container.querySelector<HTMLInputElement>('input[placeholder="Search releases..."]')!
|
|
106
|
+
const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')!.set!
|
|
107
|
+
act(() => {
|
|
108
|
+
setValue.call(search, 'parent')
|
|
109
|
+
search.dispatchEvent(new Event('input', { bubbles: true }))
|
|
110
|
+
})
|
|
111
|
+
const names = [...container.querySelectorAll('tbody tr')].map((tr) => tr.textContent ?? '')
|
|
112
|
+
expect(names.some((text) => text.startsWith('umbrella'))).toBe(true)
|
|
113
|
+
expect(names.some((text) => text.startsWith('api'))).toBe(false)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('does not let an empty list read as no releases', () => {
|
|
117
|
+
const text = renderView({ data: denied([]) }).textContent
|
|
118
|
+
expect(text).toContain('No releases found on the objects you can read')
|
|
119
|
+
expect(text).toContain('doesn’t mean there are no releases')
|
|
120
|
+
expect(text).not.toContain('No Helm releases found')
|
|
121
|
+
expect(text).not.toContain('Browse charts to install')
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it('shows no callout when everything came from Helm', () => {
|
|
125
|
+
const text = renderView({ data: { releases: [], observed: [] } }).textContent
|
|
126
|
+
expect(text).toContain('No Helm releases found')
|
|
127
|
+
expect(text).not.toContain('Built from labels and annotations')
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it('does not refresh upgrade checks when no row came from Helm', () => {
|
|
131
|
+
inventoryState.refetchUpgrades.mockClear()
|
|
132
|
+
const container = renderView({ data: denied([observed]) })
|
|
133
|
+
const refresh = [...container.querySelectorAll('button')].find((b) => b.textContent === 'Refresh')!
|
|
134
|
+
act(() => refresh.click())
|
|
135
|
+
expect(inventoryState.refetchUpgrades).not.toHaveBeenCalled()
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('still refreshes upgrade checks for rows from Helm', () => {
|
|
139
|
+
inventoryState.refetchUpgrades.mockClear()
|
|
140
|
+
const release = { name: 'x', namespace: 'ns', chart: 'c', chartVersion: '1', appVersion: '1', status: 'deployed', revision: 1, updated: '2026-01-01T00:00:00Z' }
|
|
141
|
+
const container = renderView({ data: { releases: [release], observed: [] } })
|
|
142
|
+
const refresh = [...container.querySelectorAll('button')].find((b) => b.textContent === 'Refresh')!
|
|
143
|
+
act(() => refresh.click())
|
|
144
|
+
expect(inventoryState.refetchUpgrades).toHaveBeenCalledOnce()
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('waits rather than saying there are no releases while the read has not started', () => {
|
|
148
|
+
expect(renderView({ isPending: true }).textContent).not.toContain('No Helm releases found')
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
it('keeps the restricted state for a Radar without the inventory', () => {
|
|
152
|
+
expect(renderView({ error: new ApiError('forbidden', 403) }).textContent).toContain('Access Restricted')
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
describe('columns only Helm can fill', () => {
|
|
157
|
+
const headers = (container: HTMLElement) => [...container.querySelectorAll('th')].map((th) => th.textContent)
|
|
158
|
+
|
|
159
|
+
it('drops revision and update time when no row has them', () => {
|
|
160
|
+
const labels = headers(renderView({ data: denied([observed]) }))
|
|
161
|
+
expect(labels.join()).toContain('Status')
|
|
162
|
+
expect(labels.join()).not.toMatch(/Rev|Updated/)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
it('keeps them when any row came from Helm', () => {
|
|
166
|
+
const data = { ...denied([observed]), releases: [{ name: 'web', namespace: 'team-a', chart: 'web', chartVersion: '1', appVersion: '1', status: 'deployed', revision: 2, updated: '2026-01-01T00:00:00Z' }] }
|
|
167
|
+
expect(headers(renderView({ data })).join()).toMatch(/Rev.*Updated/)
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
describe('health on an observed row', () => {
|
|
172
|
+
it('states healthy objects as a count, with no green mark beside an unknown status', () => {
|
|
173
|
+
const container = renderView({ data: denied([observed]) })
|
|
174
|
+
expect(row(container, 'api')).toContain('1/1 ready')
|
|
175
|
+
expect(container.querySelector('tbody .badge-sm .rounded-full')).toBeNull()
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
it('keeps the mark on a real problem', () => {
|
|
179
|
+
const container = renderView({ data: denied([{ ...observed, resourceHealth: 'unhealthy', healthSummary: '0/1 ready' }]) })
|
|
180
|
+
expect(row(container, 'api')).toContain('0/1 ready')
|
|
181
|
+
expect(container.querySelector('tbody .badge-sm .rounded-full')).not.toBeNull()
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
describe('ObservedHelmNotice', () => {
|
|
186
|
+
it('names what it reads and that it can miss things, before any expanding', () => {
|
|
187
|
+
const text = mount(<ObservedHelmNotice inventory={denied([observed])} />).textContent
|
|
188
|
+
expect(text).toContain('Built from labels and annotations, not Helm’s own records')
|
|
189
|
+
for (const name of ['meta.helm.sh/release-name', 'meta.helm.sh/release-namespace', 'helm.sh/chart', 'app.kubernetes.io/version']) {
|
|
190
|
+
expect(text).toContain(name)
|
|
191
|
+
}
|
|
192
|
+
expect(text).toContain('source of truth Helm itself uses, so this view can miss things, and a failed release can look fine')
|
|
193
|
+
expect(text).toContain('in team-a, team-b')
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
it('keeps the detail behind the disclosure', () => {
|
|
197
|
+
const container = mount(<ObservedHelmNotice inventory={denied([observed])} />)
|
|
198
|
+
const toggle = container.querySelector('button')!
|
|
199
|
+
expect(toggle.textContent).toContain('What’s affected')
|
|
200
|
+
expect(toggle.getAttribute('aria-expanded')).toBe('false')
|
|
201
|
+
expect(container.textContent).toContain('How to get the full view: get and list access to Secrets')
|
|
202
|
+
expect(container.textContent).toContain('That opens every Secret there')
|
|
203
|
+
act(() => toggle.click())
|
|
204
|
+
expect(toggle.getAttribute('aria-expanded')).toBe('true')
|
|
205
|
+
expect(container.textContent).toContain('Releases that failed before creating any object.')
|
|
206
|
+
for (const heading of ['Not shown', 'Not listed', 'Can differ from Helm']) {
|
|
207
|
+
expect(container.querySelector(`section[aria-label="${heading}"]`)).not.toBeNull()
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
it('counts namespaces it cannot name', () => {
|
|
212
|
+
const text = mount(<ObservedHelmNotice inventory={{ ...denied([]), storageDenied: { count: 80 } }} />).textContent
|
|
213
|
+
expect(text).toContain('in 80 namespaces')
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
it('speaks of the whole view when everything was denied', () => {
|
|
217
|
+
const text = mount(<ObservedHelmNotice inventory={{ ...denied([]), storageDenied: { extent: 'all' } }} />).textContent
|
|
218
|
+
expect(text).toContain('Radar can’t read Helm’s release Secrets here')
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
it('says where the rows come from when only some are observed', () => {
|
|
222
|
+
const inventory = { ...denied([observed]), releases: [{ name: 'x' } as HelmInventory['releases'][number]], storageDenied: { count: 1, names: ['team-b'] } }
|
|
223
|
+
expect(mount(<ObservedHelmNotice inventory={inventory} />).textContent).toContain('releases there come from')
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
it('adds what the object read itself did not reach', () => {
|
|
227
|
+
const inventory: HelmInventory = { ...denied([]), objectCoverage: { status: 'partial', gaps: [{ code: 'kind_sync_pending', action: 'retry' }] } }
|
|
228
|
+
expect(mount(<ObservedHelmNotice inventory={inventory} />).textContent).toContain('Some objects weren’t read (still loading)')
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
describe('compareRows', () => {
|
|
233
|
+
const full = (name: string, status: string, revision: number) => ({
|
|
234
|
+
observed: false as const,
|
|
235
|
+
release: { name, namespace: 'ns', chart: 'c', chartVersion: '1', appVersion: '1', status, revision, updated: '2026-01-01T00:00:00Z' } as HelmInventory['releases'][number],
|
|
236
|
+
})
|
|
237
|
+
const seen = (name: string) => ({ observed: true as const, release: { name, namespace: 'ns', resourceCount: 1 } })
|
|
238
|
+
|
|
239
|
+
it('sorts an unknown value last in both directions', () => {
|
|
240
|
+
for (const direction of [1, -1] as const) {
|
|
241
|
+
const sorted = [seen('b'), full('a', 'deployed', 2), seen('a'), full('b', 'failed', 1)]
|
|
242
|
+
.sort((x, y) => compareRows(x, y, 'revision', direction))
|
|
243
|
+
.map((r) => r.observed)
|
|
244
|
+
expect(sorted).toEqual([false, false, true, true])
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
it('sorts what an observed row does know alongside the rest', () => {
|
|
249
|
+
const sorted = [seen('b'), full('a', 'deployed', 2)].sort((x, y) => compareRows(x, y, 'name', 1))
|
|
250
|
+
expect(sorted[0].release.name).toBe('a')
|
|
251
|
+
})
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
describe('isHelmReleaseReadDenied', () => {
|
|
255
|
+
it('matches only the caller being refused Helm storage', () => {
|
|
256
|
+
expect(isHelmReleaseReadDenied(new ApiError('no', 403, { error_code: 'release_read_denied' }))).toBe(true)
|
|
257
|
+
expect(isHelmReleaseReadDenied(new ApiError('no', 403))).toBe(false)
|
|
258
|
+
expect(isHelmReleaseReadDenied(new ApiError('no', 403, { error_code: 'other' }))).toBe(false)
|
|
259
|
+
expect(isHelmReleaseReadDenied(new ApiError('no', 500, { error_code: 'release_read_denied' }))).toBe(false)
|
|
260
|
+
})
|
|
261
|
+
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, type ReactElement } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
5
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
6
|
+
import { ApiError } from '../../api/client'
|
|
7
|
+
import type { ObservedHelmReleaseDetail, SelectedHelmRelease } from '../../types'
|
|
8
|
+
import { ObservedHelmReleaseDrawer } from './ObservedHelmReleaseDrawer'
|
|
9
|
+
|
|
10
|
+
const detail = vi.hoisted(() => ({ current: {} as { data?: unknown; error?: unknown } }))
|
|
11
|
+
|
|
12
|
+
vi.mock('../../api/client', async (importOriginal) => ({
|
|
13
|
+
...(await importOriginal<typeof import('../../api/client')>()),
|
|
14
|
+
useObservedHelmRelease: () => ({ ...detail.current, isLoading: false, refetch: vi.fn() }),
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
const release = { namespace: 'team-a', name: 'web', observed: true } as SelectedHelmRelease
|
|
18
|
+
const seen = { name: 'web', namespace: 'team-a', chart: 'web', resources: [] } as unknown as ObservedHelmReleaseDetail
|
|
19
|
+
|
|
20
|
+
let root: Root | undefined
|
|
21
|
+
|
|
22
|
+
function mount(element: ReactElement): HTMLElement {
|
|
23
|
+
const container = document.createElement('div')
|
|
24
|
+
document.body.appendChild(container)
|
|
25
|
+
root = createRoot(container)
|
|
26
|
+
act(() => root!.render(<MemoryRouter>{element}</MemoryRouter>))
|
|
27
|
+
return container
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
act(() => root?.unmount())
|
|
32
|
+
root = undefined
|
|
33
|
+
document.body.innerHTML = ''
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
describe('a refresh that fails while the drawer shows a release', () => {
|
|
37
|
+
it('stops showing a release that is gone', () => {
|
|
38
|
+
detail.current = { data: seen, error: new ApiError('not found', 404) }
|
|
39
|
+
const text = mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />).textContent
|
|
40
|
+
expect(text).toContain('No release found on the objects you can read')
|
|
41
|
+
expect(text).not.toContain('Object health')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('keeps what it has through a passing failure, and says it did', () => {
|
|
45
|
+
detail.current = { data: seen, error: new ApiError('unavailable', 503) }
|
|
46
|
+
const text = mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />).textContent
|
|
47
|
+
expect(text).toContain('Object health')
|
|
48
|
+
expect(text).toContain('couldn’t refresh this, so it shows the last read')
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
describe('tabs on an observed release', () => {
|
|
53
|
+
const tabLabels = (container: HTMLElement) => [...container.querySelectorAll('button')].map((b) => b.textContent?.trim()).filter(Boolean)
|
|
54
|
+
|
|
55
|
+
it('offers only what can hold data', () => {
|
|
56
|
+
detail.current = { data: seen }
|
|
57
|
+
const labels = tabLabels(mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />))
|
|
58
|
+
expect(labels).toEqual(expect.arrayContaining(['Overview', 'Resources']))
|
|
59
|
+
for (const gone of ['History', 'Manifest', 'Values', 'Hooks']) expect(labels).not.toContain(gone)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('adds History where Flux recorded one', () => {
|
|
63
|
+
detail.current = { data: { ...seen, fluxHistory: [{ revision: 1 }] } }
|
|
64
|
+
expect(tabLabels(mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />))).toContain('History')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('says what the read missed', () => {
|
|
68
|
+
detail.current = { data: { ...seen, objectCoverage: { gaps: [{ code: 'kind_sync_pending' }] } } }
|
|
69
|
+
expect(mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />).textContent).toContain('so this release may be missing more than usual')
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('versions on an observed release', () => {
|
|
74
|
+
it('shows versions that disagree rather than calling them unknown', () => {
|
|
75
|
+
detail.current = { data: { ...seen, chartVersions: ['1.0.0', '2.0.0'], appVersions: ['1.0', '2.0'] } }
|
|
76
|
+
const text = mount(<ObservedHelmReleaseDrawer release={release} onClose={vi.fn()} />).textContent
|
|
77
|
+
expect(text).toContain('Mixed: 1.0.0, 2.0.0')
|
|
78
|
+
expect(text).toContain('Mixed: 1.0, 2.0')
|
|
79
|
+
})
|
|
80
|
+
})
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { useEffect, useState, type ComponentType } from 'react'
|
|
2
|
+
import { useNavigate } from 'react-router-dom'
|
|
3
|
+
import { clsx } from 'clsx'
|
|
4
|
+
import { GitBranch, History, Link2, Package, RefreshCw, X } from 'lucide-react'
|
|
5
|
+
import { FactGrid, FactRow, FactValue, FetchResult, type Fact } from '@skyhook-io/k8s-ui'
|
|
6
|
+
import { isStableClientError, useObservedHelmRelease } from '../../api/client'
|
|
7
|
+
import { useRefreshAnimation } from '../../hooks/useRefreshAnimation'
|
|
8
|
+
import { getHelmStatusColor, SEVERITY_BADGE } from '../../utils/badge-colors'
|
|
9
|
+
import type { NavigateToResource } from '../../utils/navigation'
|
|
10
|
+
import type { FluxHelmRevision, ObservedHelmReleaseDetail, SelectedHelmRelease } from '../../types'
|
|
11
|
+
import { Tooltip } from '../ui/Tooltip'
|
|
12
|
+
import { formatDate } from './helm-utils'
|
|
13
|
+
import { ObservedHelmDrawerNote } from './ObservedHelmNotice'
|
|
14
|
+
import { OwnedResources } from './OwnedResources'
|
|
15
|
+
|
|
16
|
+
type TabId = 'overview' | 'history' | 'resources'
|
|
17
|
+
|
|
18
|
+
// Only what can hold data here: Helm's own tabs would all say the same thing,
|
|
19
|
+
// and the note above says it once. History is what Flux recorded, if anything.
|
|
20
|
+
const TABS: { id: TabId; label: string; icon: ComponentType<{ className?: string }> }[] = [
|
|
21
|
+
{ id: 'overview', label: 'Overview', icon: Package },
|
|
22
|
+
{ id: 'history', label: 'History', icon: History },
|
|
23
|
+
{ id: 'resources', label: 'Resources', icon: Link2 },
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
const UNREAD = 'Helm keeps this in its release Secret, which Radar can’t read here.'
|
|
27
|
+
const unknownFact = (source: string): Fact => ({ text: 'Unknown', tone: 'unknown', detail: source })
|
|
28
|
+
// found lists the values when objects disagree, as an interrupted upgrade
|
|
29
|
+
// leaves them; showing them is more use than "Unknown".
|
|
30
|
+
const stampedFact = (value: string | undefined, label: string, whenMissing: string, found?: string[]): Fact => {
|
|
31
|
+
if (value) return { text: value, tone: 'neutral', source: `From ${label}` }
|
|
32
|
+
if (found?.length) {
|
|
33
|
+
return { text: `Mixed: ${found.join(', ')}`, tone: 'neutral', source: `From ${label}`, detail: 'Its objects carry different values, as an interrupted upgrade can leave them.' }
|
|
34
|
+
}
|
|
35
|
+
return unknownFact(whenMissing)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ObservedHelmReleaseDrawerProps {
|
|
39
|
+
release: SelectedHelmRelease
|
|
40
|
+
onClose: () => void
|
|
41
|
+
onNavigateToResource?: NavigateToResource
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A release as its deployed objects describe it, for someone who can't read
|
|
46
|
+
* Helm's storage. It issues no read of Helm's release routes, and what only
|
|
47
|
+
* those routes know stays visibly unknown.
|
|
48
|
+
*/
|
|
49
|
+
export function ObservedHelmReleaseDrawer({ release, onClose, onNavigateToResource }: ObservedHelmReleaseDrawerProps) {
|
|
50
|
+
const navigate = useNavigate()
|
|
51
|
+
const [activeTab, setActiveTab] = useState<TabId>('overview')
|
|
52
|
+
const { data, isLoading, error, refetch: refetchRelease } = useObservedHelmRelease(release.namespace, release.name)
|
|
53
|
+
const [refetch, isRefreshAnimating] = useRefreshAnimation(refetchRelease)
|
|
54
|
+
useEffect(() => setActiveTab('overview'), [release.namespace, release.name])
|
|
55
|
+
|
|
56
|
+
const flux = data?.managedByFluxHelmRelease
|
|
57
|
+
const tabs = TABS.filter((tab) => tab.id !== 'history' || data?.fluxHistory?.length)
|
|
58
|
+
const shownTab = tabs.some((tab) => tab.id === activeTab) ? activeTab : 'overview'
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<div className="border-b border-theme-border shrink-0">
|
|
63
|
+
<div className="flex items-center justify-between px-4 pt-3 pb-2">
|
|
64
|
+
<div className="flex items-center gap-2 flex-wrap">
|
|
65
|
+
<span className={clsx('badge', SEVERITY_BADGE.info)}>Helm Release</span>
|
|
66
|
+
<Tooltip content={UNREAD}>
|
|
67
|
+
<span className={clsx('badge', SEVERITY_BADGE.neutral)}>Status unknown</span>
|
|
68
|
+
</Tooltip>
|
|
69
|
+
</div>
|
|
70
|
+
<div className="flex items-center gap-1">
|
|
71
|
+
<Tooltip content="Refresh">
|
|
72
|
+
<button
|
|
73
|
+
onClick={refetch}
|
|
74
|
+
disabled={isRefreshAnimating}
|
|
75
|
+
className="p-1.5 text-theme-text-secondary hover:text-theme-text-primary hover:bg-theme-elevated rounded disabled:opacity-50 disabled:pointer-events-none"
|
|
76
|
+
>
|
|
77
|
+
<RefreshCw className={clsx('w-4 h-4', isRefreshAnimating && 'animate-spin')} />
|
|
78
|
+
</button>
|
|
79
|
+
</Tooltip>
|
|
80
|
+
<Tooltip content="Close (Esc)">
|
|
81
|
+
<button onClick={onClose} className="p-1.5 text-theme-text-secondary hover:text-theme-text-primary hover:bg-theme-elevated rounded">
|
|
82
|
+
<X className="w-4 h-4" />
|
|
83
|
+
</button>
|
|
84
|
+
</Tooltip>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div className="px-4 pb-3">
|
|
89
|
+
<div className="flex items-center gap-2">
|
|
90
|
+
<Package className="w-5 h-5 text-purple-400" />
|
|
91
|
+
<h2 className="text-lg font-semibold text-theme-text-primary truncate">{release.name}</h2>
|
|
92
|
+
</div>
|
|
93
|
+
<p className="text-sm text-theme-text-tertiary">{release.namespace}</p>
|
|
94
|
+
{flux && (
|
|
95
|
+
<Tooltip content={`Installed by Flux helm-controller via HelmRelease ${flux}.`} wrapperClassName="mt-1">
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
onClick={() => {
|
|
99
|
+
const [ns, name] = flux.split('/')
|
|
100
|
+
navigate(`/gitops/detail/helmreleases/${encodeURIComponent(ns || '_')}/${encodeURIComponent(name)}`)
|
|
101
|
+
}}
|
|
102
|
+
className="inline-flex items-center gap-1 rounded border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[11px] text-amber-700 dark:text-amber-400 hover:bg-amber-500/20 transition-colors"
|
|
103
|
+
>
|
|
104
|
+
<GitBranch className="w-3 h-3" />
|
|
105
|
+
Managed by Flux · {flux}
|
|
106
|
+
</button>
|
|
107
|
+
</Tooltip>
|
|
108
|
+
)}
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div className="flex items-center gap-1 px-4 pb-2 overflow-x-auto">
|
|
112
|
+
{tabs.map((tab) => (
|
|
113
|
+
<button
|
|
114
|
+
key={tab.id}
|
|
115
|
+
onClick={() => setActiveTab(tab.id)}
|
|
116
|
+
className={clsx(
|
|
117
|
+
'flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors whitespace-nowrap',
|
|
118
|
+
shownTab === tab.id
|
|
119
|
+
? 'bg-theme-elevated text-theme-text-primary'
|
|
120
|
+
: 'text-theme-text-secondary hover:text-theme-text-primary hover:bg-theme-elevated/50'
|
|
121
|
+
)}
|
|
122
|
+
>
|
|
123
|
+
<tab.icon className="w-3.5 h-3.5" />
|
|
124
|
+
{tab.label}
|
|
125
|
+
</button>
|
|
126
|
+
))}
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div className="flex-1 overflow-y-auto">
|
|
131
|
+
<ObservedHelmDrawerNote coverage={data?.objectCoverage} refreshFailed={Boolean(data && error && !isStableClientError(error))} />
|
|
132
|
+
{!data || isStableClientError(error) ? (
|
|
133
|
+
<FetchResult loading={isLoading} error={error} notFoundMessage="No release found on the objects you can read" className="h-32" />
|
|
134
|
+
) : shownTab === 'overview' ? (
|
|
135
|
+
<OverviewTab release={data} />
|
|
136
|
+
) : shownTab === 'history' ? (
|
|
137
|
+
<FluxHistory release={data} />
|
|
138
|
+
) : (
|
|
139
|
+
<OwnedResources resources={data.resources ?? []} onNavigate={onNavigateToResource} summaryLabel="with this release’s Helm metadata" />
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
</>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function OverviewTab({ release }: { release: ObservedHelmReleaseDetail }) {
|
|
147
|
+
const health = release.resourceHealth
|
|
148
|
+
const lastRecord = release.fluxHistory?.[0]
|
|
149
|
+
const chartWhenMissing = release.otherCharts?.length
|
|
150
|
+
? `Its objects name several charts, and none matches the release name: ${release.otherCharts.join(', ')}.`
|
|
151
|
+
: 'Its objects have no helm.sh/chart label.'
|
|
152
|
+
// When Flux recorded the release, these three values are Flux's, not labels.
|
|
153
|
+
const fact = (value: string | undefined, label: string, whenMissing: string, found?: string[]): Fact =>
|
|
154
|
+
lastRecord?.chartName ? (value ? { text: value, tone: 'neutral', source: 'Recorded by Flux' } : unknownFact('Flux didn’t record this.')) : stampedFact(value, label, whenMissing, found)
|
|
155
|
+
return (
|
|
156
|
+
<div className="p-4 space-y-4">
|
|
157
|
+
<div className="bg-theme-elevated/30 rounded-lg p-4">
|
|
158
|
+
<FactGrid>
|
|
159
|
+
<FactRow label="Chart"><FactValue fact={fact(release.chart, 'helm.sh/chart', chartWhenMissing)} /></FactRow>
|
|
160
|
+
<FactRow label="Chart version"><FactValue fact={fact(release.chartVersion, 'helm.sh/chart', 'No version could be read from its objects.', release.chartVersions)} /></FactRow>
|
|
161
|
+
<FactRow label="App version"><FactValue fact={fact(release.appVersion, 'app.kubernetes.io/version', 'No app version could be read from its objects.', release.appVersions)} /></FactRow>
|
|
162
|
+
{release.otherCharts && release.otherCharts.length > 0 && (
|
|
163
|
+
<FactRow label={release.chart ? 'Other charts' : 'Charts found'}>
|
|
164
|
+
<span className="text-theme-text-secondary">{release.otherCharts.join(', ')}</span>
|
|
165
|
+
</FactRow>
|
|
166
|
+
)}
|
|
167
|
+
<FactRow label="Objects">
|
|
168
|
+
<FactValue fact={{ text: `${release.resourceCount} you can read`, tone: 'neutral', detail: 'The release may have more. Secrets and kinds Radar isn’t watching aren’t counted.' }} />
|
|
169
|
+
</FactRow>
|
|
170
|
+
<FactRow label="Object health">
|
|
171
|
+
<FactValue fact={health && health !== 'unknown'
|
|
172
|
+
? { text: release.healthSummary ? `${health}, ${release.healthSummary}` : health, tone: health === 'healthy' ? 'healthy' : health === 'degraded' ? 'degraded' : health === 'unhealthy' ? 'unhealthy' : 'unknown', detail: 'From the objects you can read, not from Helm.' }
|
|
173
|
+
: unknownFact('Radar can’t tell from the objects you can read.')} />
|
|
174
|
+
</FactRow>
|
|
175
|
+
<FactRow label="Status"><FactValue fact={unknownFact(UNREAD)} /></FactRow>
|
|
176
|
+
{lastRecord && (
|
|
177
|
+
<FactRow label="Flux’s last record">
|
|
178
|
+
<FactValue fact={{ text: `${lastRecord.status ?? 'No status'}, revision ${lastRecord.revision}`, tone: 'neutral', at: lastRecord.lastDeployed, detail: 'Recorded by Flux, which may not match Helm now.' }} />
|
|
179
|
+
</FactRow>
|
|
180
|
+
)}
|
|
181
|
+
<FactRow label="Revision"><FactValue fact={unknownFact(UNREAD)} /></FactRow>
|
|
182
|
+
<FactRow label="Last updated"><FactValue fact={unknownFact(UNREAD)} /></FactRow>
|
|
183
|
+
</FactGrid>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function FluxHistory({ release }: { release: ObservedHelmReleaseDetail }) {
|
|
190
|
+
const history = release.fluxHistory ?? []
|
|
191
|
+
return (
|
|
192
|
+
<div className="p-4 space-y-2">
|
|
193
|
+
<p className="text-sm text-theme-text-secondary">
|
|
194
|
+
As recorded by Flux in HelmRelease {release.managedByFluxHelmRelease}, not read from Helm.
|
|
195
|
+
</p>
|
|
196
|
+
<table className="w-full text-sm">
|
|
197
|
+
<thead>
|
|
198
|
+
<tr className="text-left text-theme-text-tertiary">
|
|
199
|
+
<th className="py-1.5 pr-3 font-normal">Revision</th>
|
|
200
|
+
<th className="py-1.5 pr-3 font-normal">Status</th>
|
|
201
|
+
<th className="py-1.5 pr-3 font-normal">Chart</th>
|
|
202
|
+
<th className="py-1.5 pr-3 font-normal">App version</th>
|
|
203
|
+
<th className="py-1.5 pr-3 font-normal">Last deployed</th>
|
|
204
|
+
<th className="py-1.5 font-normal">Release digest</th>
|
|
205
|
+
</tr>
|
|
206
|
+
</thead>
|
|
207
|
+
<tbody className="table-divide-subtle">
|
|
208
|
+
{history.map((entry) => <FluxHistoryRow key={entry.revision} entry={entry} />)}
|
|
209
|
+
</tbody>
|
|
210
|
+
</table>
|
|
211
|
+
</div>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function FluxHistoryRow({ entry }: { entry: FluxHelmRevision }) {
|
|
216
|
+
return (
|
|
217
|
+
<tr className="text-theme-text-secondary">
|
|
218
|
+
<td className="py-1.5 pr-3">{entry.revision}</td>
|
|
219
|
+
<td className="py-1.5 pr-3">{entry.status ? <span className={clsx('badge', getHelmStatusColor(entry.status))}>{entry.status}</span> : '—'}</td>
|
|
220
|
+
<td className="py-1.5 pr-3">{[entry.chartName, entry.chartVersion].filter(Boolean).join('-') || '—'}</td>
|
|
221
|
+
<td className="py-1.5 pr-3">{entry.appVersion || '—'}</td>
|
|
222
|
+
<td className="py-1.5 pr-3">{entry.lastDeployed ? formatDate(entry.lastDeployed) : '—'}</td>
|
|
223
|
+
<td className="py-1.5 font-mono text-xs">
|
|
224
|
+
{entry.digest ? <Tooltip content={entry.digest}><span>{entry.digest.replace('sha256:', '').slice(0, 12)}</span></Tooltip> : '—'}
|
|
225
|
+
</td>
|
|
226
|
+
</tr>
|
|
227
|
+
)
|
|
228
|
+
}
|
|
@@ -18,6 +18,8 @@ import { Tooltip } from '../ui/Tooltip'
|
|
|
18
18
|
interface OwnedResourcesProps {
|
|
19
19
|
resources: HelmOwnedResource[]
|
|
20
20
|
onNavigate?: NavigateToResource
|
|
21
|
+
/** Follows the count, saying what the list claims about these resources. */
|
|
22
|
+
summaryLabel?: string
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function getIconForKind(kind: string) {
|
|
@@ -69,7 +71,7 @@ function computeHealthSummary(resources: HelmOwnedResource[]) {
|
|
|
69
71
|
return { healthy, warning, error, unknown, total: resources.length }
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
export function OwnedResources({ resources, onNavigate }: OwnedResourcesProps) {
|
|
74
|
+
export function OwnedResources({ resources, onNavigate, summaryLabel = 'created by this release' }: OwnedResourcesProps) {
|
|
73
75
|
const [healthFilter, setHealthFilter] = useState<HealthFilter>('all')
|
|
74
76
|
|
|
75
77
|
if (!resources || resources.length === 0) {
|
|
@@ -100,7 +102,7 @@ export function OwnedResources({ resources, onNavigate }: OwnedResourcesProps) {
|
|
|
100
102
|
<div className="flex items-center justify-between">
|
|
101
103
|
<div className="text-sm text-theme-text-secondary">
|
|
102
104
|
{healthFilter === 'all' ? (
|
|
103
|
-
<>{pluralize(resources.length, 'resource')}
|
|
105
|
+
<>{pluralize(resources.length, 'resource')} {summaryLabel}</>
|
|
104
106
|
) : (
|
|
105
107
|
<span className="flex items-center gap-2">
|
|
106
108
|
Showing {filteredResources.length} of {resources.length} resources
|