@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyhook-io/radar-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
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'
|
|
@@ -70,6 +72,8 @@ import { useUsageData, useUsageRecording } from './api/usage-data'
|
|
|
70
72
|
import { UsageDataPrompt } from './components/usage-data/UsageDataPrompt'
|
|
71
73
|
import { ProductHuntNotice } from './components/product-hunt/ProductHuntNotice'
|
|
72
74
|
import { useProductHuntRailEntry } from './components/product-hunt/useProductHuntRailEntry'
|
|
75
|
+
import { OssPoll } from './components/poll/OssPoll'
|
|
76
|
+
import { useNudgeVisible } from './components/nudges/activeNudges'
|
|
73
77
|
import { ShortcutHelpOverlay } from './components/ui/ShortcutHelpOverlay'
|
|
74
78
|
import { DiagnosticsOverlay, type DiagnosticsFocus } from './components/ui/DiagnosticsOverlay'
|
|
75
79
|
import { useEventSource } from './hooks/useEventSource'
|
|
@@ -89,6 +93,7 @@ import { useTheme } from './context/ThemeContext'
|
|
|
89
93
|
import { Tooltip } from './components/ui/Tooltip'
|
|
90
94
|
import { LargeClusterNamespacePicker } from './components/shared/LargeClusterNamespacePicker'
|
|
91
95
|
import { SettingsDialog, type SettingsSectionId } from './components/settings/SettingsDialog'
|
|
96
|
+
|
|
92
97
|
import type { APIResource, TopologyNode, GroupingMode, MainView, SelectedResource, SelectedHelmRelease, NodeKind, TopologyMode, Topology, K8sEvent } from './types'
|
|
93
98
|
import { createViewMemory } from './utils/viewMemory'
|
|
94
99
|
import { createKindFilterStore } from './utils/kindFilterStore'
|
|
@@ -145,7 +150,7 @@ const FLEET_MODE_KINDS = new Set<NodeKind>([
|
|
|
145
150
|
|
|
146
151
|
// Convert API resource name back to topology node ID prefix
|
|
147
152
|
// 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'
|
|
153
|
+
type ExtendedMainView = MainView | 'traffic' | 'cost' | 'capacity' | 'cnpg' | 'velero' | 'substrate' | 'agent-sandbox' | 'kagent' | 'workload' | 'checks' | 'gitops' | 'compare' | 'helmCompare' | 'issues' | 'applications' | 'investigations'
|
|
149
154
|
|
|
150
155
|
// Views that have been laid out for phone width (640px and below). The rest
|
|
151
156
|
// keep their desktop width on a phone and scroll sideways; add a view here in
|
|
@@ -745,6 +750,12 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
745
750
|
// Owner-key (pathname + ?app) a non-URL-backed peek was opened on; see
|
|
746
751
|
// navigateToResource and peekOwnerKey.
|
|
747
752
|
const peekOwnerKeyRef = useRef<string | null>(null)
|
|
753
|
+
// The router's location, readable from memoized callbacks. Never use
|
|
754
|
+
// window.location for route comparisons: under a host basename (Radar Hub's
|
|
755
|
+
// /c/<id>) it carries the prefix the router strips, and under the memory
|
|
756
|
+
// router it is the host page's URL.
|
|
757
|
+
const locationRef = useRef(location)
|
|
758
|
+
locationRef.current = location
|
|
748
759
|
const currentResourceKindSlug = normalizedResourcesKindSlug.toLowerCase()
|
|
749
760
|
const currentResourceGroup = searchParams.get('apiGroup') ?? ''
|
|
750
761
|
const selectedResourceKindSlug = selectedResource ? kindToPluralWithGroup(selectedResource.kind, selectedResource.group ?? '').toLowerCase() : ''
|
|
@@ -779,6 +790,14 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
779
790
|
? null
|
|
780
791
|
: selectedResource
|
|
781
792
|
|
|
793
|
+
// Clear orphaned peek state after hiding it at render time, so browser
|
|
794
|
+
// Forward back to the old owner URL doesn't revive a dismissed peek drawer.
|
|
795
|
+
useEffect(() => {
|
|
796
|
+
if (!peekRouteOrphaned) return
|
|
797
|
+
peekOwnerKeyRef.current = null
|
|
798
|
+
setSelectedResource(null)
|
|
799
|
+
}, [peekRouteOrphaned])
|
|
800
|
+
|
|
782
801
|
useEffect(() => {
|
|
783
802
|
if (mainView !== 'resources') {
|
|
784
803
|
prevResourcesKindKeyRef.current = null
|
|
@@ -828,10 +847,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
828
847
|
// Record the page this peek was opened on. Outside /resources the drawer is
|
|
829
848
|
// not URL-backed, so this ref is what lets the render-time gate below close
|
|
830
849
|
// 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)
|
|
850
|
+
// detail page, or Applications detail → list via ?app). Read through the
|
|
851
|
+
// ref so the value is current regardless of this callback's memoization.
|
|
852
|
+
peekOwnerKeyRef.current = peekOwnerKey(locationRef.current.pathname, locationRef.current.search)
|
|
835
853
|
const update = () => { setDrawerInitialTab(tab); setSelectedResource(res) }
|
|
836
854
|
// Skip the cross-fade animation entirely on first open (no
|
|
837
855
|
// `selectedResource`); otherwise route through
|
|
@@ -873,7 +891,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
873
891
|
navigate({ pathname: `/resources/${pluralKind}`, search: newParams.toString() })
|
|
874
892
|
}, [searchParams, navigate])
|
|
875
893
|
|
|
876
|
-
const navigateToHelmRelease = useCallback((namespace: string, name: string, storageNamespace?: string, investigationRunID?: string | null, observed?: boolean) => {
|
|
894
|
+
const navigateToHelmRelease = useCallback((namespace: string, name: string, storageNamespace?: string, investigationRunID?: string | null, observed?: boolean, storageNotCollected?: boolean) => {
|
|
877
895
|
const newParams = new URLSearchParams()
|
|
878
896
|
const globalNamespaces = searchParams.get('namespaces')
|
|
879
897
|
if (globalNamespaces) {
|
|
@@ -884,7 +902,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
884
902
|
newParams.set('releaseStorage', storageNamespace)
|
|
885
903
|
}
|
|
886
904
|
if (investigationRunID) newParams.set('ai-run', investigationRunID)
|
|
887
|
-
setSelectedHelmRelease({ namespace, name, storageNamespace, observed })
|
|
905
|
+
setSelectedHelmRelease({ namespace, name, storageNamespace, observed, storageNotCollected })
|
|
888
906
|
if (mainView === 'helm') {
|
|
889
907
|
setSearchParams(newParams, { replace: true })
|
|
890
908
|
return
|
|
@@ -967,7 +985,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
967
985
|
gitops: 'g o', checks: 'g u', cost: 'g c', capacity: 'g p',
|
|
968
986
|
// Non-rail views (reachable via deep links / actions, not the rail) get no
|
|
969
987
|
// dedicated mnemonic — listed for exhaustiveness so the type stays total.
|
|
970
|
-
workload: '', compare: '', helmCompare: '', investigations: '', cnpg: '', velero: '',
|
|
988
|
+
workload: '', compare: '', helmCompare: '', investigations: '', cnpg: '', velero: '', substrate: '', 'agent-sandbox': '', kagent: '',
|
|
971
989
|
}
|
|
972
990
|
const views = Object.keys(VIEW_SHORTCUT_KEYS).filter(
|
|
973
991
|
(v): v is ExtendedMainView => VIEW_SHORTCUT_KEYS[v as ExtendedMainView] !== '',
|
|
@@ -1177,6 +1195,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1177
1195
|
}>({ changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null })
|
|
1178
1196
|
const cnpgInvalidationPendingRef = useRef(false)
|
|
1179
1197
|
const veleroInvalidationPendingRef = useRef(false)
|
|
1198
|
+
const kagentInvalidationPendingRef = useRef(false)
|
|
1180
1199
|
// Traefik route facts scan every visible IngressRoute per request, so an open
|
|
1181
1200
|
// drawer refreshes at most once per batch of this length.
|
|
1182
1201
|
const traefikInvalidationRef = useRef<{ timer: number | null }>({ timer: null })
|
|
@@ -1221,6 +1240,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1221
1240
|
|
|
1222
1241
|
if (event.group?.endsWith('.cnpg.io')) cnpgInvalidationPendingRef.current = true
|
|
1223
1242
|
if (event.group === 'velero.io') veleroInvalidationPendingRef.current = true
|
|
1243
|
+
if (event.group === 'api.kagent.dev' || event.kind === 'Namespace') kagentInvalidationPendingRef.current = true
|
|
1224
1244
|
|
|
1225
1245
|
const fast = fastInvalidationRef.current
|
|
1226
1246
|
fast.changedKinds.add(kind)
|
|
@@ -1283,6 +1303,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1283
1303
|
queryClient.invalidateQueries({ queryKey: ['velero', 'workspace'] })
|
|
1284
1304
|
queryClient.invalidateQueries({ queryKey: ['velero', 'schedule-activity'] })
|
|
1285
1305
|
}
|
|
1306
|
+
if (kagentInvalidationPendingRef.current) {
|
|
1307
|
+
kagentInvalidationPendingRef.current = false
|
|
1308
|
+
queryClient.invalidateQueries({ queryKey: ['kagent', 'workspace'] })
|
|
1309
|
+
queryClient.invalidateQueries({ queryKey: ['substrate', getApiBase()], predicate: q => q.queryKey[3] === 'kagent-summary' })
|
|
1310
|
+
}
|
|
1286
1311
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1287
1312
|
}, 3000)
|
|
1288
1313
|
}
|
|
@@ -2312,7 +2337,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2312
2337
|
namespaces={namespaces}
|
|
2313
2338
|
fallbackClusterLoadState={showHomeClusterLoadFallback ? clusterLoadState : undefined}
|
|
2314
2339
|
onNavigateToView={setMainView}
|
|
2315
|
-
onNavigateToIssue={takeover.issues ? undefined : (
|
|
2340
|
+
onNavigateToIssue={takeover.issues ? undefined : (issue) => setMainView('issues', { issue: issue.id, ...issueSubjectParams(issue) })}
|
|
2316
2341
|
onNavigateToHelmRelease={navCustomization.embedded ? undefined : navigateToHelmRelease}
|
|
2317
2342
|
onNavigateToManagerPath={navCustomization.embedded || takeover.gitops ? undefined : navigateToPath}
|
|
2318
2343
|
// Upgrade impact lives under /checks, which a Cloud host takes
|
|
@@ -2532,7 +2557,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2532
2557
|
<HelmView
|
|
2533
2558
|
namespaces={namespaces}
|
|
2534
2559
|
selectedRelease={selectedHelmRelease}
|
|
2535
|
-
onReleaseClick={(namespace, name, storageNamespace, observed) => navigateToHelmRelease(namespace, name, storageNamespace, undefined, observed)}
|
|
2560
|
+
onReleaseClick={(namespace, name, storageNamespace, observed, storageNotCollected) => navigateToHelmRelease(namespace, name, storageNamespace, undefined, observed, storageNotCollected)}
|
|
2536
2561
|
/>
|
|
2537
2562
|
)}
|
|
2538
2563
|
|
|
@@ -2567,12 +2592,12 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2567
2592
|
// the inline workload selection so the app graph (not a second
|
|
2568
2593
|
// detail panel) sits behind the peek. Search-only change keeps the
|
|
2569
2594
|
// pathname — and thus the peek's owner-path — intact.
|
|
2570
|
-
const params = new URLSearchParams(
|
|
2595
|
+
const params = new URLSearchParams(locationRef.current.search)
|
|
2571
2596
|
if (params.has('workload') || params.has('tab') || params.has('run')) {
|
|
2572
2597
|
params.delete('workload')
|
|
2573
2598
|
params.delete('tab')
|
|
2574
2599
|
params.delete('run')
|
|
2575
|
-
navigate({ pathname:
|
|
2600
|
+
navigate({ pathname: locationRef.current.pathname, search: params.toString() }, { replace: true })
|
|
2576
2601
|
}
|
|
2577
2602
|
navigateToResource(resource)
|
|
2578
2603
|
}}
|
|
@@ -2670,7 +2695,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2670
2695
|
onNavigate={(res) => navigateToResource(res)}
|
|
2671
2696
|
canCollapseToDrawer={!isMobile}
|
|
2672
2697
|
onExpand={(res, opts) => {
|
|
2673
|
-
const detailPath = resourceExpandedPath(res, connection.context || undefined, opts?.yaml ? 'yaml' : undefined)
|
|
2698
|
+
const detailPath = resourceExpandedPath(res, connection.context || undefined, opts?.yaml ? 'yaml' : undefined, { substrateWorkspace: hostFeatures.substrateWorkspace, kagentWorkspace: hostFeatures.kagentWorkspace })
|
|
2674
2699
|
if (detailPath) {
|
|
2675
2700
|
navigate(
|
|
2676
2701
|
detailPath,
|
|
@@ -2792,6 +2817,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2792
2817
|
{!navCustomization.embedded && <WhatsNew onNavigate={navigateToPath} usageData={usageData.data} />}
|
|
2793
2818
|
{!navCustomization.embedded && <UsageDataPrompt status={usageData.data} />}
|
|
2794
2819
|
{!navCustomization.embedded && <ProductHuntNotice usageData={usageData.data} usageDataPending={usageData.isPending} />}
|
|
2820
|
+
{/* The OSS poll is a nudge to standalone users only; never inside a host app. */}
|
|
2821
|
+
{!navCustomization.embedded && <OssPoll />}
|
|
2795
2822
|
|
|
2796
2823
|
{/* Bottom Dock for Terminal/Logs */}
|
|
2797
2824
|
<BottomDock viewNamespaces={namespaces} />
|
|
@@ -2854,6 +2881,7 @@ function App({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadSt
|
|
|
2854
2881
|
<TerminalPreferences>
|
|
2855
2882
|
<ConnectionProvider>
|
|
2856
2883
|
<CapabilitiesProvider>
|
|
2884
|
+
<RegistryAccessModeProvider>
|
|
2857
2885
|
<RadarUpgradeProvider>
|
|
2858
2886
|
<ContextSwitchProvider>
|
|
2859
2887
|
<DockProvider connectionId={connectionHeaderValue}>
|
|
@@ -2867,6 +2895,7 @@ function App({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadSt
|
|
|
2867
2895
|
</DockProvider>
|
|
2868
2896
|
</ContextSwitchProvider>
|
|
2869
2897
|
</RadarUpgradeProvider>
|
|
2898
|
+
</RegistryAccessModeProvider>
|
|
2870
2899
|
</CapabilitiesProvider>
|
|
2871
2900
|
</ConnectionProvider>
|
|
2872
2901
|
</TerminalPreferences>
|
|
@@ -2882,6 +2911,13 @@ function GitHubStarButton() {
|
|
|
2882
2911
|
const [showCallout, setShowCallout] = useState(false)
|
|
2883
2912
|
const calloutRef = useRef<HTMLDivElement>(null)
|
|
2884
2913
|
const buttonRef = useRef<HTMLAnchorElement>(null)
|
|
2914
|
+
// The button is hidden in narrow windows; a callout nobody can see is not a
|
|
2915
|
+
// nudge, and must not hold the others back.
|
|
2916
|
+
const [calloutOnScreen, setCalloutOnScreen] = useState(false)
|
|
2917
|
+
useEffect(() => {
|
|
2918
|
+
setCalloutOnScreen(showCallout && (buttonRef.current?.getClientRects().length ?? 0) > 0)
|
|
2919
|
+
}, [showCallout])
|
|
2920
|
+
useNudgeVisible('github-star', calloutOnScreen)
|
|
2885
2921
|
|
|
2886
2922
|
useEffect(() => {
|
|
2887
2923
|
// Fetch star count from GitHub public API
|
|
@@ -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
|
+
})
|