@skyhook-io/radar-app 1.22.2 → 1.23.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 +8 -8
- package/src/App.tsx +35 -10
- 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 +122 -24
- 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/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +13 -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 +127 -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/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/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/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/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +2 -6
- 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/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/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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyhook-io/radar-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Radar's full web UI as a reusable React component. Used by Radar's own binary and by external consumers like Radar Cloud.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"diff": "^9.0.0",
|
|
38
38
|
"monaco-editor": "0.57.0",
|
|
39
39
|
"react-markdown": "^10.1.0",
|
|
40
|
-
"react-virtuoso": "^4.18.
|
|
40
|
+
"react-virtuoso": "^4.18.24",
|
|
41
41
|
"remark-gfm": "^4.0.1",
|
|
42
42
|
"shiki": "^4.6.0",
|
|
43
43
|
"yaml": "^2.9.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@skyhook-io/k8s-ui": ">=1.
|
|
46
|
+
"@skyhook-io/k8s-ui": ">=1.22.3",
|
|
47
47
|
"@tanstack/react-query": ">=5",
|
|
48
48
|
"@xyflow/react": ">=12.0.0",
|
|
49
49
|
"clsx": ">=2",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@playwright/test": "^1.64.1",
|
|
60
60
|
"@skyhook-io/k8s-ui": "*",
|
|
61
61
|
"@tailwindcss/vite": "^4.3.5",
|
|
62
|
-
"@tanstack/react-query": "^5.
|
|
62
|
+
"@tanstack/react-query": "^5.108.4",
|
|
63
63
|
"@types/node": "^26.6.6",
|
|
64
|
-
"@types/react": "^19.3.
|
|
64
|
+
"@types/react": "^19.3.3",
|
|
65
65
|
"@types/react-dom": "^19.3.0",
|
|
66
66
|
"@vitejs/plugin-react": "^6.3.0",
|
|
67
67
|
"@xyflow/react": "^12.12.0",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"eslint-plugin-react-refresh": "^0.5.7",
|
|
73
73
|
"globals": "^17.14.0",
|
|
74
74
|
"lucide-react": "^1.48.0",
|
|
75
|
-
"postcss": "^8.5.
|
|
75
|
+
"postcss": "^8.5.34",
|
|
76
76
|
"prettier": "^3.10.1",
|
|
77
|
-
"react": "^19.3.
|
|
78
|
-
"react-dom": "^19.3.
|
|
77
|
+
"react": "^19.3.1",
|
|
78
|
+
"react-dom": "^19.3.1",
|
|
79
79
|
"react-router-dom": "^7.18.5",
|
|
80
80
|
"tailwind-merge": "^3.7.0",
|
|
81
81
|
"tailwindcss": "^4.3.5",
|
package/src/App.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { startViewTransitionSafe } from '@skyhook-io/k8s-ui/utils/view-transitio
|
|
|
5
5
|
import { englishPlural } from '@skyhook-io/k8s-ui/utils/pluralize'
|
|
6
6
|
import { useQueryClient } from '@tanstack/react-query'
|
|
7
7
|
import { useNavigate, useLocation, useSearchParams, useNavigationType, NavigationType } from 'react-router-dom'
|
|
8
|
+
import { issueSubjectParams } from './components/share/shareLink'
|
|
8
9
|
import { HomeView } from './components/home/HomeView'
|
|
9
10
|
import { DebugOverlay } from './components/DebugOverlay'
|
|
10
11
|
import { GlobalDiagnoseButton } from './components/diagnose/LocalDiagnoseAction'
|
|
@@ -59,6 +60,7 @@ import { SyncProgressPanel } from './components/SyncProgressPanel'
|
|
|
59
60
|
import { NoClusterAccessBanner } from './components/NoClusterAccessBanner'
|
|
60
61
|
import { APIUnreachableBanner } from './components/APIUnreachableBanner'
|
|
61
62
|
import { CapabilitiesProvider, useCapabilitiesContext } from './contexts/CapabilitiesContext'
|
|
63
|
+
import { RegistryAccessModeProvider } from './contexts/RegistryAccessMode'
|
|
62
64
|
import { RadarUpgradeProvider } from './context/RadarUpgrade'
|
|
63
65
|
import { UserMenu } from './components/UserMenu'
|
|
64
66
|
import { COMMUNITY_SLACK_URL } from './components/community'
|
|
@@ -89,6 +91,7 @@ import { useTheme } from './context/ThemeContext'
|
|
|
89
91
|
import { Tooltip } from './components/ui/Tooltip'
|
|
90
92
|
import { LargeClusterNamespacePicker } from './components/shared/LargeClusterNamespacePicker'
|
|
91
93
|
import { SettingsDialog, type SettingsSectionId } from './components/settings/SettingsDialog'
|
|
94
|
+
|
|
92
95
|
import type { APIResource, TopologyNode, GroupingMode, MainView, SelectedResource, SelectedHelmRelease, NodeKind, TopologyMode, Topology, K8sEvent } from './types'
|
|
93
96
|
import { createViewMemory } from './utils/viewMemory'
|
|
94
97
|
import { createKindFilterStore } from './utils/kindFilterStore'
|
|
@@ -145,7 +148,7 @@ const FLEET_MODE_KINDS = new Set<NodeKind>([
|
|
|
145
148
|
|
|
146
149
|
// Convert API resource name back to topology node ID prefix
|
|
147
150
|
// Extended MainView type that includes traffic and cost
|
|
148
|
-
type ExtendedMainView = MainView | 'traffic' | 'cost' | 'capacity' | 'cnpg' | 'velero' | 'workload' | 'checks' | 'gitops' | 'compare' | 'helmCompare' | 'issues' | 'applications' | 'investigations'
|
|
151
|
+
type ExtendedMainView = MainView | 'traffic' | 'cost' | 'capacity' | 'cnpg' | 'velero' | 'substrate' | 'agent-sandbox' | 'kagent' | 'workload' | 'checks' | 'gitops' | 'compare' | 'helmCompare' | 'issues' | 'applications' | 'investigations'
|
|
149
152
|
|
|
150
153
|
// Views that have been laid out for phone width (640px and below). The rest
|
|
151
154
|
// keep their desktop width on a phone and scroll sideways; add a view here in
|
|
@@ -745,6 +748,12 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
745
748
|
// Owner-key (pathname + ?app) a non-URL-backed peek was opened on; see
|
|
746
749
|
// navigateToResource and peekOwnerKey.
|
|
747
750
|
const peekOwnerKeyRef = useRef<string | null>(null)
|
|
751
|
+
// The router's location, readable from memoized callbacks. Never use
|
|
752
|
+
// window.location for route comparisons: under a host basename (Radar Hub's
|
|
753
|
+
// /c/<id>) it carries the prefix the router strips, and under the memory
|
|
754
|
+
// router it is the host page's URL.
|
|
755
|
+
const locationRef = useRef(location)
|
|
756
|
+
locationRef.current = location
|
|
748
757
|
const currentResourceKindSlug = normalizedResourcesKindSlug.toLowerCase()
|
|
749
758
|
const currentResourceGroup = searchParams.get('apiGroup') ?? ''
|
|
750
759
|
const selectedResourceKindSlug = selectedResource ? kindToPluralWithGroup(selectedResource.kind, selectedResource.group ?? '').toLowerCase() : ''
|
|
@@ -779,6 +788,14 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
779
788
|
? null
|
|
780
789
|
: selectedResource
|
|
781
790
|
|
|
791
|
+
// Clear orphaned peek state after hiding it at render time, so browser
|
|
792
|
+
// Forward back to the old owner URL doesn't revive a dismissed peek drawer.
|
|
793
|
+
useEffect(() => {
|
|
794
|
+
if (!peekRouteOrphaned) return
|
|
795
|
+
peekOwnerKeyRef.current = null
|
|
796
|
+
setSelectedResource(null)
|
|
797
|
+
}, [peekRouteOrphaned])
|
|
798
|
+
|
|
782
799
|
useEffect(() => {
|
|
783
800
|
if (mainView !== 'resources') {
|
|
784
801
|
prevResourcesKindKeyRef.current = null
|
|
@@ -828,10 +845,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
828
845
|
// Record the page this peek was opened on. Outside /resources the drawer is
|
|
829
846
|
// not URL-backed, so this ref is what lets the render-time gate below close
|
|
830
847
|
// the peek when the page under it changes (e.g. browser Back off a GitOps
|
|
831
|
-
// detail page, or Applications detail → list via ?app).
|
|
832
|
-
//
|
|
833
|
-
|
|
834
|
-
peekOwnerKeyRef.current = peekOwnerKey(window.location.pathname, window.location.search)
|
|
848
|
+
// detail page, or Applications detail → list via ?app). Read through the
|
|
849
|
+
// ref so the value is current regardless of this callback's memoization.
|
|
850
|
+
peekOwnerKeyRef.current = peekOwnerKey(locationRef.current.pathname, locationRef.current.search)
|
|
835
851
|
const update = () => { setDrawerInitialTab(tab); setSelectedResource(res) }
|
|
836
852
|
// Skip the cross-fade animation entirely on first open (no
|
|
837
853
|
// `selectedResource`); otherwise route through
|
|
@@ -967,7 +983,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
967
983
|
gitops: 'g o', checks: 'g u', cost: 'g c', capacity: 'g p',
|
|
968
984
|
// Non-rail views (reachable via deep links / actions, not the rail) get no
|
|
969
985
|
// dedicated mnemonic — listed for exhaustiveness so the type stays total.
|
|
970
|
-
workload: '', compare: '', helmCompare: '', investigations: '', cnpg: '', velero: '',
|
|
986
|
+
workload: '', compare: '', helmCompare: '', investigations: '', cnpg: '', velero: '', substrate: '', 'agent-sandbox': '', kagent: '',
|
|
971
987
|
}
|
|
972
988
|
const views = Object.keys(VIEW_SHORTCUT_KEYS).filter(
|
|
973
989
|
(v): v is ExtendedMainView => VIEW_SHORTCUT_KEYS[v as ExtendedMainView] !== '',
|
|
@@ -1177,6 +1193,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1177
1193
|
}>({ changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null })
|
|
1178
1194
|
const cnpgInvalidationPendingRef = useRef(false)
|
|
1179
1195
|
const veleroInvalidationPendingRef = useRef(false)
|
|
1196
|
+
const kagentInvalidationPendingRef = useRef(false)
|
|
1180
1197
|
// Traefik route facts scan every visible IngressRoute per request, so an open
|
|
1181
1198
|
// drawer refreshes at most once per batch of this length.
|
|
1182
1199
|
const traefikInvalidationRef = useRef<{ timer: number | null }>({ timer: null })
|
|
@@ -1221,6 +1238,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1221
1238
|
|
|
1222
1239
|
if (event.group?.endsWith('.cnpg.io')) cnpgInvalidationPendingRef.current = true
|
|
1223
1240
|
if (event.group === 'velero.io') veleroInvalidationPendingRef.current = true
|
|
1241
|
+
if (event.group === 'api.kagent.dev' || event.kind === 'Namespace') kagentInvalidationPendingRef.current = true
|
|
1224
1242
|
|
|
1225
1243
|
const fast = fastInvalidationRef.current
|
|
1226
1244
|
fast.changedKinds.add(kind)
|
|
@@ -1283,6 +1301,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1283
1301
|
queryClient.invalidateQueries({ queryKey: ['velero', 'workspace'] })
|
|
1284
1302
|
queryClient.invalidateQueries({ queryKey: ['velero', 'schedule-activity'] })
|
|
1285
1303
|
}
|
|
1304
|
+
if (kagentInvalidationPendingRef.current) {
|
|
1305
|
+
kagentInvalidationPendingRef.current = false
|
|
1306
|
+
queryClient.invalidateQueries({ queryKey: ['kagent', 'workspace'] })
|
|
1307
|
+
queryClient.invalidateQueries({ queryKey: ['substrate', getApiBase()], predicate: q => q.queryKey[3] === 'kagent-summary' })
|
|
1308
|
+
}
|
|
1286
1309
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1287
1310
|
}, 3000)
|
|
1288
1311
|
}
|
|
@@ -2312,7 +2335,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2312
2335
|
namespaces={namespaces}
|
|
2313
2336
|
fallbackClusterLoadState={showHomeClusterLoadFallback ? clusterLoadState : undefined}
|
|
2314
2337
|
onNavigateToView={setMainView}
|
|
2315
|
-
onNavigateToIssue={takeover.issues ? undefined : (
|
|
2338
|
+
onNavigateToIssue={takeover.issues ? undefined : (issue) => setMainView('issues', { issue: issue.id, ...issueSubjectParams(issue) })}
|
|
2316
2339
|
onNavigateToHelmRelease={navCustomization.embedded ? undefined : navigateToHelmRelease}
|
|
2317
2340
|
onNavigateToManagerPath={navCustomization.embedded || takeover.gitops ? undefined : navigateToPath}
|
|
2318
2341
|
// Upgrade impact lives under /checks, which a Cloud host takes
|
|
@@ -2567,12 +2590,12 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2567
2590
|
// the inline workload selection so the app graph (not a second
|
|
2568
2591
|
// detail panel) sits behind the peek. Search-only change keeps the
|
|
2569
2592
|
// pathname — and thus the peek's owner-path — intact.
|
|
2570
|
-
const params = new URLSearchParams(
|
|
2593
|
+
const params = new URLSearchParams(locationRef.current.search)
|
|
2571
2594
|
if (params.has('workload') || params.has('tab') || params.has('run')) {
|
|
2572
2595
|
params.delete('workload')
|
|
2573
2596
|
params.delete('tab')
|
|
2574
2597
|
params.delete('run')
|
|
2575
|
-
navigate({ pathname:
|
|
2598
|
+
navigate({ pathname: locationRef.current.pathname, search: params.toString() }, { replace: true })
|
|
2576
2599
|
}
|
|
2577
2600
|
navigateToResource(resource)
|
|
2578
2601
|
}}
|
|
@@ -2670,7 +2693,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2670
2693
|
onNavigate={(res) => navigateToResource(res)}
|
|
2671
2694
|
canCollapseToDrawer={!isMobile}
|
|
2672
2695
|
onExpand={(res, opts) => {
|
|
2673
|
-
const detailPath = resourceExpandedPath(res, connection.context || undefined, opts?.yaml ? 'yaml' : undefined)
|
|
2696
|
+
const detailPath = resourceExpandedPath(res, connection.context || undefined, opts?.yaml ? 'yaml' : undefined, { substrateWorkspace: hostFeatures.substrateWorkspace, kagentWorkspace: hostFeatures.kagentWorkspace })
|
|
2674
2697
|
if (detailPath) {
|
|
2675
2698
|
navigate(
|
|
2676
2699
|
detailPath,
|
|
@@ -2854,6 +2877,7 @@ function App({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadSt
|
|
|
2854
2877
|
<TerminalPreferences>
|
|
2855
2878
|
<ConnectionProvider>
|
|
2856
2879
|
<CapabilitiesProvider>
|
|
2880
|
+
<RegistryAccessModeProvider>
|
|
2857
2881
|
<RadarUpgradeProvider>
|
|
2858
2882
|
<ContextSwitchProvider>
|
|
2859
2883
|
<DockProvider connectionId={connectionHeaderValue}>
|
|
@@ -2867,6 +2891,7 @@ function App({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadSt
|
|
|
2867
2891
|
</DockProvider>
|
|
2868
2892
|
</ContextSwitchProvider>
|
|
2869
2893
|
</RadarUpgradeProvider>
|
|
2894
|
+
</RegistryAccessModeProvider>
|
|
2870
2895
|
</CapabilitiesProvider>
|
|
2871
2896
|
</ConnectionProvider>
|
|
2872
2897
|
</TerminalPreferences>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
|
5
|
+
import type { Topology, TopologyNode } from './types'
|
|
6
|
+
|
|
7
|
+
const node: TopologyNode = {
|
|
8
|
+
id: 'service/default/web',
|
|
9
|
+
kind: 'Service',
|
|
10
|
+
name: 'web',
|
|
11
|
+
status: 'healthy',
|
|
12
|
+
data: { namespace: 'default', apiVersion: 'v1' },
|
|
13
|
+
} as TopologyNode
|
|
14
|
+
|
|
15
|
+
const topology: Topology = { nodes: [node], edges: [] } as unknown as Topology
|
|
16
|
+
|
|
17
|
+
vi.mock('@skyhook-io/k8s-ui', async importOriginal => ({
|
|
18
|
+
...(await importOriginal<typeof import('@skyhook-io/k8s-ui')>()),
|
|
19
|
+
TopologyGraph: ({ onNodeClick }: { onNodeClick: (n: TopologyNode) => void }) => (
|
|
20
|
+
<button type="button" data-testid="topology-node" onClick={() => onNodeClick(node)}>web</button>
|
|
21
|
+
),
|
|
22
|
+
}))
|
|
23
|
+
|
|
24
|
+
vi.mock('./components/resources/ResourceDetailDrawer', () => ({
|
|
25
|
+
ResourceDetailDrawer: ({ resource, isOpen }: { resource: { name: string } | null; isOpen: boolean }) =>
|
|
26
|
+
isOpen && resource ? <div data-testid="peek-drawer">{resource.name}</div> : null,
|
|
27
|
+
}))
|
|
28
|
+
|
|
29
|
+
vi.mock('./components/applications/ApplicationsView', () => ({
|
|
30
|
+
ApplicationsView: ({ onOpenResource }: { onOpenResource: (r: { kind: string; namespace: string; name: string }) => void }) => (
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
data-testid="app-resource"
|
|
34
|
+
onClick={() => onOpenResource({ kind: 'services', namespace: 'default', name: 'web' })}
|
|
35
|
+
>
|
|
36
|
+
web
|
|
37
|
+
</button>
|
|
38
|
+
),
|
|
39
|
+
}))
|
|
40
|
+
|
|
41
|
+
const eventSource = {
|
|
42
|
+
topology,
|
|
43
|
+
topologyStatus: { requiresNamespaceFilter: false },
|
|
44
|
+
events: [],
|
|
45
|
+
connected: true,
|
|
46
|
+
connecting: false,
|
|
47
|
+
reconnect: () => {},
|
|
48
|
+
applyContextChange: () => {},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
vi.mock('./hooks/useEventSource', () => ({
|
|
52
|
+
useEventSource: () => eventSource,
|
|
53
|
+
}))
|
|
54
|
+
|
|
55
|
+
const { RadarApp } = await import('./RadarApp')
|
|
56
|
+
const { setBasename } = await import('./api/config')
|
|
57
|
+
|
|
58
|
+
let container: HTMLDivElement
|
|
59
|
+
let root: Root
|
|
60
|
+
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
63
|
+
vi.stubGlobal('matchMedia', (query: string) => ({
|
|
64
|
+
matches: false,
|
|
65
|
+
media: query,
|
|
66
|
+
onchange: null,
|
|
67
|
+
addEventListener: () => {},
|
|
68
|
+
removeEventListener: () => {},
|
|
69
|
+
addListener: () => {},
|
|
70
|
+
removeListener: () => {},
|
|
71
|
+
dispatchEvent: () => false,
|
|
72
|
+
}))
|
|
73
|
+
vi.stubGlobal('ResizeObserver', class { observe() {} unobserve() {} disconnect() {} })
|
|
74
|
+
vi.stubGlobal('fetch', vi.fn(async (url: string) => {
|
|
75
|
+
const { pathname } = new URL(url, window.location.origin)
|
|
76
|
+
if (pathname === '/api/connection') {
|
|
77
|
+
return Response.json({ state: 'connected', context: 'test', clusterName: 'test' })
|
|
78
|
+
}
|
|
79
|
+
if (pathname === '/api/auth/me') return Response.json({ authEnabled: false })
|
|
80
|
+
return new Response('{}', { status: 404, headers: { 'Content-Type': 'application/json' } })
|
|
81
|
+
}))
|
|
82
|
+
container = document.body.appendChild(document.createElement('div'))
|
|
83
|
+
root = createRoot(container)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
afterEach(() => {
|
|
87
|
+
act(() => root.unmount())
|
|
88
|
+
container.remove()
|
|
89
|
+
setBasename('')
|
|
90
|
+
window.history.replaceState(null, '', '/')
|
|
91
|
+
vi.unstubAllGlobals()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const settle = () => act(async () => {
|
|
95
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
async function waitFor<T>(read: () => T | null | undefined, what: string): Promise<T> {
|
|
99
|
+
for (let i = 0; i < 100; i++) {
|
|
100
|
+
const value = read()
|
|
101
|
+
if (value) return value
|
|
102
|
+
await settle()
|
|
103
|
+
}
|
|
104
|
+
throw new Error(`timed out waiting for ${what}`)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
it.each([
|
|
108
|
+
['under a host basename', '/c/abc'],
|
|
109
|
+
['at the root', ''],
|
|
110
|
+
])('opens a topology node peek %s', async (_label, basename) => {
|
|
111
|
+
window.history.replaceState(null, '', `${basename}/topology`)
|
|
112
|
+
act(() => root.render(<RadarApp basename={basename} />))
|
|
113
|
+
|
|
114
|
+
const nodeButton = await waitFor(
|
|
115
|
+
() => container.querySelector<HTMLButtonElement>('[data-testid="topology-node"]'),
|
|
116
|
+
'the topology graph',
|
|
117
|
+
)
|
|
118
|
+
act(() => nodeButton.click())
|
|
119
|
+
|
|
120
|
+
const drawer = await waitFor(
|
|
121
|
+
() => container.querySelector('[data-testid="peek-drawer"]'),
|
|
122
|
+
'the peek drawer',
|
|
123
|
+
)
|
|
124
|
+
expect(drawer.textContent).toBe('web')
|
|
125
|
+
expect(window.location.pathname).toBe(`${basename}/topology`)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it.each([
|
|
129
|
+
['under a host basename', '/c/abc'],
|
|
130
|
+
['at the root', ''],
|
|
131
|
+
])('opens a peek from an application workload %s without leaving the page', async (_label, basename) => {
|
|
132
|
+
window.history.replaceState(null, '', `${basename}/applications?app=web&workload=deployment%2Fdefault%2Fweb`)
|
|
133
|
+
act(() => root.render(<RadarApp basename={basename} />))
|
|
134
|
+
|
|
135
|
+
const openButton = await waitFor(
|
|
136
|
+
() => container.querySelector<HTMLButtonElement>('[data-testid="app-resource"]'),
|
|
137
|
+
'the applications view',
|
|
138
|
+
)
|
|
139
|
+
act(() => openButton.click())
|
|
140
|
+
|
|
141
|
+
const drawer = await waitFor(
|
|
142
|
+
() => container.querySelector('[data-testid="peek-drawer"]'),
|
|
143
|
+
'the peek drawer',
|
|
144
|
+
)
|
|
145
|
+
expect(drawer.textContent).toBe('web')
|
|
146
|
+
expect(window.location.pathname).toBe(`${basename}/applications`)
|
|
147
|
+
const params = new URLSearchParams(window.location.search)
|
|
148
|
+
expect(params.get('app')).toBe('web')
|
|
149
|
+
expect(params.has('workload')).toBe(false)
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('does not revive a dismissed Applications peek on Back then Forward under a basename', async () => {
|
|
153
|
+
const basename = '/c/abc'
|
|
154
|
+
window.history.replaceState(null, '', `${basename}/applications`)
|
|
155
|
+
window.history.pushState(null, '', `${basename}/applications?app=web`)
|
|
156
|
+
act(() => root.render(<RadarApp basename={basename} />))
|
|
157
|
+
|
|
158
|
+
const openButton = await waitFor(
|
|
159
|
+
() => container.querySelector<HTMLButtonElement>('[data-testid="app-resource"]'),
|
|
160
|
+
'the applications view',
|
|
161
|
+
)
|
|
162
|
+
act(() => openButton.click())
|
|
163
|
+
await waitFor(() => container.querySelector('[data-testid="peek-drawer"]'), 'the peek drawer')
|
|
164
|
+
|
|
165
|
+
// Browser Back off the app detail drops ?app and orphans the peek.
|
|
166
|
+
window.history.replaceState(null, '', `${basename}/applications`)
|
|
167
|
+
act(() => { window.dispatchEvent(new PopStateEvent('popstate')) })
|
|
168
|
+
await settle()
|
|
169
|
+
await settle()
|
|
170
|
+
|
|
171
|
+
// Browser Forward back to ?app=web must not bring the old peek drawer back.
|
|
172
|
+
window.history.replaceState(null, '', `${basename}/applications?app=web`)
|
|
173
|
+
act(() => { window.dispatchEvent(new PopStateEvent('popstate')) })
|
|
174
|
+
await settle()
|
|
175
|
+
await settle()
|
|
176
|
+
expect(container.querySelector('[data-testid="peek-drawer"]')).toBeNull()
|
|
177
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { onlineManager, QueryClient } from '@tanstack/react-query'
|
|
5
|
+
import { expect, it, vi } from 'vitest'
|
|
6
|
+
import { RadarApp } from './RadarApp'
|
|
7
|
+
|
|
8
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
9
|
+
|
|
10
|
+
it('opens the requested Settings pane from an embedded view', async () => {
|
|
11
|
+
const client = new QueryClient()
|
|
12
|
+
const host = document.createElement('div')
|
|
13
|
+
const root = createRoot(host)
|
|
14
|
+
const wasOnline = onlineManager.isOnline()
|
|
15
|
+
onlineManager.setOnline(false)
|
|
16
|
+
vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener() {}, removeEventListener() {} }))
|
|
17
|
+
vi.stubGlobal('EventSource', class extends EventTarget { close() {} })
|
|
18
|
+
vi.stubGlobal('fetch', vi.fn(async () => Response.json({ file: {}, effective: {}, configManagement: 'cloud' })))
|
|
19
|
+
try {
|
|
20
|
+
await act(async () => root.render(<RadarApp router="memory" navSlots={{ embedded: true }} queryClient={client} />))
|
|
21
|
+
for (const [section, label] of [['prometheus', 'Metrics'], ['argocd', 'Argo CD'], ['ai', 'AI investigations']]) {
|
|
22
|
+
await act(async () => {
|
|
23
|
+
window.dispatchEvent(new CustomEvent('radar:open-settings', { detail: { section } }))
|
|
24
|
+
})
|
|
25
|
+
expect([...document.querySelectorAll('[role="tab"][aria-selected="true"]')].map((tab) => tab.textContent)).toContain(label)
|
|
26
|
+
}
|
|
27
|
+
} finally {
|
|
28
|
+
act(() => root.unmount())
|
|
29
|
+
client.clear()
|
|
30
|
+
onlineManager.setOnline(wasOnline)
|
|
31
|
+
vi.unstubAllGlobals()
|
|
32
|
+
}
|
|
33
|
+
})
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import type { HealthLevel } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { fetchJSON, useRadarFeature } from './client'
|
|
4
|
+
import { getApiBase } from './config'
|
|
5
|
+
import { shouldRetryRadarQuery } from './radarFeatures'
|
|
6
|
+
|
|
7
|
+
// Wire types of GET /api/agentsandbox/workspace: internal/server
|
|
8
|
+
// AgentSandboxWorkspaceResponse and pkg/agentsandbox Summary.
|
|
9
|
+
|
|
10
|
+
export type AgentSandboxCoverageState = 'full' | 'partial' | 'denied' | 'uncached' | 'notInstalled' | 'syncing' | 'error'
|
|
11
|
+
|
|
12
|
+
export interface AgentSandboxKindCoverage {
|
|
13
|
+
state: AgentSandboxCoverageState
|
|
14
|
+
/** Named only when the caller named the namespaces. */
|
|
15
|
+
deniedNamespaces?: string[]
|
|
16
|
+
uncachedNamespaces?: string[]
|
|
17
|
+
/** For partial coverage: the namespaces that were read. */
|
|
18
|
+
allowedNamespaces?: string[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type AgentSandboxWorkspaceKey = 'sandboxes' | 'claims' | 'warmPools' | 'templates'
|
|
22
|
+
|
|
23
|
+
export interface AgentSandboxRef {
|
|
24
|
+
kind: string
|
|
25
|
+
group: string
|
|
26
|
+
namespace?: string
|
|
27
|
+
name: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** What Radar can say about an object a row names: absent only where its kind was read in full in that namespace. */
|
|
31
|
+
export type AgentSandboxPresence = 'present' | 'absent' | 'unread'
|
|
32
|
+
|
|
33
|
+
export interface AgentSandboxRelation {
|
|
34
|
+
role: 'warmPool' | 'template' | 'sandbox' | 'owner'
|
|
35
|
+
ref: AgentSandboxRef
|
|
36
|
+
presence: AgentSandboxPresence
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type AgentSandboxCategory = 'controller' | 'sandbox' | 'claim' | 'warmPool'
|
|
40
|
+
|
|
41
|
+
/** Which rule raised a row; branch on this, never on the title. */
|
|
42
|
+
export type AgentSandboxRule =
|
|
43
|
+
| 'controllerNotRunning'
|
|
44
|
+
| 'failed'
|
|
45
|
+
| 'reconcilerError'
|
|
46
|
+
| 'suspensionBlocked'
|
|
47
|
+
/**
|
|
48
|
+
* In progress for longer than 30 minutes (IncidentAfter). Whether Issues list
|
|
49
|
+
* it is the row's `issue`: a claim forwarding its Sandbox's progress is not
|
|
50
|
+
* listed, since Issues report that on the Sandbox.
|
|
51
|
+
*/
|
|
52
|
+
| 'stalled'
|
|
53
|
+
/** In progress past 5 minutes: an advisory, never an Issue. */
|
|
54
|
+
| 'slow'
|
|
55
|
+
| 'cannotBind'
|
|
56
|
+
| 'templateMissing'
|
|
57
|
+
| 'reserveBelowTarget'
|
|
58
|
+
|
|
59
|
+
export interface AgentSandboxAttention {
|
|
60
|
+
id: string
|
|
61
|
+
category: AgentSandboxCategory
|
|
62
|
+
rule: AgentSandboxRule
|
|
63
|
+
/**
|
|
64
|
+
* The controller's own reason where it reported one (PodFailed,
|
|
65
|
+
* Unschedulable, WarmPoolNotFound); an AgentSandbox-prefixed reason where
|
|
66
|
+
* Radar found it (AgentSandboxWarmPoolNotFound, AgentSandboxControllerNotReady).
|
|
67
|
+
*/
|
|
68
|
+
reason?: string
|
|
69
|
+
/** The prominence ladder GitOps, Velero, CNPG and Substrate rows use. */
|
|
70
|
+
severity: 'critical' | 'alert' | 'warning'
|
|
71
|
+
/** Carries no elapsed time; `since` does. */
|
|
72
|
+
title: string
|
|
73
|
+
reading?: string
|
|
74
|
+
/** What limits or contradicts the row in Radar's own reads; never folded away. */
|
|
75
|
+
caveat?: string
|
|
76
|
+
/** The controller's or scheduler's own words, folded under the reading. */
|
|
77
|
+
rawDetail?: string
|
|
78
|
+
rawDetailLabel?: string
|
|
79
|
+
/** `scheduler`: rawDetail can be put plainly with summarizeSchedulerMessage. */
|
|
80
|
+
rawDetailSource?: 'scheduler' | 'controller'
|
|
81
|
+
nextStep: string
|
|
82
|
+
/** The one shell command nextStep names, verbatim and in parentheses there: a client may show it as a copyable chip. */
|
|
83
|
+
command?: string
|
|
84
|
+
subject: AgentSandboxRef
|
|
85
|
+
related?: { lead: string; refs: AgentSandboxRef[] }
|
|
86
|
+
relations?: AgentSandboxRelation[]
|
|
87
|
+
/**
|
|
88
|
+
* When the state began: the latest transition among the conditions that
|
|
89
|
+
* report it, so no earlier than this. Absent where no condition records one
|
|
90
|
+
* (a refused suspension, a pool's reserve, Radar's own missing-object joins).
|
|
91
|
+
*/
|
|
92
|
+
since?: string
|
|
93
|
+
/** Radar's Issues list the subject for the same state: the authoritative parity bit, which no rule implies. */
|
|
94
|
+
issue: boolean
|
|
95
|
+
/**
|
|
96
|
+
* On a warm pool's reserve row when no sandbox in it is ready: its unbound
|
|
97
|
+
* claims still in progress, waiting while none is ready. Absent when
|
|
98
|
+
* none of the namespace's claims were read.
|
|
99
|
+
*/
|
|
100
|
+
waitingClaims?: AgentSandboxCount
|
|
101
|
+
/** On an unbound claim's row: the warm pool it names, read, with no sandbox ready. */
|
|
102
|
+
emptyPool?: AgentSandboxRef
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type AgentSandboxControllerState = 'running' | 'notReady' | 'scaledToZero' | 'notFound' | 'unread' | 'notInstalled'
|
|
106
|
+
|
|
107
|
+
export interface AgentSandboxController {
|
|
108
|
+
state: AgentSandboxControllerState
|
|
109
|
+
namespace: string
|
|
110
|
+
name: string
|
|
111
|
+
/** Set only when the Deployment was read. */
|
|
112
|
+
ready?: number
|
|
113
|
+
desired?: number
|
|
114
|
+
/**
|
|
115
|
+
* Why it was not read, when state is unread: a pkg/readreason code
|
|
116
|
+
* (user_forbidden, outside_namespace_pin, radar_namespace_not_collected,
|
|
117
|
+
* radar_kind_not_collected, kind_sync_pending, kind_sync_timed_out,
|
|
118
|
+
* read_error); readActionFor gives its action.
|
|
119
|
+
*/
|
|
120
|
+
code?: string
|
|
121
|
+
/** When the Deployment's Available condition last turned False. */
|
|
122
|
+
since?: string
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Lower bound: read in part, so every count is at least this and says nothing about the rest. */
|
|
126
|
+
export interface AgentSandboxSandboxCounts {
|
|
127
|
+
total: number
|
|
128
|
+
lowerBound: boolean
|
|
129
|
+
running: number
|
|
130
|
+
/** In progress, other than unschedulable. */
|
|
131
|
+
starting: number
|
|
132
|
+
/** In progress, and the scheduler can't place its Pod (PodScheduled=False with the scheduler's reason). */
|
|
133
|
+
unschedulable: number
|
|
134
|
+
/** Confirmed suspended, or suspending. */
|
|
135
|
+
suspended: number
|
|
136
|
+
/** The controller refuses the suspension (PodNotOwned); its Pod may still be running. */
|
|
137
|
+
suspensionBlocked: number
|
|
138
|
+
expired: number
|
|
139
|
+
finished: number
|
|
140
|
+
failed: number
|
|
141
|
+
terminating: number
|
|
142
|
+
unknown: number
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface AgentSandboxClaimCounts {
|
|
146
|
+
total: number
|
|
147
|
+
lowerBound: boolean
|
|
148
|
+
bound: number
|
|
149
|
+
waiting: number
|
|
150
|
+
expired: number
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface AgentSandboxWarmPoolCounts {
|
|
154
|
+
total: number
|
|
155
|
+
lowerBound: boolean
|
|
156
|
+
ready: number
|
|
157
|
+
readyLowerBound?: boolean
|
|
158
|
+
/** Only pools that set spec.replicas. */
|
|
159
|
+
desired: number
|
|
160
|
+
desiredLowerBound?: boolean
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A kind is absent when nothing of it was read. */
|
|
164
|
+
export interface AgentSandboxCounts {
|
|
165
|
+
sandboxes?: AgentSandboxSandboxCounts
|
|
166
|
+
claims?: AgentSandboxClaimCounts
|
|
167
|
+
warmPools?: AgentSandboxWarmPoolCounts
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** `count` is null when the read was partial and found nothing. */
|
|
171
|
+
export interface AgentSandboxCount {
|
|
172
|
+
count: number | null
|
|
173
|
+
lowerBound: boolean
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface AgentSandboxSidebar {
|
|
177
|
+
total: AgentSandboxCount
|
|
178
|
+
sandboxes: AgentSandboxCount
|
|
179
|
+
claims: AgentSandboxCount
|
|
180
|
+
warmPools: AgentSandboxCount
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface AgentSandboxWarmPoolRow {
|
|
184
|
+
namespace: string
|
|
185
|
+
name: string
|
|
186
|
+
state: { text: string; level: HealthLevel }
|
|
187
|
+
/** Absent until the pool reports status. */
|
|
188
|
+
ready?: number
|
|
189
|
+
/** Absent when the pool sets no spec.replicas. */
|
|
190
|
+
desired?: number
|
|
191
|
+
template?: string
|
|
192
|
+
templatePresence?: AgentSandboxPresence
|
|
193
|
+
/** Absent when the namespace's claims were not read. */
|
|
194
|
+
claims?: { total: number; bound: number }
|
|
195
|
+
created?: string
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface AgentSandboxExpiredEntry {
|
|
199
|
+
ref: AgentSandboxRef
|
|
200
|
+
/** The configured shutdown time. */
|
|
201
|
+
at: string
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface AgentSandboxExpired {
|
|
205
|
+
/**
|
|
206
|
+
* Within the last 7 days, newest first, capped. An expiry with no shutdown
|
|
207
|
+
* time recorded can't be placed in the week and is left out; the status
|
|
208
|
+
* line's expired count still includes it.
|
|
209
|
+
*/
|
|
210
|
+
recent: AgentSandboxExpiredEntry[]
|
|
211
|
+
recentTotal: number
|
|
212
|
+
lowerBound: boolean
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface AgentSandboxWorkspaceResponse {
|
|
216
|
+
context: string
|
|
217
|
+
installed: boolean
|
|
218
|
+
/** The namespaces asked for, after Radar's --namespace-scope clamp; empty for all the caller may read. */
|
|
219
|
+
namespaces: string[]
|
|
220
|
+
forcedNamespace?: string
|
|
221
|
+
coverage: Record<AgentSandboxWorkspaceKey, AgentSandboxKindCoverage>
|
|
222
|
+
controller: AgentSandboxController
|
|
223
|
+
counts: AgentSandboxCounts
|
|
224
|
+
/** One list ordered by severity, then rule, then newest first; never grouped by kind. */
|
|
225
|
+
attention: AgentSandboxAttention[]
|
|
226
|
+
attentionTotal: number
|
|
227
|
+
/** Namespace/name keys in each Needs attention segment, independent of the findings cap. */
|
|
228
|
+
attentionObjects?: { [K in Exclude<AgentSandboxWorkspaceKey, 'templates'>]: string[] }
|
|
229
|
+
/** Every kind and the controller were read in full: no rows means nothing needs attention. */
|
|
230
|
+
attentionComplete: boolean
|
|
231
|
+
sidebar: AgentSandboxSidebar
|
|
232
|
+
warmPools: AgentSandboxWarmPoolRow[]
|
|
233
|
+
warmPoolsTotal: number
|
|
234
|
+
expired: AgentSandboxExpired
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// /api/agentsandbox/workspace?namespaces=
|
|
238
|
+
//
|
|
239
|
+
// The Overview, Needs attention and the sidebar's badges, computed on the
|
|
240
|
+
// server from what the caller can read. The namespace filter applies. The API
|
|
241
|
+
// base is in the key because Radar Hub points one query client at many
|
|
242
|
+
// clusters.
|
|
243
|
+
export function useAgentSandboxWorkspace(namespaces: string[], options?: { enabled?: boolean }) {
|
|
244
|
+
const { guard, gatedKey } = useRadarFeature('agentSandboxWorkspace')
|
|
245
|
+
const base = getApiBase()
|
|
246
|
+
const ns = [...namespaces].sort().join(',')
|
|
247
|
+
return useQuery<AgentSandboxWorkspaceResponse>({
|
|
248
|
+
queryKey: ['agent-sandbox', 'workspace', base, ns, ...gatedKey],
|
|
249
|
+
queryFn: ({ signal }) =>
|
|
250
|
+
guard(() => fetchJSON<AgentSandboxWorkspaceResponse>(`/agentsandbox/workspace${ns ? `?namespaces=${encodeURIComponent(ns)}` : ''}`, signal)),
|
|
251
|
+
enabled: options?.enabled ?? true,
|
|
252
|
+
staleTime: 10_000,
|
|
253
|
+
refetchInterval: 30_000,
|
|
254
|
+
// Keep the previous answer while refetching, but never another cluster's
|
|
255
|
+
// or another namespace filter's.
|
|
256
|
+
placeholderData: (prev, prevQuery) => (prevQuery?.queryKey[2] === base && prevQuery?.queryKey[3] === ns ? prev : undefined),
|
|
257
|
+
retry: shouldRetryRadarQuery,
|
|
258
|
+
})
|
|
259
|
+
}
|