@skyhook-io/radar-app 1.20.1 → 1.21.0
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 +10 -9
- package/src/App.tsx +65 -16
- package/src/api/client.audit-gating.test.tsx +105 -5
- package/src/api/client.auditBadgesSync.test.tsx +118 -0
- package/src/api/client.capabilitiesPoll.test.ts +61 -0
- 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 +347 -16
- package/src/api/namespaceScopeRetry.test.ts +14 -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 +10 -0
- package/src/api/secretsStore.test.ts +33 -0
- package/src/api/secretsStore.ts +37 -0
- package/src/api/substrateHealth.ts +134 -0
- package/src/api/velero.test.ts +60 -0
- package/src/api/velero.ts +201 -0
- package/src/api/vulnerabilities.ts +255 -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/NamespaceSwitcher.tsx +3 -1
- package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
- package/src/components/applications/ApplicationsView.tsx +8 -11
- package/src/components/audit/AuditView.tsx +4 -0
- package/src/components/audit/ChecksViewTabs.test.tsx +33 -5
- package/src/components/audit/ChecksViewTabs.tsx +11 -1
- package/src/components/audit/UpgradeReadinessView.test.ts +35 -1
- package/src/components/audit/UpgradeReadinessView.tsx +60 -2
- package/src/components/audit/VulnerabilitiesView.tsx +907 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +3 -1
- package/src/components/cnpg/CNPGDrawerTrail.tsx +5 -26
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +27 -6
- package/src/components/cnpg/CNPGView.tsx +43 -117
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +30 -0
- package/src/components/cnpg/host.tsx +2 -2
- package/src/components/cnpg/routes.ts +3 -1
- package/src/components/cnpg/shared.tsx +5 -53
- package/src/components/cnpg/useCNPGNavigate.ts +1 -21
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +16 -13
- package/src/components/community.tsx +42 -0
- package/src/components/cost/CostView.tsx +27 -9
- package/src/components/diagnose/InvestigationView.tsx +12 -3
- package/src/components/diagnose/diagnoseEvidenceTypes.ts +2 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +10 -0
- package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationMetrics.test.ts +20 -0
- package/src/components/diagnose/investigationMetrics.ts +2 -1
- package/src/components/dock/BottomDock.tsx +1 -0
- package/src/components/dock/LogsTab.tsx +3 -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 +2 -10
- package/src/components/helm/HelmDrawerFrame.tsx +1 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +24 -12
- package/src/components/helm/HelmView.tsx +25 -19
- package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
- package/src/components/helm/NotCheckedBadge.tsx +39 -0
- package/src/components/helm/OwnedResources.test.tsx +86 -0
- package/src/components/helm/OwnedResources.tsx +69 -11
- package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
- package/src/components/home/ClusterHealthCard.test.ts +44 -1
- package/src/components/home/ClusterHealthCard.tsx +25 -11
- package/src/components/home/HelmSummary.tsx +15 -15
- package/src/components/home/HomeAgentBlock.tsx +3 -0
- package/src/components/home/HomeView.tsx +7 -0
- package/src/components/home/MCPSetupDialog.test.tsx +19 -12
- package/src/components/home/MCPSetupDialog.tsx +4 -2
- package/src/components/home/mcpToolCatalog.ts +17 -4
- package/src/components/home/useVulnerabilitiesRow.test.ts +26 -0
- package/src/components/home/useVulnerabilitiesRow.ts +50 -0
- package/src/components/logs/LogsViewer.tsx +3 -1
- package/src/components/logs/MultiPodLogsTab.test.tsx +24 -4
- package/src/components/logs/MultiPodLogsTab.tsx +9 -5
- package/src/components/nav/PrimaryNavRail.test.tsx +17 -0
- package/src/components/nav/PrimaryNavRail.tsx +174 -29
- package/src/components/resource/PrometheusChartsGrid.tsx +5 -1
- package/src/components/resource/RightsizingStrip.test.ts +57 -0
- package/src/components/resource/RightsizingStrip.tsx +53 -4
- package/src/components/resource/SubstrateHealthCharts.test.tsx +143 -0
- package/src/components/resource/SubstrateHealthCharts.tsx +254 -0
- package/src/components/resource/SubstrateVerdictLine.test.tsx +131 -0
- package/src/components/resource/SubstrateVerdictLine.tsx +180 -0
- 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/ResourcesView.tsx +12 -6
- 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/UpgradePlanRenderer.test.tsx +20 -0
- package/src/components/resources/renderers/UpgradePlanRenderer.tsx +22 -0
- package/src/components/resources/renderers/VeleroBackupRenderer.tsx +16 -36
- package/src/components/resources/renderers/VeleroRestoreRenderer.tsx +6 -19
- package/src/components/resources/renderers/WorkloadRenderer.tsx +8 -0
- package/src/components/rightsizing/RightsizingScanView.tsx +19 -3
- 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/shared/LargeClusterNamespacePicker.test.tsx +27 -0
- package/src/components/shared/LargeClusterNamespacePicker.tsx +8 -2
- package/src/components/timeline/TimelineView.tsx +3 -1
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +94 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +21 -5
- package/src/components/traffic/TrafficData.test.tsx +37 -0
- package/src/components/traffic/TrafficData.tsx +27 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -7
- package/src/components/traffic/TrafficGraph.layoutEngine.test.tsx +193 -0
- package/src/components/traffic/TrafficGraph.test.tsx +269 -0
- package/src/components/traffic/TrafficGraph.tsx +135 -64
- package/src/components/traffic/TrafficGraphUnavailable.tsx +57 -0
- package/src/components/traffic/TrafficView.layoutUnavailable.test.tsx +211 -0
- package/src/components/traffic/TrafficView.tsx +72 -155
- package/src/components/traffic/trafficFilters.test.ts +189 -1
- package/src/components/traffic/trafficFilters.ts +169 -1
- package/src/components/ui/DiagnosticsOverlay.tsx +14 -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.manual.test.tsx +5 -2
- package/src/components/ui/UpdateNotification.test.tsx +54 -3
- package/src/components/ui/UpdateNotification.tsx +60 -19
- package/src/components/ui/command-items.ts +24 -1
- 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/velero/VeleroBackupNow.test.tsx +165 -0
- package/src/components/velero/VeleroBackupNow.tsx +143 -0
- package/src/components/velero/VeleroDeleteBackup.test.tsx +364 -0
- package/src/components/velero/VeleroDeleteBackup.tsx +306 -0
- package/src/components/velero/VeleroDetailPage.tsx +148 -0
- package/src/components/velero/VeleroKindLists.test.tsx +48 -0
- package/src/components/velero/VeleroKindLists.tsx +43 -0
- package/src/components/velero/VeleroLocations.expand.test.tsx +27 -0
- package/src/components/velero/VeleroLocations.test.tsx +86 -0
- package/src/components/velero/VeleroLocations.tsx +240 -0
- package/src/components/velero/VeleroOverview.test.tsx +311 -0
- package/src/components/velero/VeleroOverview.tsx +485 -0
- package/src/components/velero/VeleroPages.test.tsx +516 -0
- package/src/components/velero/VeleroPages.tsx +1056 -0
- package/src/components/velero/VeleroRunLists.tsx +309 -0
- package/src/components/velero/VeleroRunMessagesHost.test.tsx +25 -0
- package/src/components/velero/VeleroRunMessagesHost.tsx +54 -0
- package/src/components/velero/VeleroScheduleStatusBadge.test.tsx +28 -0
- package/src/components/velero/VeleroScheduleStatusBadge.tsx +21 -0
- package/src/components/velero/VeleroSchedules.tsx +255 -0
- package/src/components/velero/VeleroView.tsx +59 -0
- package/src/components/velero/VeleroWorkspace.gate.test.tsx +97 -0
- package/src/components/velero/attention.test.ts +178 -0
- package/src/components/velero/attention.ts +281 -0
- package/src/components/velero/backupDelete.test.tsx +91 -0
- package/src/components/velero/backupDelete.tsx +182 -0
- package/src/components/velero/coverage.test.ts +87 -0
- package/src/components/velero/coverage.ts +150 -0
- package/src/components/velero/host.tsx +86 -0
- package/src/components/velero/routes.ts +78 -0
- package/src/components/velero/runs.tsx +121 -0
- package/src/components/velero/shared.test.ts +84 -0
- package/src/components/velero/shared.tsx +423 -0
- package/src/components/velero/useVeleroSidebarWorkspace.test.tsx +28 -0
- package/src/components/velero/useVeleroSidebarWorkspace.ts +71 -0
- package/src/components/velero/velero.fixtures.ts +61 -0
- package/src/components/velero/workspaceRoute.ts +21 -0
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +167 -0
- package/src/components/vulnerabilities/parts.test.ts +72 -0
- package/src/components/vulnerabilities/parts.tsx +291 -0
- package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
- package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
- package/src/components/workload/WorkloadView.tsx +114 -37
- package/src/components/workspace/DrawerTrailBack.tsx +32 -0
- package/src/components/workspace/WorkspaceFrame.tsx +71 -0
- package/src/components/workspace/coverage.ts +61 -0
- package/src/components/workspace/layout.test.tsx +29 -1
- package/src/components/workspace/layout.tsx +15 -5
- package/src/components/workspace/sidebar.ts +9 -0
- package/src/components/workspace/useWorkspaceDrawer.ts +63 -0
- package/src/components/workspace/useWorkspaceNavigate.ts +21 -0
- package/src/context/ConnectionContext.test.ts +1 -0
- package/src/context/ConnectionContext.tsx +2 -2
- package/src/desktop/AboutDialog.test.ts +12 -0
- package/src/desktop/AboutDialog.tsx +151 -0
- package/src/desktop/WindowsTitleBar.tsx +359 -0
- package/src/desktop/titleBar.test.ts +61 -0
- package/src/desktop/titleBar.ts +45 -0
- package/src/index.css +19 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +15 -3
- package/src/integrations/resourceHosts.tsx +26 -6
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.test.ts +11 -0
- package/src/integrations/workspaceRoutes.ts +3 -1
- package/src/integrations/workspaceScreens.tsx +2 -0
- package/src/main.tsx +8 -0
- package/src/utils/desktop-zoom.test.ts +53 -0
- package/src/utils/desktop-zoom.ts +30 -0
- package/src/utils/namespacePick.test.ts +87 -0
- package/src/utils/namespacePick.ts +88 -0
- package/src/utils/staleAssetPrompt.test.tsx +76 -0
- package/src/utils/staleAssetPrompt.tsx +32 -0
|
@@ -12,8 +12,10 @@ import { PortForwardInlineButton } from '../portforward/PortForwardButton'
|
|
|
12
12
|
import { useAvailablePorts } from '../../api/client'
|
|
13
13
|
import { apiUrl, getAuthHeaders, getCredentialsMode } from '../../api/config'
|
|
14
14
|
import { useNamespacedCapabilities, useIsLocalDeployment } from '../../contexts/CapabilitiesContext'
|
|
15
|
-
import { pluralize, getExecContainerNames } from '@skyhook-io/k8s-ui'
|
|
15
|
+
import { pluralize, getExecContainerNames, getLogContainerNames, getDefaultLogContainerName, getInitContainerNames } from '@skyhook-io/k8s-ui'
|
|
16
|
+
import { readActionFor } from '@skyhook-io/k8s-ui/utils/read-actions'
|
|
16
17
|
import { Tooltip } from '../ui/Tooltip'
|
|
18
|
+
import { notCheckedTooltip, type NotCheckedReason } from './NotCheckedBadge'
|
|
17
19
|
|
|
18
20
|
interface OwnedResourcesProps {
|
|
19
21
|
resources: HelmOwnedResource[]
|
|
@@ -38,10 +40,11 @@ function groupByKind(resources: HelmOwnedResource[]): Map<string, HelmOwnedResou
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// Health status types
|
|
41
|
-
type HealthFilter = 'all' | 'healthy' | 'warning' | 'error'
|
|
43
|
+
type HealthFilter = 'all' | 'healthy' | 'warning' | 'error' | 'unread'
|
|
42
44
|
|
|
43
45
|
// Determine health status of a resource
|
|
44
|
-
function getResourceHealth(resource: HelmOwnedResource): 'healthy' | 'warning' | 'error' | 'unknown' {
|
|
46
|
+
function getResourceHealth(resource: HelmOwnedResource): 'healthy' | 'warning' | 'error' | 'unread' | 'unknown' {
|
|
47
|
+
if (resource.statusUnread) return 'unread'
|
|
45
48
|
// An issue field always indicates a problem regardless of status
|
|
46
49
|
if (resource.issue) return 'error'
|
|
47
50
|
const status = resource.status
|
|
@@ -58,17 +61,24 @@ function computeHealthSummary(resources: HelmOwnedResource[]) {
|
|
|
58
61
|
let healthy = 0
|
|
59
62
|
let warning = 0
|
|
60
63
|
let error = 0
|
|
64
|
+
let unread = 0
|
|
61
65
|
let unknown = 0
|
|
66
|
+
let denied = 0
|
|
62
67
|
|
|
63
68
|
for (const r of resources) {
|
|
64
69
|
const health = getResourceHealth(r)
|
|
65
70
|
if (health === 'healthy') healthy++
|
|
66
71
|
else if (health === 'warning') warning++
|
|
67
72
|
else if (health === 'error') error++
|
|
73
|
+
else if (health === 'unread') {
|
|
74
|
+
unread++
|
|
75
|
+
if (readActionFor(r.statusUnread) !== 'retry') denied++
|
|
76
|
+
}
|
|
68
77
|
else unknown++
|
|
69
78
|
}
|
|
70
79
|
|
|
71
|
-
|
|
80
|
+
const unreadReason: NotCheckedReason = denied === unread ? 'denied' : denied === 0 ? 'unconfirmed' : 'either'
|
|
81
|
+
return { healthy, warning, error, unread, unreadReason, unknown, total: resources.length }
|
|
72
82
|
}
|
|
73
83
|
|
|
74
84
|
export function OwnedResources({ resources, onNavigate, summaryLabel = 'created by this release' }: OwnedResourcesProps) {
|
|
@@ -99,7 +109,7 @@ export function OwnedResources({ resources, onNavigate, summaryLabel = 'created
|
|
|
99
109
|
return (
|
|
100
110
|
<div className="p-4 space-y-4">
|
|
101
111
|
{/* Health summary - clickable badges */}
|
|
102
|
-
<div className="flex items-center justify-between">
|
|
112
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
103
113
|
<div className="text-sm text-theme-text-secondary">
|
|
104
114
|
{healthFilter === 'all' ? (
|
|
105
115
|
<>{pluralize(resources.length, 'resource')} {summaryLabel}</>
|
|
@@ -117,7 +127,7 @@ export function OwnedResources({ resources, onNavigate, summaryLabel = 'created
|
|
|
117
127
|
</span>
|
|
118
128
|
)}
|
|
119
129
|
</div>
|
|
120
|
-
<div className="flex items-center gap-2">
|
|
130
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
121
131
|
{health.healthy > 0 && (
|
|
122
132
|
<button
|
|
123
133
|
onClick={() => handleFilterClick('healthy')}
|
|
@@ -154,6 +164,20 @@ export function OwnedResources({ resources, onNavigate, summaryLabel = 'created
|
|
|
154
164
|
{health.error} failed
|
|
155
165
|
</button>
|
|
156
166
|
)}
|
|
167
|
+
{health.unread > 0 && (
|
|
168
|
+
<Tooltip content={<div className="max-w-xs">{notCheckedTooltip(health.unread, health.unreadReason)}</div>}>
|
|
169
|
+
<button
|
|
170
|
+
onClick={() => handleFilterClick('unread')}
|
|
171
|
+
className={clsx(
|
|
172
|
+
'flex items-center gap-1 px-2 py-0.5 text-xs rounded transition-all',
|
|
173
|
+
SEVERITY_BADGE.neutral,
|
|
174
|
+
healthFilter === 'unread' && 'ring-2 ring-theme-border ring-offset-1 ring-offset-theme-surface'
|
|
175
|
+
)}
|
|
176
|
+
>
|
|
177
|
+
{health.unread} not checked
|
|
178
|
+
</button>
|
|
179
|
+
</Tooltip>
|
|
180
|
+
)}
|
|
157
181
|
</div>
|
|
158
182
|
</div>
|
|
159
183
|
|
|
@@ -201,8 +225,26 @@ interface ResourceItemProps {
|
|
|
201
225
|
onNavigate?: NavigateToResource
|
|
202
226
|
}
|
|
203
227
|
|
|
228
|
+
// The badge and tooltip for an object whose status the caller isn't shown.
|
|
229
|
+
// A check that went unanswered isn't a denial, so it doesn't say "No access".
|
|
230
|
+
function unreadStatusText(resource: HelmOwnedResource): { badge: string; tooltip: string } | null {
|
|
231
|
+
if (!resource.statusUnread) return null
|
|
232
|
+
if (readActionFor(resource.statusUnread) === 'retry') {
|
|
233
|
+
return {
|
|
234
|
+
badge: 'Not checked',
|
|
235
|
+
tooltip: `Radar couldn't check your access to this ${resource.kind}, so its status isn't shown. Refresh to try again.`,
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
badge: 'No access',
|
|
240
|
+
tooltip: `You can't read this ${resource.kind}, so its status isn't shown and release health doesn't count it.`,
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
204
244
|
function ResourceItem({ resource, onNavigate }: ResourceItemProps) {
|
|
205
|
-
const
|
|
245
|
+
const unread = unreadStatusText(resource)
|
|
246
|
+
// Opening it, or its logs and ports, would only be refused.
|
|
247
|
+
const canNavigate = !!onNavigate && !unread
|
|
206
248
|
const isPod = resource.kind.toLowerCase() === 'pod'
|
|
207
249
|
const isService = resource.kind.toLowerCase() === 'service'
|
|
208
250
|
const isRunning = resource.status?.toLowerCase() === 'running'
|
|
@@ -243,8 +285,16 @@ function ResourceItem({ resource, onNavigate }: ResourceItemProps) {
|
|
|
243
285
|
</div>
|
|
244
286
|
|
|
245
287
|
<div className="flex items-center gap-2 shrink-0">
|
|
288
|
+
{unread && (
|
|
289
|
+
<Tooltip content={unread.tooltip}>
|
|
290
|
+
<span className={clsx('badge-sm', SEVERITY_BADGE.neutral)}>
|
|
291
|
+
{unread.badge}
|
|
292
|
+
</span>
|
|
293
|
+
</Tooltip>
|
|
294
|
+
)}
|
|
295
|
+
|
|
246
296
|
{/* Quick actions for pods */}
|
|
247
|
-
{isPod && (
|
|
297
|
+
{isPod && !unread && (
|
|
248
298
|
<PodQuickActions
|
|
249
299
|
namespace={resource.namespace}
|
|
250
300
|
podName={resource.name}
|
|
@@ -253,7 +303,7 @@ function ResourceItem({ resource, onNavigate }: ResourceItemProps) {
|
|
|
253
303
|
)}
|
|
254
304
|
|
|
255
305
|
{/* Quick actions for services */}
|
|
256
|
-
{isService && (
|
|
306
|
+
{isService && !unread && (
|
|
257
307
|
<ServiceQuickActions
|
|
258
308
|
namespace={resource.namespace}
|
|
259
309
|
serviceName={resource.name}
|
|
@@ -296,6 +346,13 @@ function ResourceItem({ resource, onNavigate }: ResourceItemProps) {
|
|
|
296
346
|
</Tooltip>
|
|
297
347
|
)}
|
|
298
348
|
|
|
349
|
+
{/* Holds the details button's place so this row's badge lines up with the rest. */}
|
|
350
|
+
{onNavigate && !canNavigate && (
|
|
351
|
+
<span aria-hidden className="invisible p-1">
|
|
352
|
+
<ExternalLink className="w-3.5 h-3.5" />
|
|
353
|
+
</span>
|
|
354
|
+
)}
|
|
355
|
+
|
|
299
356
|
{canNavigate && (
|
|
300
357
|
<Tooltip content="View details">
|
|
301
358
|
<button
|
|
@@ -374,11 +431,12 @@ function PodQuickActions({ namespace, podName, isRunning }: PodQuickActionsProps
|
|
|
374
431
|
setIsLoadingAction(true)
|
|
375
432
|
try {
|
|
376
433
|
const data = await fetchPodData()
|
|
377
|
-
const containers = data.resource?.spec?.containers || []
|
|
378
434
|
openLogs({
|
|
379
435
|
namespace,
|
|
380
436
|
podName,
|
|
381
|
-
containers:
|
|
437
|
+
containers: getLogContainerNames(data.resource),
|
|
438
|
+
containerName: getDefaultLogContainerName(data.resource),
|
|
439
|
+
initContainers: getInitContainerNames(data.resource),
|
|
382
440
|
})
|
|
383
441
|
} catch (error) {
|
|
384
442
|
console.error('Failed to open logs:', error)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, expect, it, vi } from 'vitest'
|
|
5
|
+
import { ClusterHealthCard } from './ClusterHealthCard'
|
|
6
|
+
import type { DashboardResponse } from '../../api/client'
|
|
7
|
+
|
|
8
|
+
vi.mock('./HomeAgentBlock', () => ({ HomeAgentBlock: () => null }))
|
|
9
|
+
|
|
10
|
+
const counts: DashboardResponse['resourceCounts'] = {
|
|
11
|
+
pods: { total: 0, running: 0, pending: 0, failed: 0, succeeded: 0 },
|
|
12
|
+
deployments: { total: 0, available: 0, unavailable: 0 },
|
|
13
|
+
statefulSets: { total: 0, ready: 0, unready: 0 },
|
|
14
|
+
daemonSets: { total: 0, ready: 0, unready: 0 },
|
|
15
|
+
services: 0,
|
|
16
|
+
ingresses: 0,
|
|
17
|
+
nodes: { total: 0, ready: 0, notReady: 0, cordoned: 0 },
|
|
18
|
+
namespaces: 0,
|
|
19
|
+
jobs: { total: 0, active: 0, succeeded: 0, failed: 0 },
|
|
20
|
+
cronJobs: { total: 0, active: 0, suspended: 0 },
|
|
21
|
+
configMaps: 0,
|
|
22
|
+
secrets: 0,
|
|
23
|
+
pvcs: { total: 0, bound: 0, pending: 0, unbound: 0 },
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let root: Root | undefined
|
|
27
|
+
let host: HTMLDivElement | undefined
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
act(() => root?.unmount())
|
|
30
|
+
host?.remove()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
function render(context: string) {
|
|
34
|
+
const cluster: DashboardResponse['cluster'] = { name: context, kubeconfigCluster: 'gitlab_com', platform: 'kind', version: '', connected: true }
|
|
35
|
+
act(() => {
|
|
36
|
+
root!.render(
|
|
37
|
+
<ClusterHealthCard
|
|
38
|
+
health={{ healthy: 0, warning: 0, error: 0, warningEvents: 0 }}
|
|
39
|
+
counts={counts}
|
|
40
|
+
cluster={cluster}
|
|
41
|
+
metrics={null}
|
|
42
|
+
metricsServerAvailable={false}
|
|
43
|
+
issueCount={0}
|
|
44
|
+
hasCriticalIssues={false}
|
|
45
|
+
nodeVersionSkew={null}
|
|
46
|
+
onNavigateToKind={() => {}}
|
|
47
|
+
onNavigateToView={() => {}}
|
|
48
|
+
/>,
|
|
49
|
+
)
|
|
50
|
+
})
|
|
51
|
+
return host!.querySelector('h2')!
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
it('names the heading with the full context, which the middle cut hides from screen readers', () => {
|
|
55
|
+
host = document.createElement('div')
|
|
56
|
+
document.body.append(host)
|
|
57
|
+
root = createRoot(host)
|
|
58
|
+
const a = 'gitlab-org/infra/platform/k8s-agents:production-eu-west-agent'
|
|
59
|
+
expect(render(a).getAttribute('aria-label')).toBe(a)
|
|
60
|
+
const b = 'gitlab-org/infra/platform/k8s-agents:staging-us-east-agent'
|
|
61
|
+
expect(render(b).getAttribute('aria-label')).toBe(b)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('names an OpenShift heading with the full context, so two projects on one server stay apart', () => {
|
|
65
|
+
host = document.createElement('div')
|
|
66
|
+
document.body.append(host)
|
|
67
|
+
root = createRoot(host)
|
|
68
|
+
const a = 'proj-a/api-prod-example-com:6443/alice'
|
|
69
|
+
const heading = render(a)
|
|
70
|
+
expect(heading.getAttribute('aria-label')).toBe(a)
|
|
71
|
+
expect(heading.textContent).not.toBe(a)
|
|
72
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { minorsBehind } from "./ClusterHealthCard";
|
|
2
|
+
import { clusterIdentity, minorsBehind } from "./ClusterHealthCard";
|
|
3
3
|
|
|
4
4
|
describe("minorsBehind", () => {
|
|
5
5
|
it("counts minors between plain versions", () => {
|
|
@@ -29,3 +29,46 @@ describe("minorsBehind", () => {
|
|
|
29
29
|
expect(minorsBehind("1.33", "")).toBe(0);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
+
|
|
33
|
+
describe("clusterIdentity", () => {
|
|
34
|
+
it("names contexts that share one kubeconfig cluster entry apart", () => {
|
|
35
|
+
const a = clusterIdentity({ name: "agent-a", kubeconfigCluster: "gitlab_com" });
|
|
36
|
+
const b = clusterIdentity({ name: "agent-b", kubeconfigCluster: "gitlab_com" });
|
|
37
|
+
expect(a.headline).toBe("agent-a");
|
|
38
|
+
expect(b.headline).toBe("agent-b");
|
|
39
|
+
expect(a.raw).toBe("agent-a");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("shortens cloud contexts the same way the switcher does", () => {
|
|
43
|
+
const id = clusterIdentity({ name: "gke_proj_us-east1-b_my-cluster", kubeconfigCluster: "gke_proj_us-east1-b_my-cluster" });
|
|
44
|
+
expect(id.headline).toBe("my-cluster");
|
|
45
|
+
expect(id.location).toBe("proj · us-east1-b");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("shows the server host for an OpenShift context, keeping the full context as raw", () => {
|
|
49
|
+
const id = clusterIdentity({ name: "myproject/api-prod-example-com:6443/alice", kubeconfigCluster: "api-prod-example-com:6443" });
|
|
50
|
+
expect(id.headline).toBe("api-prod-example-com");
|
|
51
|
+
expect(id.raw).toBe("myproject/api-prod-example-com:6443/alice");
|
|
52
|
+
expect(id.location).toBe("");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("keeps the cluster entry's account and region for a renamed cloud context", () => {
|
|
56
|
+
const id = clusterIdentity({ name: "prod-eks-alias", kubeconfigCluster: "arn:aws:eks:us-west-2:123456789012:cluster/orders" });
|
|
57
|
+
expect(id.headline).toBe("prod-eks-alias");
|
|
58
|
+
expect(id.location).toBe("123456789012 · us-west-2");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("shows no location when neither name is a cloud name", () => {
|
|
62
|
+
expect(clusterIdentity({ name: "group/project:agent", kubeconfigCluster: "gitlab_com" }).location).toBe("");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("reads an older Radar that sends only the cluster entry as name", () => {
|
|
66
|
+
expect(clusterIdentity({ name: "gitlab_com" }).headline).toBe("gitlab_com");
|
|
67
|
+
expect(clusterIdentity({ name: "arn:aws:eks:us-west-2:123456789012:cluster/orders" }).location).toBe("123456789012 · us-west-2");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("falls back to Cluster with no name", () => {
|
|
71
|
+
expect(clusterIdentity({ name: "in-cluster" }).headline).toBe("in-cluster");
|
|
72
|
+
expect(clusterIdentity({ name: "" }).headline).toBe("Cluster");
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -10,7 +10,7 @@ import { clsx } from 'clsx'
|
|
|
10
10
|
import { formatCPUMillicores, formatMemoryMiB } from '../../utils/format'
|
|
11
11
|
import { useCapabilitiesContext } from '../../contexts/CapabilitiesContext'
|
|
12
12
|
import { HomeAgentBlock } from './HomeAgentBlock'
|
|
13
|
-
import { assetUrl, pluralize, parseContextName, CertaintyGlyph } from '@skyhook-io/k8s-ui'
|
|
13
|
+
import { assetUrl, pluralize, parseContextName, CertaintyGlyph, MiddleEllipsis } from '@skyhook-io/k8s-ui'
|
|
14
14
|
import { Tooltip } from '../ui/Tooltip'
|
|
15
15
|
import { mcpEndpointUrl } from '../../api/config'
|
|
16
16
|
import { parseMajorMinor } from '../../utils/version'
|
|
@@ -42,6 +42,7 @@ interface ClusterHealthCardProps {
|
|
|
42
42
|
// cluster metadata so the overview carries a freshness signal without a band.
|
|
43
43
|
freshness?: ReactNode
|
|
44
44
|
radarVersion?: ReactNode
|
|
45
|
+
vulnerabilityTools?: boolean
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
function getMetricsInstallHint(platform: string): string {
|
|
@@ -145,6 +146,7 @@ export function ClusterHealthCard({
|
|
|
145
146
|
onIssuesClick,
|
|
146
147
|
freshness,
|
|
147
148
|
radarVersion,
|
|
149
|
+
vulnerabilityTools,
|
|
148
150
|
}: ClusterHealthCardProps) {
|
|
149
151
|
void _topCRDs // Reserved for future CRD display
|
|
150
152
|
|
|
@@ -219,12 +221,11 @@ export function ClusterHealthCard({
|
|
|
219
221
|
// has no meaningful kubeconfig context — bootstrap sets it to
|
|
220
222
|
// the literal "in-cluster" sentinel. Fall back to the platform
|
|
221
223
|
// label ("Google Kubernetes Engine") which IS recognizable.
|
|
222
|
-
// 3. Last resort: the
|
|
224
|
+
// 3. Last resort: the raw cluster.name, or "Cluster".
|
|
223
225
|
// When the card is rendered embedded (cloud mode), the H2 itself is
|
|
224
226
|
// suppressed below — the hub shell already shows the cluster name in
|
|
225
227
|
// its top bar.
|
|
226
|
-
const
|
|
227
|
-
const rawHeadline = parsedContext.clusterName || cluster.name || 'Cluster'
|
|
228
|
+
const { raw: rawName, location, headline: rawHeadline } = clusterIdentity(cluster)
|
|
228
229
|
const headlineName = isInCluster ? platformInfo.name : rawHeadline
|
|
229
230
|
|
|
230
231
|
return (
|
|
@@ -251,17 +252,19 @@ export function ClusterHealthCard({
|
|
|
251
252
|
// the visible text falls back to the platform label. Render no
|
|
252
253
|
// tooltip in that case; local mode keeps it so users can hover
|
|
253
254
|
// to see the full kubeconfig context path.
|
|
254
|
-
<Tooltip content={isInCluster ? '' :
|
|
255
|
-
<h2 className="text-xl font-semibold text-theme-text-primary
|
|
256
|
-
{
|
|
255
|
+
<Tooltip content={isInCluster ? '' : rawName} wrapperClassName="!block min-w-0">
|
|
256
|
+
<h2 aria-label={isInCluster ? headlineName : rawName} className="text-xl font-semibold text-theme-text-primary leading-tight mb-1.5">
|
|
257
|
+
{/* Generated contexts often share a long prefix and differ only at the end.
|
|
258
|
+
MiddleEllipsis exposes only the cut text to screen readers; aria-label keeps the full name. */}
|
|
259
|
+
<MiddleEllipsis text={headlineName} />
|
|
257
260
|
</h2>
|
|
258
261
|
</Tooltip>
|
|
259
262
|
)}
|
|
260
263
|
<div className="flex flex-col gap-0.5 text-xs text-theme-text-tertiary">
|
|
261
|
-
{
|
|
262
|
-
<Tooltip content={
|
|
264
|
+
{location && (
|
|
265
|
+
<Tooltip content={location} wrapperClassName="min-w-0">
|
|
263
266
|
<span className="truncate font-mono">
|
|
264
|
-
{
|
|
267
|
+
{location}
|
|
265
268
|
</span>
|
|
266
269
|
</Tooltip>
|
|
267
270
|
)}
|
|
@@ -303,7 +306,7 @@ export function ClusterHealthCard({
|
|
|
303
306
|
(org-wide endpoint, PAT-authed) rather than per-cluster, so this
|
|
304
307
|
localhost/no-auth entry would mislead a Cloud user. */}
|
|
305
308
|
{showLocalMcpCard && (
|
|
306
|
-
<HomeAgentBlock mcpUrl={mcpUrl} readOnly={caps.mcpReadOnly} execTools={caps.mcpExecTools} httpTools={caps.mcpHttpTools} helmTools={caps.mcpHelmTools} applicationEvidenceAvailable={caps.mcpApplicationEvidence} />
|
|
309
|
+
<HomeAgentBlock mcpUrl={mcpUrl} readOnly={caps.mcpReadOnly} execTools={caps.mcpExecTools} httpTools={caps.mcpHttpTools} helmTools={caps.mcpHelmTools} vulnerabilityTools={vulnerabilityTools} applicationEvidenceAvailable={caps.mcpApplicationEvidence} />
|
|
307
310
|
)}
|
|
308
311
|
</div>
|
|
309
312
|
|
|
@@ -522,6 +525,17 @@ export function ClusterHealthCard({
|
|
|
522
525
|
)
|
|
523
526
|
}
|
|
524
527
|
|
|
528
|
+
// `name` is the kubeconfig context. A renamed cloud context
|
|
529
|
+
// (`aws eks update-kubeconfig --alias`) no longer parses, but its kubeconfig
|
|
530
|
+
// cluster entry still carries the account and region.
|
|
531
|
+
export function clusterIdentity(cluster: Pick<DashboardResponse['cluster'], 'name' | 'kubeconfigCluster'>) {
|
|
532
|
+
const raw = cluster.name || ''
|
|
533
|
+
const parsed = parseContextName(raw)
|
|
534
|
+
const located = parsed.provider ? parsed : parseContextName(cluster.kubeconfigCluster || '')
|
|
535
|
+
const location = [located.account, located.region].filter(Boolean).join(' · ')
|
|
536
|
+
return { raw, headline: parsed.clusterName || raw || 'Cluster', location }
|
|
537
|
+
}
|
|
538
|
+
|
|
525
539
|
// How many minors the running version trails the newest one the upgrade-impact
|
|
526
540
|
// catalog covers. Cross-major comparisons return 0 — better a missing hint than
|
|
527
541
|
// a wrong count on an exotic version string.
|
|
@@ -3,6 +3,7 @@ import { Package, ArrowRight, Shield } from 'lucide-react'
|
|
|
3
3
|
import { clsx } from 'clsx'
|
|
4
4
|
import { Tooltip } from '../ui/Tooltip'
|
|
5
5
|
import { SEVERITY_TEXT } from '../../utils/badge-colors'
|
|
6
|
+
import { NotCheckedBadge } from '../helm/NotCheckedBadge'
|
|
6
7
|
|
|
7
8
|
interface HelmSummaryProps {
|
|
8
9
|
data?: DashboardHelmSummary
|
|
@@ -115,25 +116,24 @@ export function HelmSummary({ data, onNavigate }: HelmSummaryProps) {
|
|
|
115
116
|
) : (
|
|
116
117
|
<div className="divide-y divide-theme-border">
|
|
117
118
|
{data.releases.map((release) => (
|
|
119
|
+
// One flex row so space runs out in order: the chart text first,
|
|
120
|
+
// then the namespace, then the name. The badges never shrink.
|
|
118
121
|
<div
|
|
119
122
|
key={`${release.namespace}/${release.name}`}
|
|
120
|
-
className="flex items-center
|
|
123
|
+
className="flex items-center gap-2 px-3 py-1.5 overflow-hidden"
|
|
121
124
|
>
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<Tooltip content={`${release.chart} ${release.chartVersion}`} delay={100}>
|
|
129
|
-
<span className="text-[10px] text-theme-text-tertiary hidden sm:inline truncate max-w-[150px]">
|
|
130
|
-
{release.chart} {release.chartVersion}
|
|
131
|
-
</span>
|
|
132
|
-
</Tooltip>
|
|
133
|
-
<span className={clsx('badge-sm shrink-0', getStatusBadgeClass(release.status))}>
|
|
134
|
-
{release.status}
|
|
125
|
+
<span className={clsx('w-1.5 h-1.5 rounded-full shrink-0', getHealthDot(release.resourceHealth))} />
|
|
126
|
+
<span className="min-w-[3rem] text-xs text-theme-text-primary truncate">{release.name}</span>
|
|
127
|
+
<span className="min-w-0 shrink-[20] text-[10px] text-theme-text-tertiary truncate">{release.namespace}</span>
|
|
128
|
+
<Tooltip content={`${release.chart} ${release.chartVersion}`} delay={100} wrapperClassName="ml-auto min-w-0 shrink-[400]">
|
|
129
|
+
<span className="text-[10px] text-theme-text-tertiary hidden sm:inline truncate max-w-[150px]">
|
|
130
|
+
{release.chart} {release.chartVersion}
|
|
135
131
|
</span>
|
|
136
|
-
</
|
|
132
|
+
</Tooltip>
|
|
133
|
+
<NotCheckedBadge count={release.statusUnreadCount} />
|
|
134
|
+
<span className={clsx('badge-sm shrink-0', getStatusBadgeClass(release.status))}>
|
|
135
|
+
{release.status}
|
|
136
|
+
</span>
|
|
137
137
|
</div>
|
|
138
138
|
))}
|
|
139
139
|
</div>
|
|
@@ -16,6 +16,7 @@ export function HomeAgentBlock({
|
|
|
16
16
|
execTools,
|
|
17
17
|
httpTools,
|
|
18
18
|
helmTools,
|
|
19
|
+
vulnerabilityTools,
|
|
19
20
|
applicationEvidenceAvailable,
|
|
20
21
|
}: {
|
|
21
22
|
mcpUrl: string
|
|
@@ -24,6 +25,7 @@ export function HomeAgentBlock({
|
|
|
24
25
|
httpTools?: boolean
|
|
25
26
|
/** Whether the native Helm MCP tool is registered; target Kubernetes permissions still required. */
|
|
26
27
|
helmTools?: boolean
|
|
28
|
+
vulnerabilityTools?: boolean
|
|
27
29
|
applicationEvidenceAvailable?: boolean
|
|
28
30
|
}) {
|
|
29
31
|
const [mcpDialogOpen, setMcpDialogOpen] = useState(false)
|
|
@@ -61,6 +63,7 @@ export function HomeAgentBlock({
|
|
|
61
63
|
execTools={execTools}
|
|
62
64
|
httpTools={httpTools}
|
|
63
65
|
helmTools={helmTools}
|
|
66
|
+
vulnerabilityTools={vulnerabilityTools}
|
|
64
67
|
onInvestigate={showInvestigate && d.available ? () => openComposer(d) : undefined}
|
|
65
68
|
applicationEvidenceAvailable={applicationEvidenceAvailable}
|
|
66
69
|
/>
|
|
@@ -11,6 +11,9 @@ import { CertificateHealthCard } from './CertificateHealthCard'
|
|
|
11
11
|
import { NetworkPolicyCoverageCard } from './NetworkPolicyCoverageCard'
|
|
12
12
|
import { CostCard } from './CostCard'
|
|
13
13
|
import { GitOpsControllersCard } from './GitOpsControllersCard'
|
|
14
|
+
import { useVulnerabilitiesRow } from './useVulnerabilitiesRow'
|
|
15
|
+
import { useAPIResources } from '../../api/apiResources'
|
|
16
|
+
import { hasVulnerabilityReports } from '../../api/vulnerabilities'
|
|
14
17
|
import { CapacityCard } from './CapacityCard'
|
|
15
18
|
import { useCapabilitiesContext } from '../../contexts/CapabilitiesContext'
|
|
16
19
|
import { Tooltip } from '../ui/Tooltip'
|
|
@@ -69,6 +72,8 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
69
72
|
const capacityCardPossible =
|
|
70
73
|
karpenterState === 'available' || karpenterState === 'denied' || karpenterState === 'not_detected'
|
|
71
74
|
const { data, isLoading, error, dataUpdatedAt, refetch } = useDashboard(namespaces)
|
|
75
|
+
const vulnerabilitiesRow = useVulnerabilitiesRow(namespaces)
|
|
76
|
+
const { data: apiResources } = useAPIResources()
|
|
72
77
|
const { connection } = useConnection()
|
|
73
78
|
const { data: issuesData, isLoading: issuesLoading, isFetching: issuesFetching, error: issuesError, refetch: refetchIssues } = useIssues(namespaces)
|
|
74
79
|
const issues = issuesData?.issues ?? []
|
|
@@ -143,6 +148,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
143
148
|
)}
|
|
144
149
|
{/* Row 1: Cluster Health Card (combined health + resource counts) */}
|
|
145
150
|
<ClusterHealthCard
|
|
151
|
+
vulnerabilityTools={hasVulnerabilityReports(apiResources)}
|
|
146
152
|
// A local install shows its version in Settings and upgrades through
|
|
147
153
|
// the update notification; an in-cluster one is upgraded by whoever
|
|
148
154
|
// manages it, and this line is where they confirm the new version.
|
|
@@ -264,6 +270,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
264
270
|
<AuditCard
|
|
265
271
|
data={data.audit}
|
|
266
272
|
onNavigate={() => onNavigateToView('checks')}
|
|
273
|
+
vulnerabilities={vulnerabilitiesRow}
|
|
267
274
|
/>
|
|
268
275
|
</BandItem>
|
|
269
276
|
)}
|
|
@@ -20,7 +20,7 @@ describe('MCP setup in read-only mode', () => {
|
|
|
20
20
|
setBasename('/radar')
|
|
21
21
|
try {
|
|
22
22
|
const url = mcpEndpointUrl(true)
|
|
23
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools readOnly applicationEvidenceAvailable mcpUrl={url} onClose={() => {}} />)
|
|
23
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools readOnly applicationEvidenceAvailable mcpUrl={url} onClose={() => {}} />)
|
|
24
24
|
expect(html).toContain(`claude mcp add --transport http radar ${url}`)
|
|
25
25
|
expect(html).toContain(`codex mcp add radar --url ${url}`)
|
|
26
26
|
expect(html).toContain('/radar/mcp-readonly')
|
|
@@ -37,7 +37,7 @@ describe('MCP setup in read-only mode', () => {
|
|
|
37
37
|
})
|
|
38
38
|
|
|
39
39
|
it('explains disabled exec without including it in the available tool count', () => {
|
|
40
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools execTools={false} mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
40
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools execTools={false} mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
41
41
|
expect(html).toContain('apply_resource')
|
|
42
42
|
expect(html).toContain('in_cluster')
|
|
43
43
|
expect(html).toContain('exec_pod')
|
|
@@ -47,14 +47,21 @@ describe('MCP setup in read-only mode', () => {
|
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
it('does not suggest an unsupported flag when the capability is absent', () => {
|
|
50
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
50
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
51
51
|
expect(html).not.toContain('exec_pod')
|
|
52
52
|
expect(html).not.toContain('curl_service')
|
|
53
53
|
expect(html).not.toContain('--mcp-exec-tools')
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
+
it('lists list_vulnerabilities only where Trivy reports are served', () => {
|
|
57
|
+
const without = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
58
|
+
expect(without).not.toContain('list_vulnerabilities')
|
|
59
|
+
const withReports = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
60
|
+
expect(withReports).toContain('list_vulnerabilities')
|
|
61
|
+
})
|
|
62
|
+
|
|
56
63
|
it('shows exec without enabling HTTP', () => {
|
|
57
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools execTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
64
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools execTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
58
65
|
expect(html).toContain('exec_pod')
|
|
59
66
|
expect(html).not.toContain('curl_service')
|
|
60
67
|
expect(html).toContain(`${MCP_TOOL_CATALOG.length - 2} tools`)
|
|
@@ -62,21 +69,21 @@ describe('MCP setup in read-only mode', () => {
|
|
|
62
69
|
})
|
|
63
70
|
|
|
64
71
|
it('hides exec in read-only mode even if exec is requested', () => {
|
|
65
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools readOnly execTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
72
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools readOnly execTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
66
73
|
expect(html).not.toContain('exec_pod')
|
|
67
74
|
expect(html).not.toContain('curl_service')
|
|
68
75
|
expect(html).toContain(`${MCP_TOOL_CATALOG.filter((tool) => !tool.write && !tool.localOnly).length} tools`)
|
|
69
76
|
})
|
|
70
77
|
|
|
71
78
|
it('keeps the full catalog in default mode', () => {
|
|
72
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools applicationEvidenceAvailable mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
79
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools applicationEvidenceAvailable mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
73
80
|
expect(html).toContain('apply_resource')
|
|
74
81
|
expect(html).toContain('in_cluster')
|
|
75
82
|
expect(html).toContain('collect_application_evidence')
|
|
76
83
|
})
|
|
77
84
|
|
|
78
85
|
it('hides local-only tools unless the server advertises availability', () => {
|
|
79
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
86
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
80
87
|
expect(html).toContain('apply_resource')
|
|
81
88
|
expect(html).not.toContain('collect_application_evidence')
|
|
82
89
|
})
|
|
@@ -85,7 +92,7 @@ describe('MCP setup in read-only mode', () => {
|
|
|
85
92
|
describe('MCP setup prompt tip', () => {
|
|
86
93
|
it('tips to name Radar under the client setups, as plain text, without the in-Radar link when no handler is given', () => {
|
|
87
94
|
const host = document.createElement('div')
|
|
88
|
-
host.innerHTML = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
95
|
+
host.innerHTML = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
89
96
|
const tip = [...host.querySelectorAll('p')].find((p) => p.textContent?.startsWith('Tip:'))
|
|
90
97
|
expect(tip?.textContent).toBe(
|
|
91
98
|
"Tip: name Radar in your prompt so your agent uses Radar instead of kubectl, e.g. Use Radar to find what's broken in my cluster and why.",
|
|
@@ -135,7 +142,7 @@ describe('MCP setup prompt tip', () => {
|
|
|
135
142
|
document.body.appendChild(host)
|
|
136
143
|
const root = createRoot(host)
|
|
137
144
|
try {
|
|
138
|
-
act(() => root.render(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />))
|
|
145
|
+
act(() => root.render(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />))
|
|
139
146
|
const endpoint = [...host.querySelectorAll('code')].find((c) => c.textContent === mcpEndpointUrl())!
|
|
140
147
|
const copy = endpoint.closest('.relative')!.querySelector('button')!
|
|
141
148
|
await act(async () => copy.click())
|
|
@@ -149,11 +156,11 @@ describe('MCP setup prompt tip', () => {
|
|
|
149
156
|
})
|
|
150
157
|
|
|
151
158
|
it('shows HTTP independently of exec', () => {
|
|
152
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools httpTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
159
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools httpTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
153
160
|
expect(html).toContain('curl_service')
|
|
154
161
|
expect(html).not.toContain('exec_pod')
|
|
155
162
|
expect(html).toContain(`${MCP_TOOL_CATALOG.length - 2} tools`)
|
|
156
|
-
const readOnly = renderToStaticMarkup(<MCPSetupDialog open helmTools readOnly httpTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
163
|
+
const readOnly = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools readOnly httpTools mcpUrl={mcpEndpointUrl(true)} onClose={() => {}} />)
|
|
157
164
|
expect(readOnly).not.toContain('curl_service')
|
|
158
165
|
})
|
|
159
166
|
|
|
@@ -166,6 +173,6 @@ it('hides disabled Helm writes while retaining release reads and other writes',
|
|
|
166
173
|
})
|
|
167
174
|
|
|
168
175
|
it('shows registered Helm tools independently of target namespace permissions', () => {
|
|
169
|
-
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
176
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
170
177
|
expect(html).toContain('manage_helm')
|
|
171
178
|
})
|
|
@@ -16,6 +16,8 @@ interface MCPSetupDialogProps {
|
|
|
16
16
|
httpTools?: boolean
|
|
17
17
|
/** Whether the native Helm MCP tool is registered; target Kubernetes permissions still required. */
|
|
18
18
|
helmTools?: boolean
|
|
19
|
+
/** Whether the cluster serves Trivy's reports, the only place list_vulnerabilities is listed. */
|
|
20
|
+
vulnerabilityTools?: boolean
|
|
19
21
|
applicationEvidenceAvailable?: boolean
|
|
20
22
|
mcpUrl: string
|
|
21
23
|
/** Opens Radar's own investigation composer. Omit where investigations can't run. */
|
|
@@ -59,7 +61,7 @@ function CodeBlock({ children }: { children: string }) {
|
|
|
59
61
|
)
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTools, httpTools, helmTools, onInvestigate, applicationEvidenceAvailable = false }: MCPSetupDialogProps) {
|
|
64
|
+
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTools, httpTools, helmTools, vulnerabilityTools = false, onInvestigate, applicationEvidenceAvailable = false }: MCPSetupDialogProps) {
|
|
63
65
|
const dialogRef = useRef<HTMLDivElement>(null)
|
|
64
66
|
const [isDesktop, setIsDesktop] = useState(false)
|
|
65
67
|
const [portPinned, setPortPinned] = useState(false)
|
|
@@ -133,7 +135,7 @@ export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false, execTo
|
|
|
133
135
|
const currentPort = Number(window.location.port) || 80
|
|
134
136
|
|
|
135
137
|
const tools = MCP_TOOL_CATALOG
|
|
136
|
-
.filter((tool) => (!readOnly || !tool.write) && (tool.name !== 'exec_pod' || execTools) && (tool.name !== 'curl_service' || httpTools) && (tool.name !== 'manage_helm' || helmTools) && (!tool.localOnly || (!readOnly && applicationEvidenceAvailable)))
|
|
138
|
+
.filter((tool) => (!readOnly || !tool.write) && (tool.name !== 'exec_pod' || execTools) && (tool.name !== 'curl_service' || httpTools) && (tool.name !== 'manage_helm' || helmTools) && (tool.name !== 'list_vulnerabilities' || vulnerabilityTools) && (!tool.localOnly || (!readOnly && applicationEvidenceAvailable)))
|
|
137
139
|
.map((tool) => readOnly && tool.name === 'diagnose'
|
|
138
140
|
? { ...tool, params: tool.params.filter((param) => param.arg !== 'in_cluster') }
|
|
139
141
|
: tool)
|