@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
|
@@ -10,6 +10,7 @@ interface ValuesDiffPreviewProps {
|
|
|
10
10
|
onClose: () => void
|
|
11
11
|
onApply: () => void
|
|
12
12
|
isApplying: boolean
|
|
13
|
+
notice?: string
|
|
13
14
|
title?: string
|
|
14
15
|
applyLabel?: string
|
|
15
16
|
}
|
|
@@ -19,6 +20,7 @@ export function ValuesDiffPreview({
|
|
|
19
20
|
onClose,
|
|
20
21
|
onApply,
|
|
21
22
|
isApplying,
|
|
23
|
+
notice,
|
|
22
24
|
title = 'Preview Changes',
|
|
23
25
|
applyLabel = 'Apply Changes',
|
|
24
26
|
}: ValuesDiffPreviewProps) {
|
|
@@ -81,7 +83,8 @@ export function ValuesDiffPreview({
|
|
|
81
83
|
</div>
|
|
82
84
|
|
|
83
85
|
{/* Content */}
|
|
84
|
-
<
|
|
86
|
+
{notice && <p className="px-4 py-2 text-sm break-words text-theme-text-secondary">{notice}</p>}
|
|
87
|
+
<div className="flex-1 overflow-auto p-4">
|
|
85
88
|
{hasChanges ? (
|
|
86
89
|
<div className="space-y-4">
|
|
87
90
|
<p className="text-sm text-theme-text-secondary">
|
|
@@ -12,7 +12,7 @@ import { useCapabilitiesContext } from '../../contexts/CapabilitiesContext'
|
|
|
12
12
|
import { MCPSetupDialog } from './MCPSetupDialog'
|
|
13
13
|
import { assetUrl, pluralize, parseContextName } from '@skyhook-io/k8s-ui'
|
|
14
14
|
import { Tooltip } from '../ui/Tooltip'
|
|
15
|
-
import {
|
|
15
|
+
import { mcpEndpointUrl } from '../../api/config'
|
|
16
16
|
import { parseMajorMinor } from '../../utils/version'
|
|
17
17
|
import gkeIcon from '../../assets/platform-icons/google_kubernetes_engine.png'
|
|
18
18
|
import eksIcon from '../../assets/platform-icons/aws_eks.png'
|
|
@@ -152,7 +152,7 @@ export function ClusterHealthCard({
|
|
|
152
152
|
const mcpEnabled = caps.mcpEnabled
|
|
153
153
|
const isCloud = deployment.mode === 'cloud'
|
|
154
154
|
const isInCluster = deployment.mode === 'in-cluster' || deployment.mode === 'cloud'
|
|
155
|
-
const mcpUrl =
|
|
155
|
+
const mcpUrl = mcpEndpointUrl(caps.mcpReadOnly)
|
|
156
156
|
// In Cloud, MCP is org-wide and PAT-authed (api.radarhq.io/mcp). The OSS
|
|
157
157
|
// "this binary is your local MCP server" framing is wrong there — Cloud
|
|
158
158
|
// surfaces MCP from the hub Home dashboard instead.
|
|
@@ -316,7 +316,7 @@ export function ClusterHealthCard({
|
|
|
316
316
|
>
|
|
317
317
|
<Radio className="w-3.5 h-3.5 text-purple-400 animate-pulse shrink-0" />
|
|
318
318
|
<div className="flex flex-col gap-0.5 min-w-0 flex-1 text-left">
|
|
319
|
-
<span className="text-xs font-medium text-purple-400">MCP Server Live</span>
|
|
319
|
+
<span className="text-xs font-medium text-purple-400">{caps.mcpReadOnly ? 'MCP Server Live (read-only)' : 'MCP Server Live'}</span>
|
|
320
320
|
<Tooltip content={mcpUrl} wrapperClassName="min-w-0">
|
|
321
321
|
<span className="text-[10px] text-theme-text-tertiary truncate font-mono">
|
|
322
322
|
HTTP · {mcpUrl}
|
|
@@ -326,7 +326,7 @@ export function ClusterHealthCard({
|
|
|
326
326
|
<Info className="w-3.5 h-3.5 text-purple-400/60 shrink-0" />
|
|
327
327
|
</button>
|
|
328
328
|
)}
|
|
329
|
-
<MCPSetupDialog open={mcpDialogOpen} onClose={() => setMcpDialogOpen(false)} mcpUrl={mcpUrl} />
|
|
329
|
+
<MCPSetupDialog open={mcpDialogOpen} onClose={() => setMcpDialogOpen(false)} mcpUrl={mcpUrl} readOnly={caps.mcpReadOnly} />
|
|
330
330
|
</div>
|
|
331
331
|
|
|
332
332
|
{/* Center: Three health rings */}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
6
|
+
import { useOpenCostSummary } from '../../api/client'
|
|
7
|
+
import { CostCard } from './CostCard'
|
|
8
|
+
|
|
9
|
+
let root: ReturnType<typeof createRoot>
|
|
10
|
+
let client: QueryClient
|
|
11
|
+
let requested: URL[]
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
15
|
+
requested = []
|
|
16
|
+
vi.stubGlobal('fetch', vi.fn((input: RequestInfo | URL) => {
|
|
17
|
+
requested.push(new URL(String(input), 'http://radar.invalid'))
|
|
18
|
+
return new Promise<Response>(() => {})
|
|
19
|
+
}))
|
|
20
|
+
root = createRoot(document.createElement('div'))
|
|
21
|
+
client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
afterEach(async () => {
|
|
25
|
+
await act(async () => root.unmount())
|
|
26
|
+
client.clear()
|
|
27
|
+
vi.unstubAllGlobals()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
describe('CostCard namespace scope', () => {
|
|
31
|
+
it('requests the picked namespaces', async () => {
|
|
32
|
+
await act(async () => {
|
|
33
|
+
root.render(
|
|
34
|
+
<QueryClientProvider client={client}>
|
|
35
|
+
<CostCard namespaces={['team-a', 'team-b']} />
|
|
36
|
+
</QueryClientProvider>,
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const summary = requested.find((url) => url.pathname === '/api/opencost/summary')
|
|
41
|
+
expect(summary?.searchParams.get('namespaces')).toBe('team-a,team-b')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('fetches a separate query when the pick changes', async () => {
|
|
45
|
+
await act(async () => {
|
|
46
|
+
root.render(
|
|
47
|
+
<QueryClientProvider client={client}>
|
|
48
|
+
<CostCard namespaces={['team-a']} />
|
|
49
|
+
</QueryClientProvider>,
|
|
50
|
+
)
|
|
51
|
+
})
|
|
52
|
+
await act(async () => {
|
|
53
|
+
root.render(
|
|
54
|
+
<QueryClientProvider client={client}>
|
|
55
|
+
<CostCard namespaces={['team-b']} />
|
|
56
|
+
</QueryClientProvider>,
|
|
57
|
+
)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
expect(requested.filter((url) => url.pathname === '/api/opencost/summary')
|
|
61
|
+
.map((url) => url.searchParams.get('namespaces'))).toEqual(['team-a', 'team-b'])
|
|
62
|
+
expect(client.getQueryCache().findAll({ queryKey: ['opencost-summary'] })).toHaveLength(2)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it.each([
|
|
66
|
+
{ label: 'omitted', namespaces: undefined },
|
|
67
|
+
{ label: 'empty', namespaces: [] },
|
|
68
|
+
])('keeps the unfiltered request for no namespaces ($label)', async ({ namespaces }) => {
|
|
69
|
+
await act(async () => {
|
|
70
|
+
root.render(
|
|
71
|
+
<QueryClientProvider client={client}>
|
|
72
|
+
<CostCard namespaces={namespaces} />
|
|
73
|
+
</QueryClientProvider>,
|
|
74
|
+
)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const summary = requested.find((url) => url.pathname === '/api/opencost/summary')
|
|
78
|
+
expect(summary?.pathname).toBe('/api/opencost/summary')
|
|
79
|
+
expect(summary?.search).toBe('')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('keeps an unscoped consumer separate from the Home card', async () => {
|
|
83
|
+
function UnscopedCost() {
|
|
84
|
+
useOpenCostSummary()
|
|
85
|
+
return null
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
await act(async () => {
|
|
89
|
+
root.render(
|
|
90
|
+
<QueryClientProvider client={client}>
|
|
91
|
+
<CostCard namespaces={['team-a']} />
|
|
92
|
+
<UnscopedCost />
|
|
93
|
+
</QueryClientProvider>,
|
|
94
|
+
)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
expect(requested.filter((url) => url.pathname === '/api/opencost/summary')
|
|
98
|
+
.map((url) => url.searchParams.get('namespaces'))).toEqual(['team-a', null])
|
|
99
|
+
})
|
|
100
|
+
})
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
} from '../cost/format'
|
|
11
11
|
import { costFreshnessLabel } from '../cost/source'
|
|
12
12
|
|
|
13
|
-
export function CostCard({ onNavigate }: { onNavigate?: () => void }) {
|
|
14
|
-
const { data } = useOpenCostSummary()
|
|
13
|
+
export function CostCard({ namespaces, onNavigate }: { namespaces?: string[]; onNavigate?: () => void }) {
|
|
14
|
+
const { data } = useOpenCostSummary(true, namespaces)
|
|
15
15
|
|
|
16
16
|
// Only show when OpenCost data is actually available — no placeholder card
|
|
17
17
|
if (!data || !data.available) {
|
|
@@ -88,8 +88,8 @@ export function HelmSummary({ data, onNavigate }: HelmSummaryProps) {
|
|
|
88
88
|
<span className="text-xs font-medium text-theme-text-secondary">
|
|
89
89
|
{data.errorCode === 'unconfigured' ? 'Helm not configured' : 'Helm unavailable'}
|
|
90
90
|
</span>
|
|
91
|
-
<Tooltip content={data.error} wrapperClassName="!block mt-1 min-w-0 text-center">
|
|
92
|
-
<span className="text-[11px] text-center px-2
|
|
91
|
+
<Tooltip content={data.error} wrapperClassName="!block mt-1 min-w-0 w-full text-center">
|
|
92
|
+
<span className="text-[11px] text-center px-2 line-clamp-2 [overflow-wrap:anywhere] max-w-full">
|
|
93
93
|
{data.errorCode === 'unconfigured'
|
|
94
94
|
? 'Set rbac.helm=true in the Radar Helm chart values.'
|
|
95
95
|
: data.error}
|
|
@@ -31,6 +31,7 @@ import { formatCompactAge } from '@skyhook-io/k8s-ui/utils/format'
|
|
|
31
31
|
import { ClusterHealthCard } from './ClusterHealthCard'
|
|
32
32
|
import { AlertTriangle, CheckCircle, Loader2, Shield } from 'lucide-react'
|
|
33
33
|
import { uncheckedSourceLines } from '../issues/uncheckedSources'
|
|
34
|
+
import { UncheckedSourceHelp } from '../issues/UncheckedSourceHelp'
|
|
34
35
|
import { clsx } from 'clsx'
|
|
35
36
|
import { getVersionUpdateStatus } from '../../utils/version'
|
|
36
37
|
import { RadarVersionLine } from './RadarVersionLine'
|
|
@@ -68,7 +69,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
68
69
|
karpenterState === 'available' || karpenterState === 'denied' || karpenterState === 'not_detected'
|
|
69
70
|
const { data, isLoading, error, dataUpdatedAt, refetch } = useDashboard(namespaces)
|
|
70
71
|
const { connection } = useConnection()
|
|
71
|
-
const { data: issuesData, isLoading: issuesLoading, isFetching: issuesFetching, error: issuesError } = useIssues(namespaces)
|
|
72
|
+
const { data: issuesData, isLoading: issuesLoading, isFetching: issuesFetching, error: issuesError, refetch: refetchIssues } = useIssues(namespaces)
|
|
72
73
|
const issues = issuesData?.issues ?? []
|
|
73
74
|
const issueCount = issuesData?.total_matched ?? issuesData?.total ?? issues.length
|
|
74
75
|
const hasCriticalIssues = issues.some((issue) => issue.severity === 'critical')
|
|
@@ -212,7 +213,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
212
213
|
/>
|
|
213
214
|
</BandItem>
|
|
214
215
|
<BandItem>
|
|
215
|
-
<CostCard onNavigate={() => onNavigateToView('cost')} />
|
|
216
|
+
<CostCard namespaces={namespaces} onNavigate={() => onNavigateToView('cost')} />
|
|
216
217
|
</BandItem>
|
|
217
218
|
</div>
|
|
218
219
|
|
|
@@ -273,6 +274,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
273
274
|
issueCount={issueCount}
|
|
274
275
|
visibility={issuesData?.visibility}
|
|
275
276
|
uncheckedLines={uncheckedSourceLines(issuesData?.unchecked_sources)}
|
|
277
|
+
onRetryIssues={() => { void refetchIssues({ cancelRefetch: false }) }}
|
|
276
278
|
hasData={!!issuesData}
|
|
277
279
|
isLoading={issuesLoading && !issuesData}
|
|
278
280
|
isRefreshing={issuesFetching && !!issuesData}
|
|
@@ -305,6 +307,7 @@ interface ProblemsPanelProps {
|
|
|
305
307
|
/** One line per issue source Radar couldn't check. Any line means an
|
|
306
308
|
* empty list isn't an all-clear. */
|
|
307
309
|
uncheckedLines?: string[]
|
|
310
|
+
onRetryIssues: () => void
|
|
308
311
|
hasData: boolean
|
|
309
312
|
isLoading: boolean
|
|
310
313
|
isRefreshing: boolean
|
|
@@ -319,6 +322,7 @@ export function ProblemsPanel({
|
|
|
319
322
|
issueCount,
|
|
320
323
|
visibility,
|
|
321
324
|
uncheckedLines = [],
|
|
325
|
+
onRetryIssues,
|
|
322
326
|
hasData,
|
|
323
327
|
isLoading,
|
|
324
328
|
isRefreshing,
|
|
@@ -393,9 +397,12 @@ export function ProblemsPanel({
|
|
|
393
397
|
Limited visibility - {visibility.impact} Results may be incomplete.
|
|
394
398
|
</ProblemsPanelNotice>
|
|
395
399
|
)}
|
|
396
|
-
{(issues.length > 0 || hasLimitedVisibility) &&
|
|
397
|
-
<ProblemsPanelNotice
|
|
398
|
-
|
|
400
|
+
{(issues.length > 0 || hasLimitedVisibility) && unchecked && (
|
|
401
|
+
<ProblemsPanelNotice tone="warning">
|
|
402
|
+
{uncheckedLines.map((line) => <p key={line}>{line}</p>)}
|
|
403
|
+
<UncheckedSourceHelp onRetry={onRetryIssues} isRefreshing={isRefreshing} />
|
|
404
|
+
</ProblemsPanelNotice>
|
|
405
|
+
)}
|
|
399
406
|
{isTruncated && (
|
|
400
407
|
<ProblemsPanelNotice tone="neutral">
|
|
401
408
|
Showing {totalReturned} of {issueCount} issues. Narrow by namespace to see the rest.
|
|
@@ -417,6 +424,7 @@ export function ProblemsPanel({
|
|
|
417
424
|
? uncheckedLines.join(' ')
|
|
418
425
|
: 'No critical or warning issues across the selected scope.'
|
|
419
426
|
}
|
|
427
|
+
action={unchecked && !hasLimitedVisibility ? <UncheckedSourceHelp onRetry={onRetryIssues} isRefreshing={isRefreshing} /> : undefined}
|
|
420
428
|
/>
|
|
421
429
|
) : (
|
|
422
430
|
<div className="divide-y divide-theme-border">
|
|
@@ -483,7 +491,7 @@ export function ProblemsPanel({
|
|
|
483
491
|
)
|
|
484
492
|
}
|
|
485
493
|
|
|
486
|
-
function ProblemsPanelState({ icon, title, body }: { icon: ReactNode; title: string; body: string }) {
|
|
494
|
+
function ProblemsPanelState({ icon, title, body, action }: { icon: ReactNode; title: string; body: string; action?: ReactNode }) {
|
|
487
495
|
return (
|
|
488
496
|
<div className="flex min-h-[220px] flex-col items-center justify-center gap-2 px-6 py-10 text-center">
|
|
489
497
|
<div className="flex h-9 w-9 items-center justify-center rounded-full bg-theme-elevated">
|
|
@@ -491,6 +499,7 @@ function ProblemsPanelState({ icon, title, body }: { icon: ReactNode; title: str
|
|
|
491
499
|
</div>
|
|
492
500
|
<p className="text-sm font-medium text-theme-text-primary">{title}</p>
|
|
493
501
|
<p className="max-w-[280px] text-xs leading-5 text-theme-text-secondary">{body}</p>
|
|
502
|
+
{action && <div className="w-full max-w-[280px]">{action}</div>}
|
|
494
503
|
</div>
|
|
495
504
|
)
|
|
496
505
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import { MCPSetupDialog } from './MCPSetupDialog'
|
|
5
|
+
import { mcpEndpointUrl, setBasename } from '../../api/config'
|
|
6
|
+
|
|
7
|
+
describe('MCP setup in read-only mode', () => {
|
|
8
|
+
it('generates client configurations for the retained endpoint and hides writes', () => {
|
|
9
|
+
setBasename('/radar')
|
|
10
|
+
try {
|
|
11
|
+
const url = mcpEndpointUrl(true)
|
|
12
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open readOnly mcpUrl={url} onClose={() => {}} />)
|
|
13
|
+
expect(html).toContain(`claude mcp add --transport http radar ${url}`)
|
|
14
|
+
expect(html).toContain(`codex mcp add radar --url ${url}`)
|
|
15
|
+
expect(html).toContain('/radar/mcp-readonly')
|
|
16
|
+
expect(html).toContain('list_namespaces')
|
|
17
|
+
expect(html).not.toContain('apply_resource')
|
|
18
|
+
expect(html).not.toContain('in_cluster')
|
|
19
|
+
expect(html).toContain('Read-only mode blocks write tools')
|
|
20
|
+
} finally {
|
|
21
|
+
setBasename('')
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('keeps the full catalog in default mode', () => {
|
|
26
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
27
|
+
expect(html).toContain('apply_resource')
|
|
28
|
+
expect(html).toContain('in_cluster')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -8,6 +8,7 @@ import { Disclosure } from '@skyhook-io/k8s-ui/components/ui/Disclosure'
|
|
|
8
8
|
interface MCPSetupDialogProps {
|
|
9
9
|
open: boolean
|
|
10
10
|
onClose: () => void
|
|
11
|
+
readOnly?: boolean
|
|
11
12
|
mcpUrl: string
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -43,7 +44,7 @@ function CodeBlock({ children }: { children: string }) {
|
|
|
43
44
|
)
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
47
|
+
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false }: MCPSetupDialogProps) {
|
|
47
48
|
const dialogRef = useRef<HTMLDivElement>(null)
|
|
48
49
|
const [isDesktop, setIsDesktop] = useState(false)
|
|
49
50
|
const [portPinned, setPortPinned] = useState(false)
|
|
@@ -116,6 +117,12 @@ export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
|
116
117
|
|
|
117
118
|
const currentPort = Number(window.location.port) || 80
|
|
118
119
|
|
|
120
|
+
const tools = MCP_TOOL_CATALOG
|
|
121
|
+
.filter((tool) => !readOnly || !tool.write)
|
|
122
|
+
.map((tool) => readOnly && tool.name === 'diagnose'
|
|
123
|
+
? { ...tool, params: tool.params.filter((param) => param.arg !== 'in_cluster') }
|
|
124
|
+
: tool)
|
|
125
|
+
|
|
119
126
|
const mcpServersUrlConfig = (key: 'url' | 'serverUrl') => JSON.stringify({
|
|
120
127
|
mcpServers: {
|
|
121
128
|
radar: {
|
|
@@ -210,17 +217,17 @@ export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
|
210
217
|
<a href="https://modelcontextprotocol.io" target="_blank" rel="noopener noreferrer" className="text-purple-400 hover:text-purple-300 underline underline-offset-2">
|
|
211
218
|
Model Context Protocol
|
|
212
219
|
</a>{' '}
|
|
213
|
-
(MCP) server that lets AI agents inspect, investigate, and operate your cluster through Radar.
|
|
220
|
+
(MCP) server that lets AI agents {readOnly ? 'inspect and investigate' : 'inspect, investigate, and operate'} your cluster through Radar.
|
|
214
221
|
Unlike raw kubectl access, Radar gives your AI pre-processed, enriched data —
|
|
215
222
|
topology graphs, health assessments, deduplicated events, filtered logs — so it
|
|
216
223
|
can understand your cluster state quickly without burning through context on
|
|
217
224
|
verbose YAML output.
|
|
218
225
|
</p>
|
|
219
226
|
<p className="text-sm text-theme-text-secondary leading-relaxed">
|
|
220
|
-
Most read tools do not change cluster state. An in-cluster route probe can create up
|
|
227
|
+
{readOnly ? 'Read-only mode blocks write tools and diagnostic options that create temporary Kubernetes resources. It does not restrict the Radar UI or REST API.' : <>Most read tools do not change cluster state. An in-cluster route probe can create up
|
|
221
228
|
to five self-deleting probe pods when explicitly requested. Write tools (restart,
|
|
222
229
|
scale, sync, apply, node drain) are annotated as destructive so your AI client
|
|
223
|
-
can flag them and prompt before running
|
|
230
|
+
can flag them and prompt before running.</>}
|
|
224
231
|
</p>
|
|
225
232
|
</div>
|
|
226
233
|
|
|
@@ -319,10 +326,10 @@ export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
|
319
326
|
<div className="space-y-2">
|
|
320
327
|
<div className="flex items-baseline justify-between">
|
|
321
328
|
<h4 className="text-sm font-semibold text-theme-text-primary">Tools</h4>
|
|
322
|
-
<span className="text-[11px] text-theme-text-tertiary">{
|
|
329
|
+
<span className="text-[11px] text-theme-text-tertiary">{tools.length} tools</span>
|
|
323
330
|
</div>
|
|
324
331
|
<div className="grid grid-cols-1 gap-1.5">
|
|
325
|
-
{
|
|
332
|
+
{tools.map((tool) => (
|
|
326
333
|
<div key={tool.name} className="card-inner space-y-1.5">
|
|
327
334
|
<div className="flex items-center gap-2">
|
|
328
335
|
<code className="inline-code text-[11px]">{tool.name}</code>
|
|
@@ -20,6 +20,7 @@ function render(props: { issues?: Issue[]; unchecked?: IssuesResponse['unchecked
|
|
|
20
20
|
issues={issues}
|
|
21
21
|
issueCount={issues.length}
|
|
22
22
|
uncheckedLines={uncheckedSourceLines(props.unchecked)}
|
|
23
|
+
onRetryIssues={() => {}}
|
|
23
24
|
visibility={props.visibility}
|
|
24
25
|
hasData
|
|
25
26
|
isLoading={false}
|
|
@@ -160,6 +160,16 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
160
160
|
{ arg: 'refresh', desc: 'bypass the cached scan after changing something' },
|
|
161
161
|
],
|
|
162
162
|
},
|
|
163
|
+
{
|
|
164
|
+
name: 'get_runtime_versions',
|
|
165
|
+
desc: 'Which running workloads use which runtime version (PHP, Node, Python, Go, Java, …), read from the version each running image declares in its config, for runtime CVEs. Declared, not proof; misses runtimes installed from distro packages.',
|
|
166
|
+
params: [
|
|
167
|
+
{ arg: 'namespace', desc: 'limit to one namespace' },
|
|
168
|
+
{ arg: 'runtime', desc: 'keep images declaring this runtime, e.g. php' },
|
|
169
|
+
{ arg: 'fixed_in', desc: 'first fixed release per branch, e.g. 8.2.35,8.3.36' },
|
|
170
|
+
{ arg: 'limit', desc: 'max images (default 50, max 200)' },
|
|
171
|
+
],
|
|
172
|
+
},
|
|
163
173
|
{
|
|
164
174
|
name: 'list_helm_releases',
|
|
165
175
|
desc: 'All Helm releases with status, resource health, storage namespace, Flux ownership, current lastOperation, and capped operation trails for failed upgrades, rollbacks, or stuck pending operations.',
|
|
@@ -373,13 +383,29 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
373
383
|
{
|
|
374
384
|
name: 'manage_node',
|
|
375
385
|
write: true,
|
|
376
|
-
desc: '
|
|
386
|
+
desc: 'Cordon, uncordon, or drain a node. Drain waits for required pod deletions by default and reports complete, incomplete, unconfirmed or started. Expected exclusions do not prevent completion. Completion does not certify shutdown safety.',
|
|
377
387
|
params: [
|
|
378
388
|
{ arg: 'action', required: true, desc: 'cordon, uncordon, or drain' },
|
|
379
389
|
{ arg: 'name', required: true, desc: 'node name' },
|
|
380
390
|
{ arg: 'delete_empty_dir_data', desc: 'evict pods with emptyDir volumes (default true)' },
|
|
381
391
|
{ arg: 'force', desc: 'evict pods not managed by a controller (default false)' },
|
|
382
|
-
{ arg: '
|
|
392
|
+
{ arg: 'wait_for_deletion', desc: 'wait for pod deletion (default true); false returns after eviction acceptance' },
|
|
393
|
+
{ arg: 'timeout', desc: 'shared eviction and deletion deadline in seconds (default 120 when waiting, 60 otherwise)' },
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: 'wait_for',
|
|
398
|
+
desc: 'Wait after a fix for a rollout, readiness, completion, deletion, or a status condition. Each call waits at most 45s and returns met, waiting, blocked, or failed; call again within your own time limit.',
|
|
399
|
+
params: [
|
|
400
|
+
{ arg: 'kind', required: true, desc: 'resource kind, including CRDs' },
|
|
401
|
+
{ arg: 'name', desc: 'object name; or set label_selector or all' },
|
|
402
|
+
{ arg: 'uid', desc: 'with name: pin to the uid returned by a previous call' },
|
|
403
|
+
{ arg: 'label_selector', desc: "every current match; to wait for replacements, wait on their controller's rollout" },
|
|
404
|
+
{ arg: 'all', desc: 'every object of the kind in the namespace' },
|
|
405
|
+
{ arg: 'namespace', desc: 'namespace for namespaced kinds' },
|
|
406
|
+
{ arg: 'group', desc: 'API group when the kind is ambiguous' },
|
|
407
|
+
{ arg: 'condition', desc: 'rollout, complete, ready, deleted, Type[=Status], or jsonpath={.status.path}=value; defaults by kind' },
|
|
408
|
+
{ arg: 'timeout_seconds', desc: '1-45 seconds (default 45); larger values wait 45' },
|
|
383
409
|
],
|
|
384
410
|
},
|
|
385
411
|
]
|
|
@@ -95,6 +95,27 @@ describe('Issues page when Radar could not read Helm releases', () => {
|
|
|
95
95
|
expect(html).toContain('The selected Pod keeps crashing')
|
|
96
96
|
})
|
|
97
97
|
|
|
98
|
+
it.each([true, false])('keeps the last unchecked result and retry after a failed refresh (rows: %s)', (hasRows) => {
|
|
99
|
+
state.fleet.data = { issues: hasRows ? [issue] : [], unchecked_sources: [{ source: 'helm', reason: 'read_failed' }] }
|
|
100
|
+
state.fleet.error = new Error('Refresh unavailable')
|
|
101
|
+
const html = text(render('/issues'))
|
|
102
|
+
expect(html).toContain('Issue refresh failed. Showing the last successful result.')
|
|
103
|
+
expect(html).toContain(line)
|
|
104
|
+
expect(html).toContain('Check again')
|
|
105
|
+
expect(html).not.toContain('Failed to load issues')
|
|
106
|
+
expect(html).not.toContain('Nothing broken right now')
|
|
107
|
+
if (hasRows) expect(html).toContain('The selected Pod keeps crashing')
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('does not show an all-clear from a cached empty result after refresh fails', () => {
|
|
111
|
+
state.fleet.data = { issues: [], total: 0 }
|
|
112
|
+
state.fleet.error = new Error('Refresh unavailable')
|
|
113
|
+
const html = text(render('/issues'))
|
|
114
|
+
expect(html).toContain('No issues in the last successful result')
|
|
115
|
+
expect(html).not.toContain('Nothing broken right now')
|
|
116
|
+
expect(html).not.toContain('Failed to load issues')
|
|
117
|
+
})
|
|
118
|
+
|
|
98
119
|
it('shows no all-clear for a source this version does not know, with a generic line', () => {
|
|
99
120
|
state.fleet.data = { issues: [], total: 0, total_matched: 0, unchecked_sources: [{ source: 'some-new-source', reason: 'read_failed' }] }
|
|
100
121
|
const html = text(render('/issues'))
|
|
@@ -26,6 +26,7 @@ import { builtinGroupForKind } from "@skyhook-io/k8s-ui/utils/api-resources";
|
|
|
26
26
|
import { AlertTriangle } from "lucide-react";
|
|
27
27
|
import { IssueDiagnoseButton } from "../diagnose/LocalDiagnoseAction";
|
|
28
28
|
import { uncheckedSourceLines } from "./uncheckedSources";
|
|
29
|
+
import { UncheckedSourceHelp } from "./UncheckedSourceHelp";
|
|
29
30
|
|
|
30
31
|
// A capacity-relevant issue links to its Karpenter diagnosis. Karpenter is
|
|
31
32
|
// always single-cluster (unlike Argo hub-and-spoke), so the issue and the
|
|
@@ -181,7 +182,7 @@ export function IssuesPane({
|
|
|
181
182
|
}: IssuesPaneProps) {
|
|
182
183
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
183
184
|
const subject = useMemo(() => issueSubjectFromParams(searchParams), [searchParams]);
|
|
184
|
-
const { data, isLoading, error, dataUpdatedAt, refetch } =
|
|
185
|
+
const { data, isLoading, isFetching, error, dataUpdatedAt, refetch } =
|
|
185
186
|
useIssues(namespaces, !subject);
|
|
186
187
|
const { connection } = useConnection();
|
|
187
188
|
const navigate = useNavigate();
|
|
@@ -246,7 +247,7 @@ export function IssuesPane({
|
|
|
246
247
|
return <PaneLoader label="Loading issues…" className="flex-1" />;
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
if (!subject && error) {
|
|
250
|
+
if (!subject && error && !data) {
|
|
250
251
|
return (
|
|
251
252
|
<div className="flex-1 flex items-center justify-center text-theme-text-secondary">
|
|
252
253
|
<p>Failed to load issues</p>
|
|
@@ -295,6 +296,13 @@ export function IssuesPane({
|
|
|
295
296
|
}
|
|
296
297
|
/>
|
|
297
298
|
|
|
299
|
+
{!subject && error && (
|
|
300
|
+
<div className="flex items-start gap-2 rounded-lg border border-theme-border bg-theme-elevated px-3 py-2 text-xs text-theme-text-secondary">
|
|
301
|
+
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-500" aria-hidden />
|
|
302
|
+
<span>Issue refresh failed. Showing the last successful result.</span>
|
|
303
|
+
</div>
|
|
304
|
+
)}
|
|
305
|
+
|
|
298
306
|
{/* Visibility honesty: when RBAC reads are incomplete, an empty queue may
|
|
299
307
|
mean "can't see" rather than "nothing broken" — say so up front so the
|
|
300
308
|
empty state isn't mistaken for a clean bill of health. */}
|
|
@@ -311,12 +319,15 @@ export function IssuesPane({
|
|
|
311
319
|
{/* Unchecked-source honesty: the rows can't include issues from a
|
|
312
320
|
source Radar couldn't check. With no rows the empty state below says
|
|
313
321
|
it instead. */}
|
|
314
|
-
{scopeIssues.length > 0 && uncheckedLines.
|
|
315
|
-
<div
|
|
322
|
+
{scopeIssues.length > 0 && uncheckedLines.length > 0 && (
|
|
323
|
+
<div className="flex items-start gap-2 rounded-lg border border-theme-border bg-theme-elevated px-3 py-2 text-xs text-theme-text-secondary">
|
|
316
324
|
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-500" />
|
|
317
|
-
<
|
|
325
|
+
<div className="min-w-0 flex-1">
|
|
326
|
+
{uncheckedLines.map((line) => <p key={line}>{line}</p>)}
|
|
327
|
+
<UncheckedSourceHelp onRetry={() => { void refetch({ cancelRefetch: false }); }} isRefreshing={isFetching} />
|
|
328
|
+
</div>
|
|
318
329
|
</div>
|
|
319
|
-
)
|
|
330
|
+
)}
|
|
320
331
|
|
|
321
332
|
{/* Truncation honesty: when more issues matched than were returned, say
|
|
322
333
|
so — don't present a capped list as the complete picture. */}
|
|
@@ -385,7 +396,20 @@ export function IssuesPane({
|
|
|
385
396
|
</button>
|
|
386
397
|
</div>
|
|
387
398
|
) : uncheckedLines.length > 0 && scopeIssues.length === 0 ? (
|
|
388
|
-
<EmptyState
|
|
399
|
+
<EmptyState
|
|
400
|
+
tone="neutral"
|
|
401
|
+
variant="card"
|
|
402
|
+
headline="No issues found"
|
|
403
|
+
body={uncheckedLines.join(" ")}
|
|
404
|
+
action={<UncheckedSourceHelp onRetry={() => { void refetch({ cancelRefetch: false }); }} isRefreshing={isFetching} />}
|
|
405
|
+
/>
|
|
406
|
+
) : !subject && error && scopeIssues.length === 0 ? (
|
|
407
|
+
<EmptyState
|
|
408
|
+
tone="neutral"
|
|
409
|
+
variant="card"
|
|
410
|
+
headline="No issues in the last successful result"
|
|
411
|
+
body="Current issues could not be checked."
|
|
412
|
+
/>
|
|
389
413
|
) : (
|
|
390
414
|
/* anyData = the query resolved, i.e. the cluster is reachable; an empty
|
|
391
415
|
list then means "nothing broken" rather than "not connected". */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { expect, it, vi } from 'vitest'
|
|
5
|
+
import { UncheckedSourceHelp } from './UncheckedSourceHelp'
|
|
6
|
+
|
|
7
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
8
|
+
|
|
9
|
+
it('keeps the coverage warning visible when help closes and prevents duplicate retries', async () => {
|
|
10
|
+
const host = document.createElement('div')
|
|
11
|
+
document.body.append(host)
|
|
12
|
+
const root = createRoot(host)
|
|
13
|
+
const retry = vi.fn()
|
|
14
|
+
const render = (refreshing: boolean) => (
|
|
15
|
+
<div>
|
|
16
|
+
<p>Helm releases couldn't be checked.</p>
|
|
17
|
+
<UncheckedSourceHelp onRetry={retry} isRefreshing={refreshing} />
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
try {
|
|
21
|
+
await act(async () => root.render(render(false)))
|
|
22
|
+
const disclosure = host.querySelector<HTMLButtonElement>('button[aria-expanded]')
|
|
23
|
+
expect(disclosure).not.toBeNull()
|
|
24
|
+
expect(disclosure?.getAttribute('aria-expanded')).toBe('false')
|
|
25
|
+
await act(async () => disclosure?.click())
|
|
26
|
+
expect(disclosure?.getAttribute('aria-expanded')).toBe('true')
|
|
27
|
+
const button = [...host.querySelectorAll('button')].find((b) => b.textContent === 'Check again')
|
|
28
|
+
expect(button).toBeDefined()
|
|
29
|
+
await act(async () => button?.click())
|
|
30
|
+
expect(retry).toHaveBeenCalledTimes(1)
|
|
31
|
+
await act(async () => root.render(render(true)))
|
|
32
|
+
expect(button?.disabled).toBe(true)
|
|
33
|
+
await act(async () => button?.click())
|
|
34
|
+
expect(retry).toHaveBeenCalledTimes(1)
|
|
35
|
+
await act(async () => disclosure?.click())
|
|
36
|
+
expect(disclosure?.getAttribute('aria-expanded')).toBe('false')
|
|
37
|
+
expect(host.querySelector('p')?.textContent).toBe("Helm releases couldn't be checked.")
|
|
38
|
+
} finally {
|
|
39
|
+
await act(async () => root.unmount())
|
|
40
|
+
host.remove()
|
|
41
|
+
}
|
|
42
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Disclosure } from '@skyhook-io/k8s-ui'
|
|
2
|
+
|
|
3
|
+
export function UncheckedSourceHelp({ onRetry, isRefreshing }: { onRetry: () => void; isRefreshing: boolean }) {
|
|
4
|
+
return (
|
|
5
|
+
<Disclosure
|
|
6
|
+
summary="Why is this shown?"
|
|
7
|
+
className="mt-2 text-left text-xs text-theme-text-secondary"
|
|
8
|
+
summaryClassName="min-h-9 text-accent-text hover:underline"
|
|
9
|
+
>
|
|
10
|
+
<div className="space-y-2 pt-2 leading-5">
|
|
11
|
+
<p>Some checks didn’t return a usable result. Issues found by other checks are still shown.</p>
|
|
12
|
+
<p>Radar checks again automatically. If this keeps happening, check Radar’s connection and access to Kubernetes.</p>
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
onClick={onRetry}
|
|
16
|
+
disabled={isRefreshing}
|
|
17
|
+
className="btn-secondary min-h-9 min-w-32 px-2.5 py-1 font-medium disabled:cursor-not-allowed"
|
|
18
|
+
>
|
|
19
|
+
{isRefreshing ? 'Checking again…' : 'Check again'}
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
</Disclosure>
|
|
23
|
+
)
|
|
24
|
+
}
|