@skyhook-io/radar-app 1.22.2 → 1.23.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/package.json +8 -8
- package/src/App.tsx +49 -13
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +151 -27
- package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/poll.ts +78 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +16 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +315 -0
- package/src/api/workloadSource.ts +128 -12
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +128 -32
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
- package/src/components/helm/HelmView.tsx +4 -3
- package/src/components/helm/ObservedHelmNotice.tsx +39 -17
- package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +3 -3
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +4 -4
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/issues/uncheckedSources.test.ts +8 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/nudges/activeNudges.test.ts +39 -0
- package/src/components/nudges/activeNudges.ts +76 -0
- package/src/components/poll/OssPoll.tsx +871 -0
- package/src/components/poll/mount.test.ts +12 -0
- package/src/components/poll/pollCloud.test.ts +23 -0
- package/src/components/poll/pollCloud.ts +6 -0
- package/src/components/poll/pollDefinition.ts +93 -0
- package/src/components/poll/pollFlow.test.ts +140 -0
- package/src/components/poll/pollFlow.ts +137 -0
- package/src/components/poll/pollSender.test.ts +137 -0
- package/src/components/poll/pollSender.ts +76 -0
- package/src/components/poll/pollStorage.test.ts +53 -0
- package/src/components/poll/pollStorage.ts +77 -0
- package/src/components/poll/round.json +350 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
- package/src/components/resources/ImageFilesystemModal.tsx +42 -3
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +24 -11
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/ui/UpdateNotification.tsx +2 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/whats-new/WhatsNew.tsx +2 -0
- package/src/components/whats-new/releaseNotes.ts +75 -1
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +52 -13
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
6
|
+
import { SeeTrafficLink, liveTrafficSearch } from './traffic'
|
|
7
|
+
|
|
8
|
+
const traffic = vi.hoisted(() => ({ available: true }))
|
|
9
|
+
vi.mock('../../api/traffic', () => ({ useTrafficAvailable: (enabled = true) => enabled && traffic.available }))
|
|
10
|
+
|
|
11
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
12
|
+
|
|
13
|
+
let container: HTMLDivElement
|
|
14
|
+
let root: Root
|
|
15
|
+
function Where() {
|
|
16
|
+
const location = useLocation()
|
|
17
|
+
return <output data-testid="location">{location.pathname + location.search}</output>
|
|
18
|
+
}
|
|
19
|
+
const at = () => container.querySelector('[data-testid="location"]')!.textContent
|
|
20
|
+
|
|
21
|
+
function render(kind: string, container_?: string) {
|
|
22
|
+
act(() => root.render(
|
|
23
|
+
<MemoryRouter initialEntries={['/checks/vulnerabilities?by=workload&namespaces=shop']}>
|
|
24
|
+
<Routes><Route path="*" element={<><Where /><SeeTrafficLink workload={{ kind, group: 'apps', namespace: 'shop', name: 'web', container: container_ }} /></>} /></Routes>
|
|
25
|
+
</MemoryRouter>,
|
|
26
|
+
))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
traffic.available = true
|
|
31
|
+
container = document.createElement('div')
|
|
32
|
+
document.body.appendChild(container)
|
|
33
|
+
root = createRoot(container)
|
|
34
|
+
})
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
act(() => root.unmount())
|
|
37
|
+
container.remove()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
describe('See traffic', () => {
|
|
41
|
+
it('opens Live Traffic focused on the workload, keeping the namespace scope', () => {
|
|
42
|
+
render('Deployment')
|
|
43
|
+
const link = container.querySelector('button')!
|
|
44
|
+
expect(link.textContent).toBe('See traffic')
|
|
45
|
+
act(() => link.click())
|
|
46
|
+
expect(at()).toBe('/traffic?namespaces=shop&focus=shop%2Fweb')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('is not offered without an available traffic source', () => {
|
|
50
|
+
traffic.available = false
|
|
51
|
+
render('Deployment')
|
|
52
|
+
expect(container.querySelector('button')).toBeNull()
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('is not offered for a kind the map does not draw as one node, or for a container', () => {
|
|
56
|
+
render('Job')
|
|
57
|
+
expect(container.querySelector('button')).toBeNull()
|
|
58
|
+
render('Deployment', 'app')
|
|
59
|
+
expect(container.querySelector('button')).toBeNull()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('builds the focus without a scope when the page has none', () => {
|
|
63
|
+
expect(liveTrafficSearch({ kind: 'Deployment', group: 'apps', namespace: 'a', name: 'b' }, null)).toBe('focus=a%2Fb')
|
|
64
|
+
})
|
|
65
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
2
|
+
import { useTrafficAvailable } from '../../api/traffic'
|
|
3
|
+
import type { VulnerabilityWorkloadRef } from '../../api/vulnerabilities'
|
|
4
|
+
|
|
5
|
+
// The kinds Live Traffic draws as one node, so a focus on one of them finds
|
|
6
|
+
// it. A Job is left out: the map groups a controlled Job's pods under its
|
|
7
|
+
// owner, and the row can't tell whether something controls it.
|
|
8
|
+
const TRAFFIC_KINDS = new Set(['Deployment', 'StatefulSet', 'DaemonSet', 'CronJob', 'Rollout'])
|
|
9
|
+
|
|
10
|
+
export function liveTrafficSearch(w: VulnerabilityWorkloadRef, namespaces: string | null): string {
|
|
11
|
+
const params = new URLSearchParams()
|
|
12
|
+
if (namespaces) params.set('namespaces', namespaces)
|
|
13
|
+
params.set('focus', `${w.namespace}/${w.name}`)
|
|
14
|
+
return params.toString()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* "See traffic": opens Live Traffic focused on an exposed workload. Offered
|
|
19
|
+
* only once a traffic source is known to be available, so the page never
|
|
20
|
+
* links to an empty map. It makes no claim about who reached the workload.
|
|
21
|
+
*/
|
|
22
|
+
export function SeeTrafficLink({ workload }: { workload: VulnerabilityWorkloadRef }) {
|
|
23
|
+
const offered = TRAFFIC_KINDS.has(workload.kind) && !workload.container
|
|
24
|
+
const available = useTrafficAvailable(offered)
|
|
25
|
+
const navigate = useNavigate()
|
|
26
|
+
const [searchParams] = useSearchParams()
|
|
27
|
+
if (!offered || !available) return null
|
|
28
|
+
return (
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
onClick={(e) => {
|
|
32
|
+
e.stopPropagation()
|
|
33
|
+
navigate({ pathname: '/traffic', search: liveTrafficSearch(workload, searchParams.get('namespaces')) })
|
|
34
|
+
}}
|
|
35
|
+
className="text-accent-text hover:underline"
|
|
36
|
+
>
|
|
37
|
+
See traffic
|
|
38
|
+
</button>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from './releaseNotes'
|
|
24
24
|
import type { UsageDataStatus } from '../../api/usage-data'
|
|
25
25
|
import { UsageDataAsk } from '../usage-data/UsageDataAsk'
|
|
26
|
+
import { useNudgeVisible } from '../nudges/activeNudges'
|
|
26
27
|
|
|
27
28
|
const LAST_SEEN_KEY = 'radar-whats-new-seen'
|
|
28
29
|
const PREVIEW_PARAM = 'whats-new'
|
|
@@ -162,6 +163,7 @@ export function WhatsNew({ onNavigate, usageData }: WhatsNewProps) {
|
|
|
162
163
|
const decidedRef = useRef(false)
|
|
163
164
|
const { pathname } = useLocation()
|
|
164
165
|
const titleId = useId()
|
|
166
|
+
useNudgeVisible('whats-new', open)
|
|
165
167
|
|
|
166
168
|
const currentVersion = state?.currentVersion
|
|
167
169
|
const previewParam = searchParams.get(PREVIEW_PARAM)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react'
|
|
2
|
-
import { Activity, BellOff, Bot, Boxes, Braces, Bug, ChartLine, Database, Download, GitBranch, GitCompareArrows, HardDrive, History, Hourglass, Layers, MessageCircleQuestionMark, Network, RefreshCcw, Scale, ScanSearch, ScrollText, Search, ShieldAlert, SlidersHorizontal, Undo2, Zap } from 'lucide-react'
|
|
2
|
+
import { Activity, BellOff, Bot, Boxes, Braces, Bug, ChartLine, Database, Download, GitBranch, GitCommitHorizontal, GitCompareArrows, HardDrive, History, Hourglass, Layers, Link2, MessageCircleQuestionMark, Network, RefreshCcw, Scale, ScanSearch, ScrollText, Search, ShieldAlert, SlidersHorizontal, Undo2, Zap } from 'lucide-react'
|
|
3
3
|
import { compareVersions } from '../../utils/version'
|
|
4
4
|
|
|
5
5
|
export interface ReleaseHighlight {
|
|
@@ -48,6 +48,80 @@ export const CHANGELOG_URL = 'https://radarhq.io/changelog'
|
|
|
48
48
|
// major release must have its own entry: scripts/check-whats-new.sh refuses to
|
|
49
49
|
// release one without it.
|
|
50
50
|
export const RELEASE_NOTES: ReleaseNotes[] = [
|
|
51
|
+
{
|
|
52
|
+
version: 'v1.23.0',
|
|
53
|
+
highlights: [
|
|
54
|
+
{
|
|
55
|
+
id: 'running-code',
|
|
56
|
+
icon: GitCommitHorizontal,
|
|
57
|
+
title: 'See which commit each workload runs',
|
|
58
|
+
description: 'Workloads name the commit each image runs and how Radar knows. Applications compare commits across environments; Deploys mark code changes.',
|
|
59
|
+
leadDescription: "A new Source section names the repository and commit each container runs when its image records them, says how Radar knows, and shows the revision Argo CD or Flux last deployed beside it. Applications compare running commits across environments, Deploys and Timeline mark code changes and, when Radar can tell, which client set the image, and MCP agents can read the same evidence. When an image doesn't record its commit, Radar says so and shows how to add it.",
|
|
60
|
+
importance: 8,
|
|
61
|
+
path: '/applications',
|
|
62
|
+
cta: 'Open Applications',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'agent-runtime-workspaces',
|
|
66
|
+
icon: Bot,
|
|
67
|
+
title: 'Workspaces for kagent, Agent Sandbox and Agent Substrate',
|
|
68
|
+
description: "See which kagent Agents can't start and why, which Sandboxes and claims are broken, and, with Substrate API access, where each actor runs.",
|
|
69
|
+
importance: 7,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'vulnerability-pod-risk',
|
|
73
|
+
icon: ShieldAlert,
|
|
74
|
+
title: 'Prioritize CVEs by Pod risk',
|
|
75
|
+
description: 'Filter Vulnerabilities by Pod risk, such as privileged or running as root, or by OS end of life, and see who owns affected workloads.',
|
|
76
|
+
importance: 7,
|
|
77
|
+
path: '/checks/vulnerabilities',
|
|
78
|
+
cta: 'Open Vulnerabilities',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'issues-new-and-grouped',
|
|
82
|
+
icon: Activity,
|
|
83
|
+
title: 'New issues marked, repeat issues grouped',
|
|
84
|
+
description: 'Issues marks what started since your last visit. A missing node label blocking many workloads, or a Job created on every run, is one issue.',
|
|
85
|
+
importance: 6,
|
|
86
|
+
path: '/issues',
|
|
87
|
+
cta: 'Open Issues',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'calico-live-traffic',
|
|
91
|
+
icon: Network,
|
|
92
|
+
title: 'Calico in Live Traffic',
|
|
93
|
+
description: 'With Calico 3.30+ and Goldmane running, Live Traffic shows bytes each way, the Service used, and the policy that denied a connection.',
|
|
94
|
+
importance: 6,
|
|
95
|
+
path: '/traffic',
|
|
96
|
+
cta: 'Open Live Traffic',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'reviewed-actions-evict',
|
|
100
|
+
icon: ScanSearch,
|
|
101
|
+
title: 'Know what manages a workload before you change it, and evict Pods',
|
|
102
|
+
description: 'Scale names the HPA or KEDA object in charge; restart, rollback and CronJob changes name Argo CD or Flux. Pods get Evict, through the eviction API.',
|
|
103
|
+
importance: 6,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'custom-relationship-rules',
|
|
107
|
+
icon: Link2,
|
|
108
|
+
title: 'Link your own CRDs with relationship rules',
|
|
109
|
+
description: 'Say which field of your CRD names another object, and Radar shows the link in Related Resources, Topology and MCP.',
|
|
110
|
+
importance: 6,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
improvements: [
|
|
114
|
+
// The grid fills row by row: pair lines of similar length.
|
|
115
|
+
'MCP: get_cluster_overview replaces get_dashboard and reads its problems from Issues',
|
|
116
|
+
'Codex can apply a confirmed Diagnose fix, and AI answers no longer load remote images',
|
|
117
|
+
'Topology routes edges around cards with readable labels, and shows ReplicaSets that nothing owns',
|
|
118
|
+
'Radar says when the API server stops answering, and ends logs and terminals whose connection closed',
|
|
119
|
+
'NetworkPolicy drawers show one card per rule; Reachability names the policy that refused its probe Pod',
|
|
120
|
+
'Fewer false alarms for CoreDNS rewrite and template rules and for Pod volumes no container mounts',
|
|
121
|
+
'Copy a link to any resource or open issue from its header',
|
|
122
|
+
'Caretta Live Traffic shows bytes for the selected time range',
|
|
123
|
+
],
|
|
124
|
+
},
|
|
51
125
|
{
|
|
52
126
|
version: 'v1.22.0',
|
|
53
127
|
highlights: [
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
5
|
+
import { onlineManager, QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
6
|
+
import { DockProvider, ToastProvider } from '@skyhook-io/k8s-ui'
|
|
7
|
+
import { expect, it, vi } from 'vitest'
|
|
8
|
+
import { getApiBase } from '../../api/config'
|
|
9
|
+
import { ConnectionProvider } from '../../context/ConnectionContext'
|
|
10
|
+
import { KeyboardShortcutProvider } from '../../hooks/useKeyboardShortcuts'
|
|
11
|
+
import { NavCustomizationProvider } from '../../context/NavCustomization'
|
|
12
|
+
import { WorkloadView } from './WorkloadView'
|
|
13
|
+
|
|
14
|
+
vi.mock('../logs/LogsViewer', () => ({ LogsViewer: () => <div>Pod logs</div> }))
|
|
15
|
+
|
|
16
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
17
|
+
|
|
18
|
+
const pool = {
|
|
19
|
+
apiVersion: 'ate.dev/v1alpha1',
|
|
20
|
+
kind: 'WorkerPool',
|
|
21
|
+
metadata: { namespace: 'agents', name: 'pool' },
|
|
22
|
+
}
|
|
23
|
+
const pod = {
|
|
24
|
+
apiVersion: 'v1',
|
|
25
|
+
kind: 'Pod',
|
|
26
|
+
metadata: { namespace: 'agents', name: 'worker', labels: { 'ate.dev/worker-pool': 'pool' } },
|
|
27
|
+
spec: { containers: [{ name: 'worker' }] },
|
|
28
|
+
status: { phase: 'Succeeded' },
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
it.each([false, true])('renders worker resources for a Radar advertising substrateWorkspace=%s', async (workspace) => {
|
|
32
|
+
const client = new QueryClient()
|
|
33
|
+
client.setQueryData(['capabilities'], { features: {
|
|
34
|
+
substrateHealthMetrics: true,
|
|
35
|
+
...(workspace ? { substrateWorkspace: true } : {}),
|
|
36
|
+
} })
|
|
37
|
+
client.setQueryData(['prometheus-status'], { connected: true })
|
|
38
|
+
client.setQueryData(['substrate-health', getApiBase(), undefined, 'workerpool', 'agents', 'pool', '1h'], {
|
|
39
|
+
status: 'available', verdict: { state: 'freeActorSlots', facts: [] }, charts: [],
|
|
40
|
+
})
|
|
41
|
+
client.setQueryData(['resource', 'workerpools', 'agents', 'pool', 'ate.dev'], { resource: pool })
|
|
42
|
+
client.setQueryData(['resource', 'pods', 'agents', 'worker', undefined], {
|
|
43
|
+
resource: pod,
|
|
44
|
+
relationships: { pods: [{ kind: 'Pod', namespace: 'agents', name: 'worker' }] },
|
|
45
|
+
})
|
|
46
|
+
const host = document.createElement('div')
|
|
47
|
+
const root = createRoot(host)
|
|
48
|
+
const wasOnline = onlineManager.isOnline()
|
|
49
|
+
onlineManager.setOnline(false)
|
|
50
|
+
|
|
51
|
+
async function render(kind: 'workerpools' | 'pods', tab: 'detail' | 'metrics' | 'logs') {
|
|
52
|
+
const group = kind === 'workerpools' ? 'ate.dev' : undefined
|
|
53
|
+
const name = kind === 'workerpools' ? 'pool' : 'worker'
|
|
54
|
+
const path = `/workload/${kind}/agents/${name}${tab === 'detail' ? '' : `?tab=${tab}`}`
|
|
55
|
+
await act(async () => root.render(
|
|
56
|
+
<QueryClientProvider client={client}>
|
|
57
|
+
<MemoryRouter key={path} initialEntries={[path]}>
|
|
58
|
+
<NavCustomizationProvider value={{ embedded: true }}>
|
|
59
|
+
<ConnectionProvider><ToastProvider><DockProvider><KeyboardShortcutProvider>
|
|
60
|
+
<WorkloadView kind={kind} group={group} namespace="agents" name={name} expanded onBack={() => {}} />
|
|
61
|
+
</KeyboardShortcutProvider></DockProvider></ToastProvider></ConnectionProvider>
|
|
62
|
+
</NavCustomizationProvider>
|
|
63
|
+
</MemoryRouter>
|
|
64
|
+
</QueryClientProvider>,
|
|
65
|
+
))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
await render('workerpools', 'detail')
|
|
70
|
+
expect(Boolean(host.querySelector('[aria-label="Agent Substrate capacity"]'))).toBe(!workspace)
|
|
71
|
+
expect(host.textContent?.includes('Placement capacity')).toBe(workspace)
|
|
72
|
+
|
|
73
|
+
await render('pods', 'detail')
|
|
74
|
+
expect(host.textContent?.includes('Pod logs, metrics and restarts cover the shared worker process.')).toBe(workspace)
|
|
75
|
+
expect(host.textContent?.includes('Substrate places actors on this Pod in turn')).toBe(!workspace)
|
|
76
|
+
|
|
77
|
+
for (const tab of ['metrics', 'logs'] as const) {
|
|
78
|
+
await render('pods', tab)
|
|
79
|
+
expect(host.querySelector('[role="tab"][aria-selected="true"]')?.textContent?.toLowerCase()).toBe(tab)
|
|
80
|
+
expect(host.textContent?.includes(`These ${tab} cover the shared worker Pod`)).toBe(workspace)
|
|
81
|
+
expect(host.textContent?.includes('View assigned actors')).toBe(workspace)
|
|
82
|
+
}
|
|
83
|
+
} finally {
|
|
84
|
+
act(() => root.unmount())
|
|
85
|
+
client.clear()
|
|
86
|
+
onlineManager.setOnline(wasOnline)
|
|
87
|
+
}
|
|
88
|
+
})
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { podDebugAccessKey } from '../../api/podDebug'
|
|
2
|
+
import { SUBSTRATE_WORKER_POOL_LABEL } from '@skyhook-io/k8s-ui/components/resources/resource-utils-agent-runtimes'
|
|
3
|
+
import { SubstrateWorkerPodScope } from '../substrate/SubstrateWorkerPodContext'
|
|
4
|
+
import { PoolSpecStatus } from '../substrate/SubstratePoolSummary'
|
|
2
5
|
import { supportsWorkloadRevisions, WorkloadRevisionsButton } from './WorkloadRevisionsButton'
|
|
3
6
|
import { RelatedFindingsSection } from './RelatedFindingsSection'
|
|
4
7
|
import { decorateResourceDiagnose, resourceDetailRedirect, resourceDetailSlots, resourceIssueDetail, resourceLogs, resourceRendererOverrides } from '../../integrations/resourceHosts'
|
|
@@ -164,6 +167,8 @@ import { useDesktopDownload } from '../../hooks/useDesktopDownload'
|
|
|
164
167
|
import { useCompareLauncher } from '../compare/useCompareLauncher'
|
|
165
168
|
import { useDiagnoseCustomization } from '../../context/DiagnoseCustomization'
|
|
166
169
|
import { NodeDrainStatus } from './NodeDrainStatus'
|
|
170
|
+
import { ShareLinkButton } from '../share/ShareLinkButton'
|
|
171
|
+
import { drawerSharePath } from '../share/shareLink'
|
|
167
172
|
import { SubstrateHealthCharts } from '../resource/SubstrateHealthCharts'
|
|
168
173
|
import { SubstrateVerdictLine } from '../resource/SubstrateVerdictLine'
|
|
169
174
|
import { useAPIResources } from '../../api/apiResources'
|
|
@@ -219,6 +224,8 @@ interface WorkloadViewRouteProps {
|
|
|
219
224
|
}
|
|
220
225
|
|
|
221
226
|
export function WorkloadViewRoute({ onNavigateToResource }: WorkloadViewRouteProps) {
|
|
227
|
+
const { support: substrateWorkspace } = useRadarFeature('substrateWorkspace')
|
|
228
|
+
const { support: kagentWorkspace } = useRadarFeature('kagentWorkspace')
|
|
222
229
|
const location = useLocation()
|
|
223
230
|
const navigate = useNavigate()
|
|
224
231
|
const [searchParams] = useSearchParams()
|
|
@@ -278,7 +285,7 @@ export function WorkloadViewRoute({ onNavigateToResource }: WorkloadViewRoutePro
|
|
|
278
285
|
)
|
|
279
286
|
}
|
|
280
287
|
|
|
281
|
-
const detailPath = resourceDetailRedirect({ kind, group, namespace, name }, searchParams)
|
|
288
|
+
const detailPath = resourceDetailRedirect({ kind, group, namespace, name }, searchParams, { substrateWorkspace, kagentWorkspace })
|
|
282
289
|
if (detailPath) return <Navigate replace to={detailPath} state={location.state} />
|
|
283
290
|
|
|
284
291
|
return (
|
|
@@ -322,6 +329,9 @@ interface WorkloadViewProps {
|
|
|
322
329
|
pushTabHistory?: boolean
|
|
323
330
|
breadcrumb?: ReactNode
|
|
324
331
|
extraTabs?: WorkloadExtraTab[]
|
|
332
|
+
/** Shown at the top of the Overview tab, after operational issues (an
|
|
333
|
+
* application's Environments panel). */
|
|
334
|
+
overviewLead?: ReactNode
|
|
325
335
|
tabOrder?: string[]
|
|
326
336
|
subheader?: ReactNode
|
|
327
337
|
specTab?: { label?: string; icon?: ReactNode; lead?: ReactNode; render?: () => ReactNode }
|
|
@@ -333,6 +343,9 @@ interface WorkloadViewProps {
|
|
|
333
343
|
onRefresh?: () => Promise<unknown>
|
|
334
344
|
hideKindBadge?: boolean
|
|
335
345
|
truncateName?: boolean
|
|
346
|
+
/** 'page' (default): the address names this resource, so Copy link copies it.
|
|
347
|
+
* 'drawer': the resource drawer, which is in the address only on /resources. */
|
|
348
|
+
shareLink?: 'page' | 'drawer'
|
|
336
349
|
}
|
|
337
350
|
|
|
338
351
|
interface ImageTargetOwnershipContext {
|
|
@@ -620,10 +633,16 @@ export function WorkloadView({
|
|
|
620
633
|
name,
|
|
621
634
|
expanded = true,
|
|
622
635
|
pushTabHistory = false,
|
|
636
|
+
overviewLead,
|
|
637
|
+
shareLink = 'page',
|
|
623
638
|
...rest
|
|
624
639
|
}: WorkloadViewProps) {
|
|
625
640
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
626
641
|
const location = useLocation()
|
|
642
|
+
const sharePath =
|
|
643
|
+
shareLink === 'drawer'
|
|
644
|
+
? drawerSharePath({ kind: kindProp, group: rest.group, namespace, name }, location)
|
|
645
|
+
: `${location.pathname}${location.search}`
|
|
627
646
|
const viewNamespacesKey = namespacesFromSearch(searchParams).join(',')
|
|
628
647
|
const viewNamespaces = useMemo(() => (viewNamespacesKey ? viewNamespacesKey.split(',') : []), [viewNamespacesKey])
|
|
629
648
|
const apiKind = kindToPluralWithGroup(kindProp, rest.group ?? '')
|
|
@@ -714,6 +733,8 @@ export function WorkloadView({
|
|
|
714
733
|
// '' whenever a link left ?apiGroup out.
|
|
715
734
|
const identityGroup = resource?.apiVersion ? resourceGroup : effectiveGroup
|
|
716
735
|
const isNode = apiKind === 'nodes' && !effectiveGroup
|
|
736
|
+
const { support: substrateWorkspace } = useRadarFeature('substrateWorkspace')
|
|
737
|
+
const substratePodPool = apiKind === 'pods' && substrateWorkspace !== 'unsupported' ? resource?.metadata?.labels?.[SUBSTRATE_WORKER_POOL_LABEL] : undefined
|
|
717
738
|
const isSubstrateWorkerPool = apiKind === 'workerpools' && effectiveGroup === SUBSTRATE_GROUP
|
|
718
739
|
// Substrate's node charts are asked of Prometheus only on a cluster that serves it.
|
|
719
740
|
const { data: apiResources } = useAPIResources()
|
|
@@ -878,6 +899,7 @@ export function WorkloadView({
|
|
|
878
899
|
// RBAC
|
|
879
900
|
const canUpdateSecrets = useCanUpdateSecrets()
|
|
880
901
|
const { features, karpenter } = useCapabilitiesContext()
|
|
902
|
+
const { support: kagentWorkspace } = useRadarFeature('kagentWorkspace')
|
|
881
903
|
const { canPortForward } = useNamespacedCapabilities(namespace)
|
|
882
904
|
const isLocalDeployment = useIsLocalDeployment()
|
|
883
905
|
const showServingPortForward = canPortForward || !isLocalDeployment
|
|
@@ -1383,6 +1405,7 @@ export function WorkloadView({
|
|
|
1383
1405
|
[servingRefs, servingQueries],
|
|
1384
1406
|
)
|
|
1385
1407
|
|
|
1408
|
+
const detailSlots = resourceDetailSlots({ kind: apiKind, group: identityGroup, namespace, name }, rest.extraTabs, { substrateWorkspace, kagentWorkspace })
|
|
1386
1409
|
return (
|
|
1387
1410
|
<>
|
|
1388
1411
|
<BaseWorkloadView
|
|
@@ -1391,6 +1414,9 @@ export function WorkloadView({
|
|
|
1391
1414
|
name={name}
|
|
1392
1415
|
expanded={expanded}
|
|
1393
1416
|
{...rest}
|
|
1417
|
+
renderShareAction={() => (
|
|
1418
|
+
<ShareLinkButton path={sharePath} subject={{ kind: resource?.kind ?? pluralToKind(apiKind), group: effectiveGroup, namespace, name }} />
|
|
1419
|
+
)}
|
|
1394
1420
|
group={effectiveGroup}
|
|
1395
1421
|
// Data
|
|
1396
1422
|
resource={resource}
|
|
@@ -1468,7 +1494,8 @@ export function WorkloadView({
|
|
|
1468
1494
|
viewNamespaces={viewNamespaces}
|
|
1469
1495
|
/>
|
|
1470
1496
|
)}
|
|
1471
|
-
{...
|
|
1497
|
+
{...detailSlots}
|
|
1498
|
+
breadcrumb={rest.breadcrumb ?? detailSlots.breadcrumb}
|
|
1472
1499
|
onSelectTopologyMember={batchExecution && batchKind === 'JobSet' ? handleSelectTopologyMember : undefined}
|
|
1473
1500
|
renderExpandedOverview={({ kind: k, apiKind, namespace: ns, name: n, resource: res, leadContent }) =>
|
|
1474
1501
|
supportsBatchExecution(k, apiKind, effectiveGroup, res?.apiVersion) &&
|
|
@@ -1509,6 +1536,11 @@ export function WorkloadView({
|
|
|
1509
1536
|
collapsible={!expanded}
|
|
1510
1537
|
workerPods={typeof resource?.status?.replicas === 'number' ? resource.status.replicas : undefined}
|
|
1511
1538
|
/>
|
|
1539
|
+
) : substratePodPool ? (
|
|
1540
|
+
<div className="flex h-full min-h-0 flex-col gap-2">
|
|
1541
|
+
<SubstrateWorkerPodScope namespace={ns} pool={substratePodPool} pod={n} tab="metrics" />
|
|
1542
|
+
<div className="min-h-0 flex-1 overflow-auto"><MetricsTabContent kind={kind} namespace={ns} name={n} resource={resource} expanded={expanded} /></div>
|
|
1543
|
+
</div>
|
|
1512
1544
|
) : (
|
|
1513
1545
|
<>
|
|
1514
1546
|
<MetricsTabContent
|
|
@@ -1557,7 +1589,8 @@ export function WorkloadView({
|
|
|
1557
1589
|
onDownload={desktopDownload}
|
|
1558
1590
|
actionsBarProps={actionsBarProps}
|
|
1559
1591
|
rendererOverrides={resourceRendererOverrides}
|
|
1560
|
-
|
|
1592
|
+
specTab={isSubstrateWorkerPool && resource ? { render: () => <PoolSpecStatus resource={resource} onNavigate={rest.onNavigateToResource} /> } : rest.specTab}
|
|
1593
|
+
renderOverviewIntro={isSubstrateWorkerPool && substrateWorkspace === 'unsupported'
|
|
1561
1594
|
? ({ namespace: ns, name: n }) => <SubstrateVerdictLine target={{ kind: 'workerpool', namespace: ns, name: n }} onOpenMetrics={expanded ? () => handleTabChange('metrics') : undefined} />
|
|
1562
1595
|
: isNode && resource?.metadata?.uid
|
|
1563
1596
|
? () => (
|
|
@@ -1623,9 +1656,10 @@ export function WorkloadView({
|
|
|
1623
1656
|
rowChanges={issueRowNotes.rowChanges}
|
|
1624
1657
|
onVisibleIssuesChange={issueRowNotes.onVisibleIssuesChange}
|
|
1625
1658
|
/>
|
|
1659
|
+
{overviewLead}
|
|
1626
1660
|
</div>
|
|
1627
1661
|
)}
|
|
1628
|
-
hasOverviewLead={hasOperationalIssues || Boolean(schedulingEvidence && schedulingEvidence.state !== 'reported') || nodeCertificateContextVisible(certificateEvidence, hasCertificateIssue)}
|
|
1662
|
+
hasOverviewLead={Boolean(overviewLead) || hasOperationalIssues || Boolean(schedulingEvidence && schedulingEvidence.state !== 'reported') || nodeCertificateContextVisible(certificateEvidence, hasCertificateIssue)}
|
|
1629
1663
|
hasOperationalIssues={hasOperationalIssues}
|
|
1630
1664
|
operationalIssuesPending={issuesPending}
|
|
1631
1665
|
// A manager answer's chip links only managers the server found; a
|
|
@@ -1926,16 +1960,21 @@ function PodLogsTab({
|
|
|
1926
1960
|
}
|
|
1927
1961
|
}, [initialContainer, containers, onConsumeInitialContainer])
|
|
1928
1962
|
|
|
1963
|
+
const { support: substrateWorkspace } = useRadarFeature('substrateWorkspace')
|
|
1964
|
+
const pool = resource?.metadata?.labels?.[SUBSTRATE_WORKER_POOL_LABEL]
|
|
1929
1965
|
return (
|
|
1930
|
-
<div className="h-full">
|
|
1931
|
-
<
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1966
|
+
<div className="flex h-full min-h-0 flex-col">
|
|
1967
|
+
{pool && substrateWorkspace !== 'unsupported' && <div className="border-b-subtle px-4 py-2"><SubstrateWorkerPodScope namespace={namespace} pool={pool} pod={name} tab="logs" /></div>}
|
|
1968
|
+
<div className="min-h-0 flex-1">
|
|
1969
|
+
<LogsViewer
|
|
1970
|
+
namespace={namespace}
|
|
1971
|
+
podName={name}
|
|
1972
|
+
containers={containers}
|
|
1973
|
+
initialContainer={initialContainer || getDefaultLogContainerName(resource)}
|
|
1974
|
+
initContainers={initContainers}
|
|
1975
|
+
autoStream={autoStream}
|
|
1976
|
+
/>
|
|
1977
|
+
</div>
|
|
1939
1978
|
</div>
|
|
1940
1979
|
)
|
|
1941
1980
|
}
|
|
@@ -5,7 +5,7 @@ import { AlertTriangle, X } from 'lucide-react'
|
|
|
5
5
|
import { Tooltip, formatUpdatedAgo, grantParts, toneTextClass, type Grant } from '@skyhook-io/k8s-ui'
|
|
6
6
|
import type { SelectedResource } from '../../types'
|
|
7
7
|
import { sameSelectedResource } from '../../utils/drawer-trail'
|
|
8
|
-
import { ROW_HOVER, TABLE_HEAD, TABLE_WRAP, TBODY, TD, TH } from './table'
|
|
8
|
+
import { ROW_HOVER, TABLE_HEAD, TABLE_WRAP, TBODY, TD, TH, TH_BASE } from './table'
|
|
9
9
|
|
|
10
10
|
export function Notice({ children }: { children: ReactNode }) {
|
|
11
11
|
return (
|
|
@@ -126,6 +126,8 @@ export function SectionTable<T>({
|
|
|
126
126
|
inspected,
|
|
127
127
|
empty,
|
|
128
128
|
minWidth = 760,
|
|
129
|
+
wrapHeaders = false,
|
|
130
|
+
framed = true,
|
|
129
131
|
footer,
|
|
130
132
|
}: {
|
|
131
133
|
/** Left out where the page heading already names the table. */
|
|
@@ -139,15 +141,19 @@ export function SectionTable<T>({
|
|
|
139
141
|
inspected?: SelectedResource | null
|
|
140
142
|
empty: ReactNode
|
|
141
143
|
minWidth?: number
|
|
144
|
+
wrapHeaders?: boolean
|
|
145
|
+
framed?: boolean
|
|
142
146
|
footer?: ReactNode
|
|
143
147
|
}) {
|
|
144
148
|
return (
|
|
145
149
|
<section>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
{(title || subtitle) && (
|
|
151
|
+
<div className="mb-2 flex flex-wrap items-baseline gap-x-2.5 gap-y-1">
|
|
152
|
+
{title && <h2 className="text-sm font-semibold text-theme-text-primary">{title}</h2>}
|
|
153
|
+
{subtitle && <span className="text-xs text-theme-text-tertiary">{subtitle}</span>}
|
|
154
|
+
</div>
|
|
155
|
+
)}
|
|
156
|
+
<div className={clsx(framed && 'overflow-hidden rounded-xl border border-theme-border bg-theme-surface shadow-theme-sm')}>
|
|
151
157
|
{rows.length === 0 ? (
|
|
152
158
|
<div className="px-4 py-5 text-sm text-theme-text-tertiary">{empty}</div>
|
|
153
159
|
) : (
|
|
@@ -161,7 +167,7 @@ export function SectionTable<T>({
|
|
|
161
167
|
<thead className={TABLE_HEAD}>
|
|
162
168
|
<tr>
|
|
163
169
|
{columns.map((c, i) => (
|
|
164
|
-
<th key={i} className={TH}>{c.header}</th>
|
|
170
|
+
<th key={i} className={wrapHeaders ? `${TH_BASE} whitespace-normal` : TH}>{c.header}</th>
|
|
165
171
|
))}
|
|
166
172
|
</tr>
|
|
167
173
|
</thead>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import type { SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { mergeSidebarWorkspaces } from './sidebar'
|
|
4
|
+
|
|
5
|
+
const part = (tools: string, section: string, over: Partial<SidebarCategoryWorkspace> = {}): SidebarCategoryWorkspace => ({
|
|
6
|
+
tools,
|
|
7
|
+
destinations: [{ id: `${section}-overview`, label: 'Overview', section, onSelect: () => {} }],
|
|
8
|
+
...over,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
describe('mergeSidebarWorkspaces', () => {
|
|
12
|
+
it('is undefined when no integration applies, and passes a lone workspace through as it is', () => {
|
|
13
|
+
expect(mergeSidebarWorkspaces([undefined, undefined])).toBeUndefined()
|
|
14
|
+
const velero = { Velero: part('Velero', 'Velero', { label: 'Backups' }) }
|
|
15
|
+
const agents = { Agents: part('Agent Sandbox', 'Sandbox', { count: 2 }) }
|
|
16
|
+
const merged = mergeSidebarWorkspaces([velero, undefined, agents])!
|
|
17
|
+
expect(merged.Velero).toBe(velero.Velero)
|
|
18
|
+
expect(merged.Agents).toBe(agents.Agents)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('combines tools sharing a category into one row: both tools beneath, destinations one tool after another', () => {
|
|
22
|
+
const merged = mergeSidebarWorkspaces([
|
|
23
|
+
{ Agents: part('Agent Substrate', 'Substrate', { count: 3, countTitle: '3 attention items.' }) },
|
|
24
|
+
{ Agents: part('Agent Sandbox', 'Sandbox', { count: 2, countTitle: '2 attention items.', countScope: 'namespace payments', scopeNote: 'Counts for namespace payments' }) },
|
|
25
|
+
])!.Agents
|
|
26
|
+
expect(merged.tools).toBe('Agent Substrate · Agent Sandbox')
|
|
27
|
+
expect(merged.destinations.map((d) => d.id)).toEqual(['Substrate-overview', 'Sandbox-overview'])
|
|
28
|
+
expect(merged).toMatchObject({ count: 5, countLowerBound: false })
|
|
29
|
+
expect(merged.countTitle).toBe('Attention items — Substrate: 3 · cluster-wide · Sandbox: 2 · namespace payments')
|
|
30
|
+
// Only Sandbox's counts follow the namespace filter, so the note says whose they are.
|
|
31
|
+
expect(merged.scopeNote).toBe('Agent Sandbox: Counts for namespace payments · Agent Substrate: cluster-wide')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('adds up to a lower bound when either part is one or is unknown, and to unknown when nothing was found', () => {
|
|
35
|
+
const merge = (a: Partial<SidebarCategoryWorkspace>, b: Partial<SidebarCategoryWorkspace>) =>
|
|
36
|
+
mergeSidebarWorkspaces([{ Agents: part('A', 'a', a) }, { Agents: part('B', 'b', b) }])!.Agents
|
|
37
|
+
expect(merge({ count: 3, countLowerBound: true }, { count: 2 })).toMatchObject({ count: 5, countLowerBound: true })
|
|
38
|
+
expect(merge({ count: null, countLowerBound: true }, { count: 2 })).toMatchObject({ count: 2, countLowerBound: true })
|
|
39
|
+
expect(merge({ count: null, countLowerBound: true }, { count: 0 })).toMatchObject({ count: null, countLowerBound: true })
|
|
40
|
+
expect(merge({ count: 0 }, { count: 0 })).toMatchObject({ count: 0, countLowerBound: false })
|
|
41
|
+
expect(merge({}, { count: 2 })).toMatchObject({
|
|
42
|
+
count: 2,
|
|
43
|
+
countLowerBound: true,
|
|
44
|
+
countTitle: 'Attention items — A: unknown · B: 2',
|
|
45
|
+
})
|
|
46
|
+
expect(merge({}, {}).count).toBeUndefined()
|
|
47
|
+
})
|
|
48
|
+
})
|
|
@@ -3,7 +3,77 @@ import type { SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
|
|
|
3
3
|
|
|
4
4
|
type Workspaces = Record<string, SidebarCategoryWorkspace>
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The Resources sidebar category the agent runtimes' kinds are listed under
|
|
8
|
+
* (api-resources.ts). Agent Substrate, Agent Sandbox and kagent each
|
|
9
|
+
* contribute a workspace to it, merged into one Integrations row.
|
|
10
|
+
*/
|
|
11
|
+
export const AGENTS_SIDEBAR_CATEGORY = 'Agents'
|
|
12
|
+
|
|
13
|
+
/** Integrations' sidebar workspaces as one map; undefined when none applies. */
|
|
14
|
+
export function useMergedSidebarWorkspaces(
|
|
15
|
+
a: Workspaces | undefined,
|
|
16
|
+
b?: Workspaces | undefined,
|
|
17
|
+
c?: Workspaces | undefined,
|
|
18
|
+
d?: Workspaces | undefined,
|
|
19
|
+
e?: Workspaces | undefined,
|
|
20
|
+
): Workspaces | undefined {
|
|
21
|
+
return useMemo(() => mergeSidebarWorkspaces([a, b, c, d, e]), [a, b, c, d, e])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Workspaces keyed by category, where several tools may contribute to one
|
|
26
|
+
* category: their destinations are listed one tool after another, and the
|
|
27
|
+
* row's count adds theirs up.
|
|
28
|
+
*/
|
|
29
|
+
export function mergeSidebarWorkspaces(list: (Workspaces | undefined)[]): Workspaces | undefined {
|
|
30
|
+
if (!list.some(Boolean)) return undefined
|
|
31
|
+
const byCategory = new Map<string, SidebarCategoryWorkspace[]>()
|
|
32
|
+
for (const workspaces of list) {
|
|
33
|
+
for (const [name, w] of Object.entries(workspaces ?? {})) byCategory.set(name, [...(byCategory.get(name) ?? []), w])
|
|
34
|
+
}
|
|
35
|
+
return Object.fromEntries([...byCategory].map(([name, parts]) => [name, parts.length === 1 ? parts[0] : combine(parts)]))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function shortRuntimeName(tools?: string): string | undefined {
|
|
39
|
+
return tools ? tools.replace(/^Agent /, '') : undefined
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function scopeOf(w: SidebarCategoryWorkspace): string | undefined {
|
|
43
|
+
if (w.countScope) return w.countScope
|
|
44
|
+
if (w.tools === 'Agent Substrate') return 'cluster-wide'
|
|
45
|
+
return undefined
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function runtimeCountBreakdown(w: SidebarCategoryWorkspace): string {
|
|
49
|
+
const label = shortRuntimeName(w.tools)
|
|
50
|
+
const val = w.count == null ? 'unknown' : `${w.countLowerBound ? '≥' : ''}${w.count}`
|
|
51
|
+
const scope = scopeOf(w)
|
|
52
|
+
return [label ? `${label}: ${val}` : val, scope].filter(Boolean).join(' · ')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function combine(parts: SidebarCategoryWorkspace[]): SidebarCategoryWorkspace {
|
|
56
|
+
const named = (w: SidebarCategoryWorkspace, text: string) => (w.tools ? `${w.tools}: ${text}` : text)
|
|
57
|
+
const counted = parts.filter((w) => w.count !== undefined)
|
|
58
|
+
const sum = counted.reduce((n, w) => n + (w.count ?? 0), 0)
|
|
59
|
+
const lowerBound = parts.some((w) => w.count == null || w.countLowerBound)
|
|
60
|
+
const breakdown = parts.map(runtimeCountBreakdown).join(' · ')
|
|
61
|
+
const notes = parts.flatMap((w) => (w.scopeNote ? [named(w, w.scopeNote)] : []))
|
|
62
|
+
if (notes.length > 0) {
|
|
63
|
+
for (const w of parts) {
|
|
64
|
+
if (!w.scopeNote && scopeOf(w) === 'cluster-wide' && w.tools) {
|
|
65
|
+
notes.push(`${w.tools}: cluster-wide`)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
label: parts.find((w) => w.label)?.label,
|
|
71
|
+
icon: parts.find((w) => w.icon)?.icon,
|
|
72
|
+
tools: parts.flatMap((w) => (w.tools ? [w.tools] : [])).join(' · ') || undefined,
|
|
73
|
+
destinations: parts.flatMap((w) => w.destinations),
|
|
74
|
+
count: counted.length === 0 ? undefined : sum === 0 && lowerBound ? null : sum,
|
|
75
|
+
countLowerBound: counted.length === 0 ? undefined : lowerBound,
|
|
76
|
+
countTitle: counted.length ? `Attention items — ${breakdown}` : undefined,
|
|
77
|
+
scopeNote: notes.length ? notes.join(' · ') : undefined,
|
|
78
|
+
}
|
|
9
79
|
}
|