@skyhook-io/radar-app 1.17.0 → 1.18.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/README.md +1 -1
- package/package.json +11 -11
- package/src/App.tsx +138 -116
- package/src/api/actions.errorCode.test.ts +40 -0
- package/src/api/actions.test.ts +48 -0
- package/src/api/actions.ts +79 -0
- package/src/api/apiResources.navigation.test.tsx +232 -0
- package/src/api/apiResources.ts +46 -3
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.helmSource.test.ts +39 -0
- package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
- package/src/api/client.namespaceSwitch.test.ts +107 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +580 -103
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/cnpg-ha.live.test.ts +140 -0
- package/src/api/cnpg-ha.test.ts +78 -0
- package/src/api/cnpg-ha.ts +19 -0
- package/src/api/cnpg-history.ts +123 -0
- package/src/api/cnpg-inspect.ts +102 -0
- package/src/api/cnpg-protection.ts +112 -0
- package/src/api/cnpg-recovery.test.tsx +60 -0
- package/src/api/cnpg-recovery.ts +262 -0
- package/src/api/cnpg-sessions.ts +175 -0
- package/src/api/cnpg-storage.ts +138 -0
- package/src/api/cnpg.legacy-reads.test.ts +43 -0
- package/src/api/cnpg.pooler-runtime.test.ts +15 -0
- package/src/api/cnpg.ts +428 -10
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/radarFeatures.render.test.tsx +47 -3
- package/src/api/radarFeatures.ts +5 -1
- package/src/api/reviewedActionMutation.test.tsx +164 -0
- package/src/api/reviewedActionMutation.ts +66 -0
- package/src/api/timelineSource.test.ts +9 -0
- package/src/api/timelineSource.ts +8 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/audit/AuditView.tsx +9 -0
- package/src/components/capacity/CapacityActivity.tsx +3 -31
- package/src/components/capacity/CapacityDemand.tsx +4 -36
- package/src/components/capacity/CapacityOverview.tsx +217 -56
- package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
- package/src/components/capacity/CapacityView.test.tsx +323 -0
- package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
- package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
- package/src/components/capacity/routes.ts +42 -0
- package/src/components/capacity/shared.tsx +11 -129
- package/src/components/capacity/workspaceRoute.ts +18 -0
- package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
- package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
- package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
- package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
- package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
- package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
- package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
- package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
- package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
- package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
- package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
- package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
- package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
- package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
- package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
- package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
- package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
- package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
- package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
- package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
- package/src/components/cnpg/CNPGOperator.tsx +78 -30
- package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
- package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
- package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
- package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
- package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
- package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
- package/src/components/cnpg/CNPGOverview.tsx +238 -63
- package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
- package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
- package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
- package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
- package/src/components/cnpg/CNPGPerformance.tsx +477 -0
- package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
- package/src/components/cnpg/CNPGPooling.tsx +97 -40
- package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
- package/src/components/cnpg/CNPGProtection.tsx +228 -122
- package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
- package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
- package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
- package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
- package/src/components/cnpg/CNPGStorage.tsx +619 -0
- package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
- package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
- package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
- package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
- package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
- package/src/components/cnpg/CNPGTrends.test.ts +38 -0
- package/src/components/cnpg/CNPGTrends.tsx +702 -0
- package/src/components/cnpg/CNPGView.tsx +34 -21
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
- package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
- package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
- package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
- package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
- package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
- package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
- package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
- package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
- package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
- package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
- package/src/components/cnpg/actions/actionModel.test.ts +111 -0
- package/src/components/cnpg/actions/actionModel.ts +127 -0
- package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
- package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
- package/src/components/cnpg/archivingRepair.test.ts +104 -0
- package/src/components/cnpg/archivingRepair.ts +145 -0
- package/src/components/cnpg/baseBackup.test.ts +36 -0
- package/src/components/cnpg/baseBackup.ts +36 -0
- package/src/components/cnpg/blocking.test.ts +59 -0
- package/src/components/cnpg/blocking.ts +131 -0
- package/src/components/cnpg/coverageText.test.ts +27 -0
- package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
- package/src/components/cnpg/creation/targetModel.test.ts +137 -0
- package/src/components/cnpg/creation/targetModel.ts +149 -0
- package/src/components/cnpg/fleetStatus.test.ts +46 -0
- package/src/components/cnpg/fleetStatus.ts +43 -0
- package/src/components/cnpg/formFields.ts +2 -0
- package/src/components/cnpg/grantText.test.tsx +11 -0
- package/src/components/cnpg/host.test.tsx +24 -0
- package/src/components/cnpg/host.tsx +101 -0
- package/src/components/cnpg/inspectModel.test.ts +120 -0
- package/src/components/cnpg/inspectModel.ts +140 -0
- package/src/components/cnpg/logicalSlots.test.ts +30 -0
- package/src/components/cnpg/logicalSlots.ts +29 -0
- package/src/components/cnpg/lsn.test.ts +40 -0
- package/src/components/cnpg/lsn.ts +43 -0
- package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
- package/src/components/cnpg/operations/model.test.ts +510 -0
- package/src/components/cnpg/operations/model.ts +499 -0
- package/src/components/cnpg/operations/presentation.test.ts +80 -0
- package/src/components/cnpg/operations/presentation.ts +84 -0
- package/src/components/cnpg/operations/store.ts +98 -0
- package/src/components/cnpg/operatorStatus.test.ts +134 -0
- package/src/components/cnpg/operatorStatus.ts +194 -0
- package/src/components/cnpg/paths.test.ts +54 -0
- package/src/components/cnpg/paths.ts +47 -4
- package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
- package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
- package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
- package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
- package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
- package/src/components/cnpg/protection/scheduleModel.ts +16 -0
- package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
- package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
- package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
- package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
- package/src/components/cnpg/recovery/restoreModel.ts +685 -0
- package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
- package/src/components/cnpg/refresh.test.ts +38 -0
- package/src/components/cnpg/refresh.ts +17 -0
- package/src/components/cnpg/refreshNotice.test.tsx +29 -0
- package/src/components/cnpg/routes.test.ts +34 -3
- package/src/components/cnpg/routes.ts +60 -48
- package/src/components/cnpg/runtimeAssessment.ts +198 -0
- package/src/components/cnpg/runtimeModel.test.ts +175 -0
- package/src/components/cnpg/runtimeModel.ts +196 -0
- package/src/components/cnpg/runtimeParts.test.tsx +17 -0
- package/src/components/cnpg/runtimeParts.tsx +79 -0
- package/src/components/cnpg/shared.test.tsx +59 -0
- package/src/components/cnpg/shared.tsx +100 -182
- package/src/components/cnpg/storageModel.test.ts +107 -0
- package/src/components/cnpg/storageModel.ts +101 -0
- package/src/components/cnpg/trendSamples.test.ts +148 -0
- package/src/components/cnpg/trendSamples.ts +222 -0
- package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
- package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
- package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
- package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
- package/src/components/cnpg/useCNPGNavigate.ts +21 -0
- package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
- package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
- package/src/components/cnpg/workspaceRoute.ts +23 -0
- package/src/components/cost/ApplicationCostTab.test.ts +7 -0
- package/src/components/cost/ApplicationCostTab.tsx +7 -7
- package/src/components/cost/CostView.test.ts +2 -1
- package/src/components/cost/CostView.tsx +0 -2
- package/src/components/cost/WorkloadCostTab.tsx +2 -4
- package/src/components/cost/errors.ts +3 -1
- package/src/components/cost/source.test.ts +10 -0
- package/src/components/cost/source.ts +5 -1
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/types.ts +11 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/dock/BottomDock.tsx +8 -3
- package/src/components/dock/TerminalTab.test.tsx +17 -0
- package/src/components/dock/TerminalTab.tsx +7 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +23 -8
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
- package/src/components/gitops/GitOpsView.tsx +23 -23
- package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
- package/src/components/helm/HelmCompareRoute.tsx +57 -26
- package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
- package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
- package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
- package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/helm/ValuesViewer.test.tsx +301 -0
- package/src/components/helm/ValuesViewer.tsx +169 -78
- package/src/components/home/ActivitySummary.tsx +2 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +32 -12
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +82 -0
- package/src/components/home/TopologyPreview.tsx +2 -2
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +143 -0
- package/src/components/issues/IssuesPane.test.ts +65 -1
- package/src/components/issues/IssuesPane.tsx +213 -26
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +74 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
- package/src/components/resource/PVCUsageBar.test.tsx +24 -0
- package/src/components/resource/PVCUsageBar.tsx +15 -6
- package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
- package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
- package/src/components/resources/CompositeRenderer.tsx +4 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +44 -15
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
- package/src/components/settings/SettingsDialog.tsx +49 -30
- package/src/components/timeline/TimelineList.tsx +22 -24
- package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
- package/src/components/timeline/TimelineLoadError.tsx +96 -0
- package/src/components/timeline/TimelineView.tsx +18 -45
- package/src/components/timeline/ViewModeToggle.tsx +20 -0
- package/src/components/timeline/useStickyError.test.tsx +47 -0
- package/src/components/timeline/useStickyError.ts +15 -0
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficView.tsx +12 -12
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
- package/src/components/ui/Markdown.test.tsx +65 -0
- package/src/components/ui/Markdown.tsx +144 -127
- package/src/components/ui/Omnibar.tsx +13 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/omnibar-match.test.ts +30 -0
- package/src/components/ui/omnibar-match.ts +18 -0
- package/src/components/whats-new/releaseNotes.ts +63 -1
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +63 -243
- package/src/components/workspace/layout.test.tsx +29 -0
- package/src/components/workspace/layout.tsx +259 -0
- package/src/components/workspace/table.ts +7 -0
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/contexts/CapabilitiesContext.tsx +1 -1
- package/src/integrations/resourceHost.test.tsx +55 -0
- package/src/integrations/resourceHost.ts +99 -0
- package/src/integrations/resourceHosts.test.tsx +142 -0
- package/src/integrations/resourceHosts.tsx +121 -0
- package/src/integrations/workspaceRoute.ts +20 -0
- package/src/integrations/workspaceRoutes.test.ts +40 -0
- package/src/integrations/workspaceRoutes.ts +22 -0
- package/src/integrations/workspaceScreens.tsx +14 -0
- package/src/utils/drawer-trail.ts +35 -0
- package/src/utils/kindFilterStore.test.ts +147 -0
- package/src/utils/kindFilterStore.ts +91 -0
- package/src/utils/navigation.test.ts +13 -1
- package/src/utils/navigation.ts +53 -2
- package/src/utils/page-links.ts +21 -0
- package/src/utils/tabStorage.ts +40 -0
- package/src/utils/viewMemory.test.ts +78 -0
- package/src/utils/viewMemory.ts +54 -0
- package/src/utils/wails-clipboard.ts +4 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ This package is source-only — it ships TypeScript + TSX files under `src/`. Co
|
|
|
10
10
|
npm install @skyhook-io/radar-app
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Peer deps: `react >=19`, `react-dom >=19`, `react-router-dom >=7`, `@tanstack/react-query >=5`, `@skyhook-io/k8s-ui >=1.
|
|
13
|
+
Peer deps: `react >=19`, `react-dom >=19`, `react-router-dom >=7`, `@tanstack/react-query >=5`, `@skyhook-io/k8s-ui >=1.17.1`, plus `clsx`, `tailwind-merge`, `lucide-react`, `@xyflow/react`, `elkjs`.
|
|
14
14
|
|
|
15
15
|
## Use
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyhook-io/radar-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.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",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@fontsource/dm-mono": "^5.3.0",
|
|
35
35
|
"@monaco-editor/react": "^4.7.0",
|
|
36
36
|
"diff": "^9.0.0",
|
|
37
|
-
"monaco-editor": "0.
|
|
37
|
+
"monaco-editor": "0.57.0",
|
|
38
38
|
"react-markdown": "^10.1.0",
|
|
39
39
|
"react-virtuoso": "^4.18.16",
|
|
40
40
|
"remark-gfm": "^4.0.1",
|
|
41
|
-
"shiki": "^4.
|
|
42
|
-
"yaml": "^2.9.
|
|
41
|
+
"shiki": "^4.5.0",
|
|
42
|
+
"yaml": "^2.9.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@skyhook-io/k8s-ui": ">=1.17.
|
|
45
|
+
"@skyhook-io/k8s-ui": ">=1.17.1",
|
|
46
46
|
"@tanstack/react-query": ">=5",
|
|
47
47
|
"@xyflow/react": ">=12.0.0",
|
|
48
48
|
"clsx": ">=2",
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
"@types/node": "^26.6.2",
|
|
64
64
|
"@types/react": "^19.3.0",
|
|
65
65
|
"@types/react-dom": "^19.3.0",
|
|
66
|
-
"@vitejs/plugin-react": "^6.1.
|
|
67
|
-
"@xyflow/react": "^12.
|
|
66
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
67
|
+
"@xyflow/react": "^12.12.0",
|
|
68
68
|
"clsx": "^2.1.1",
|
|
69
69
|
"elkjs": "^0.11.1",
|
|
70
|
-
"eslint": "^10.
|
|
70
|
+
"eslint": "^10.13.0",
|
|
71
71
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
72
72
|
"eslint-plugin-react-refresh": "^0.5.3",
|
|
73
73
|
"globals": "^17.11.0",
|
|
74
74
|
"lucide-react": "^1.48.0",
|
|
75
|
-
"postcss": "^8.5.
|
|
76
|
-
"prettier": "^3.9.
|
|
75
|
+
"postcss": "^8.5.30",
|
|
76
|
+
"prettier": "^3.9.10",
|
|
77
77
|
"react": "^19.3.0",
|
|
78
78
|
"react-dom": "^19.3.0",
|
|
79
79
|
"react-router-dom": "^7.18.4",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"tailwindcss": "^4.3.3",
|
|
82
82
|
"typescript": "^6.0.2",
|
|
83
83
|
"typescript-eslint": "^8.71.0",
|
|
84
|
-
"vite": "^8.3.
|
|
84
|
+
"vite": "^8.3.4"
|
|
85
85
|
},
|
|
86
86
|
"sideEffects": [
|
|
87
87
|
"*.css"
|
package/src/App.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect, useCallback, useMemo, useRef } from 'react'
|
|
1
|
+
import { useState, useEffect, useLayoutEffect, useCallback, useMemo, useRef } from 'react'
|
|
2
2
|
import { flushSync } from 'react-dom'
|
|
3
3
|
import { startViewTransitionSafe } from '@skyhook-io/k8s-ui/utils/view-transition'
|
|
4
4
|
import { englishPlural } from '@skyhook-io/k8s-ui/utils/pluralize'
|
|
@@ -10,7 +10,7 @@ import { GlobalDiagnoseButton } from './components/diagnose/LocalDiagnoseAction'
|
|
|
10
10
|
import { investigationWorkspaceSearch, isInvestigationWorkspacePath, useDiagnoseLayout } from './components/diagnose/DiagnoseContext'
|
|
11
11
|
import { DiagnoseSurface } from './components/diagnose/DiagnoseSurface'
|
|
12
12
|
import { TopologyGraph, TopologySearch, TopologyBreadcrumb, TopologyFilterSidebar, TopologyControls, FreshnessControl, gitOpsRouteForKind, gitOpsRouteForResource, ScopePill, PaneLoader } from '@skyhook-io/k8s-ui'
|
|
13
|
-
import {
|
|
13
|
+
import { resetNavigationMap } from '@skyhook-io/k8s-ui/utils/navigation'
|
|
14
14
|
import { topologyNodeResourceKind } from '@skyhook-io/k8s-ui/utils/topology-neighborhood'
|
|
15
15
|
import { useAPIResources, findAPIResourceForRoute } from './api/apiResources'
|
|
16
16
|
import { TimelineView } from './components/timeline/TimelineView'
|
|
@@ -23,7 +23,6 @@ import { HelmView } from './components/helm/HelmView'
|
|
|
23
23
|
import { HelmCompareRoute } from './components/helm/HelmCompareRoute'
|
|
24
24
|
import { TrafficView } from './components/traffic/TrafficView'
|
|
25
25
|
import { CostView } from './components/cost/CostView'
|
|
26
|
-
import { CapacityView } from './components/capacity/CapacityView'
|
|
27
26
|
import { AuditView } from './components/audit/AuditView'
|
|
28
27
|
import { IssuesPane } from './components/issues/IssuesPane'
|
|
29
28
|
import { GitOpsView } from './components/gitops/GitOpsView'
|
|
@@ -38,14 +37,15 @@ import { CloudFunnelButton } from './components/CloudFunnelButton'
|
|
|
38
37
|
import { useNavCustomization } from './context/NavCustomization'
|
|
39
38
|
import type { FleetTakeoverTarget } from './context/NavCustomization'
|
|
40
39
|
import { PrimaryNavRail } from './components/nav/PrimaryNavRail'
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
40
|
+
import { resourceExpandedPath, resourceKindListTitle } from './integrations/resourceHosts'
|
|
41
|
+
import { workspaceContextSwitchSearch, workspaceForPath, workspaceForView, workspaceLabels } from './integrations/workspaceRoutes'
|
|
42
|
+
import { WorkspaceScreen } from './integrations/workspaceScreens'
|
|
43
|
+
import { currentPageLabel } from './utils/page-links'
|
|
44
44
|
import { navigateFromPrimaryRail } from './components/nav/navigation'
|
|
45
45
|
import { useNavRailPinned } from './hooks/useNavRailPinned'
|
|
46
46
|
import { useMediaQuery } from './hooks/useMediaQuery'
|
|
47
47
|
import { ContextSwitchProvider, useContextSwitch } from './context/ContextSwitchContext'
|
|
48
|
-
import { ConnectionProvider, useConnection } from './context/ConnectionContext'
|
|
48
|
+
import { ConnectionProvider, useConnection, refreshQueriesAfterReconnect } from './context/ConnectionContext'
|
|
49
49
|
import { ConnectionErrorView } from './components/ConnectionErrorView'
|
|
50
50
|
import { SyncProgressPanel } from './components/SyncProgressPanel'
|
|
51
51
|
import { NoClusterAccessBanner } from './components/NoClusterAccessBanner'
|
|
@@ -58,12 +58,12 @@ import { openWhatsNew, useWhatsNewStatus, WhatsNew } from './components/whats-ne
|
|
|
58
58
|
import { useUsageData, useUsageRecording } from './api/usage-data'
|
|
59
59
|
import { UsageDataPrompt } from './components/usage-data/UsageDataPrompt'
|
|
60
60
|
import { ShortcutHelpOverlay } from './components/ui/ShortcutHelpOverlay'
|
|
61
|
-
import { DiagnosticsOverlay } from './components/ui/DiagnosticsOverlay'
|
|
61
|
+
import { DiagnosticsOverlay, type DiagnosticsFocus } from './components/ui/DiagnosticsOverlay'
|
|
62
62
|
import { useEventSource } from './hooks/useEventSource'
|
|
63
|
-
import { debugNamespaceLog, refetchOnResourceEvents, resourceEventKey, useNamespaces, useNamespaceScope, useSetActiveNamespace, useSwitchContext, useAuthMe, useAudit } from './api/client'
|
|
63
|
+
import { debugNamespaceLog, refetchOnResourceEvents, resourceEventKey, useNamespaces, useNamespaceScope, useSetActiveNamespace, useSwitchContext, useAuthMe, useAudit, useClusterInfo } from './api/client'
|
|
64
64
|
import { buildAuditSeverityMap } from './utils/auditBadges'
|
|
65
65
|
import { isInNamespaceScope, scopeNodesToNamespaces } from './utils/topology-namespace'
|
|
66
|
-
import { routePath, apiUrl, getAuthHeaders, getCredentialsMode, stripBasename } from './api/config'
|
|
66
|
+
import { routePath, apiUrl, getApiBase, getAuthHeaders, getCredentialsMode, stripBasename } from './api/config'
|
|
67
67
|
import { KeyboardShortcutProvider, useRegisterShortcut, useRegisterShortcuts, useSuppressBaseShortcuts } from './hooks/useKeyboardShortcuts'
|
|
68
68
|
import { useAnimatedUnmount } from './hooks/useAnimatedUnmount'
|
|
69
69
|
import { useDocumentTitle } from './hooks/useDocumentTitle'
|
|
@@ -75,7 +75,9 @@ import { Tooltip } from './components/ui/Tooltip'
|
|
|
75
75
|
import { LargeClusterNamespacePicker } from './components/shared/LargeClusterNamespacePicker'
|
|
76
76
|
import { SettingsDialog, type SettingsSectionId } from './components/settings/SettingsDialog'
|
|
77
77
|
import type { APIResource, TopologyNode, GroupingMode, MainView, SelectedResource, SelectedHelmRelease, NodeKind, TopologyMode, Topology, K8sEvent } from './types'
|
|
78
|
-
import {
|
|
78
|
+
import { createViewMemory } from './utils/viewMemory'
|
|
79
|
+
import { createKindFilterStore } from './utils/kindFilterStore'
|
|
80
|
+
import { kindToPluralWithGroup, pluralToKind, openExternal, apiVersionToGroup, relatedResourcePath, searchHitToSelectedResource, withCrossViewParams, writeViewParams, CROSS_VIEW_PARAMS, namespacesFromSearch } from './utils/navigation'
|
|
79
81
|
import { findSelectedTopologyNode } from './utils/topology-selection'
|
|
80
82
|
import { type OmnibarHandle } from './components/ui/Omnibar'
|
|
81
83
|
import { RadarOmnibar } from './components/ui/RadarOmnibar'
|
|
@@ -83,7 +85,7 @@ import type { ContextSwitcherHandle } from './components/ContextSwitcher'
|
|
|
83
85
|
|
|
84
86
|
// All possible node kinds (core + GitOps)
|
|
85
87
|
const ALL_NODE_KINDS: NodeKind[] = [
|
|
86
|
-
'Internet', 'Ingress', 'Gateway', 'HTTPRoute', 'GRPCRoute', 'TCPRoute', 'TLSRoute',
|
|
88
|
+
'Internet', 'Ingress', 'Gateway', 'HTTPRoute', 'GRPCRoute', 'TCPRoute', 'TLSRoute', 'UDPRoute',
|
|
87
89
|
'Service', 'Deployment', 'Rollout', 'DaemonSet', 'StatefulSet',
|
|
88
90
|
'ReplicaSet', 'Pod', 'PodGroup', 'ConfigMap', 'Secret', 'ServiceAccount', 'SealedSecret', 'ServiceMonitor', 'PodMonitor', 'HorizontalPodAutoscaler', 'Job', 'CronJob', 'PersistentVolumeClaim', 'Namespace',
|
|
89
91
|
'Application', 'Kustomization', 'HelmRelease', 'GitRepository',
|
|
@@ -141,8 +143,8 @@ function getViewFromPath(pathname: string): ExtendedMainView {
|
|
|
141
143
|
if (path === 'helm') return 'helm'
|
|
142
144
|
if (path === 'traffic') return 'traffic'
|
|
143
145
|
if (path === 'cost') return 'cost'
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
+
const workspace = workspaceForPath(pathname)
|
|
147
|
+
if (workspace) return workspace.id
|
|
146
148
|
if (path === 'workload') return 'workload'
|
|
147
149
|
if (path === 'checks' || path === 'audit') return 'checks' // /audit = legacy → checks
|
|
148
150
|
if (path === 'gitops') return 'gitops'
|
|
@@ -167,13 +169,14 @@ function usageView(pathname: string, view: ExtendedMainView, upgrade: boolean):
|
|
|
167
169
|
|
|
168
170
|
// The screen a crash is counted under. Fixed names, because release builds
|
|
169
171
|
// shorten component names and the component stack can't say which screen.
|
|
170
|
-
const CRASH_LABELS
|
|
172
|
+
const CRASH_LABELS = {
|
|
171
173
|
home: 'Home', topology: 'Topology', resources: 'Resources', timeline: 'Timeline',
|
|
172
174
|
issues: 'Issues', helm: 'Helm', helmCompare: 'HelmCompare', traffic: 'Traffic',
|
|
173
|
-
cost: 'Cost',
|
|
175
|
+
cost: 'Cost', checks: 'Checks', gitops: 'GitOps',
|
|
174
176
|
applications: 'Applications', workload: 'Workload', compare: 'Compare',
|
|
175
177
|
investigations: 'Investigations',
|
|
176
|
-
|
|
178
|
+
...workspaceLabels,
|
|
179
|
+
} satisfies Record<ExtendedMainView, string>
|
|
177
180
|
|
|
178
181
|
// The namespace scope filter is meaningful only on namespaced surfaces. On
|
|
179
182
|
// cluster-scoped views it does nothing, so we disable it with an explanation
|
|
@@ -203,12 +206,8 @@ function namespaceFilterDisabled(
|
|
|
203
206
|
tooltip: 'Cost is reported per namespace across the whole cluster — the namespace filter doesn’t apply here.',
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
disabled: true,
|
|
209
|
-
tooltip: 'Capacity is reported across the cluster — the namespace filter doesn’t apply here.',
|
|
210
|
-
}
|
|
211
|
-
}
|
|
209
|
+
const workspace = workspaceForView(view)
|
|
210
|
+
if (workspace?.namespaceScope === 'cluster') return { disabled: true, tooltip: workspace.namespaceFilterTooltip }
|
|
212
211
|
if (view === 'checks' && pathname.startsWith('/checks/upgrade')) {
|
|
213
212
|
return {
|
|
214
213
|
disabled: true,
|
|
@@ -263,6 +262,8 @@ function radarPageTitle(pathname: string, search = '', apiResources?: APIResourc
|
|
|
263
262
|
const resourceName = decode(pathSegments[1] ?? '')
|
|
264
263
|
if (!resourceName) return 'Resources'
|
|
265
264
|
const group = new URLSearchParams(search).get('apiGroup') || ''
|
|
265
|
+
const hostTitle = resourceKindListTitle({ name: resourceName, group })
|
|
266
|
+
if (hostTitle) return hostTitle
|
|
266
267
|
const match = findAPIResourceForRoute(apiResources, resourceName, group)
|
|
267
268
|
return pluralKindTitle(match?.kind ?? pluralToKind(resourceName), resourceName)
|
|
268
269
|
}
|
|
@@ -281,18 +282,8 @@ function radarPageTitle(pathname: string, search = '', apiResources?: APIResourc
|
|
|
281
282
|
if (view === 'checks' && pathSegments[1] === 'upgrade') return 'Upgrade impact'
|
|
282
283
|
|
|
283
284
|
// The landing view reads "Overview" rather than "Home" in the tab.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (pathSegments[1] === 'demand') return 'Capacity Demand'
|
|
287
|
-
if (pathSegments[1] === 'activity') return 'Capacity Activity'
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (view === 'cnpg') {
|
|
291
|
-
const route = parseCNPGRoute(pathname)
|
|
292
|
-
if (route.detail) return route.detail.name
|
|
293
|
-
const screen = CNPG_SCREENS.find((s) => s.id === route.screen)
|
|
294
|
-
return `CloudNativePG ${screen?.label ?? 'Overview'}`
|
|
295
|
-
}
|
|
285
|
+
const workspace = workspaceForView(view)
|
|
286
|
+
if (workspace) return workspace.pageTitle(pathname)
|
|
296
287
|
if (view === 'home') return 'Overview'
|
|
297
288
|
// Every other view's label is its id capitalized — getViewFromPath has already
|
|
298
289
|
// normalized aliases (e.g. /audit → 'checks'), so no lookup table is needed.
|
|
@@ -351,6 +342,7 @@ interface AppProps {
|
|
|
351
342
|
}
|
|
352
343
|
|
|
353
344
|
function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadStateChange }: AppProps) {
|
|
345
|
+
useLayoutEffect(() => () => resetNavigationMap(), [])
|
|
354
346
|
const navigate = useNavigate()
|
|
355
347
|
const location = useLocation()
|
|
356
348
|
const navigationType = useNavigationType()
|
|
@@ -424,24 +416,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
424
416
|
}
|
|
425
417
|
}, [navigate])
|
|
426
418
|
|
|
427
|
-
// Parse namespaces from URL (supports both 'namespaces' and legacy 'namespace')
|
|
428
|
-
const parseNamespacesFromURL = (params: URLSearchParams): string[] => {
|
|
429
|
-
// Prefer 'namespaces' (plural, comma-separated)
|
|
430
|
-
const nsParam = params.get('namespaces')
|
|
431
|
-
if (nsParam) {
|
|
432
|
-
return nsParam.split(',').map(s => s.trim()).filter(Boolean)
|
|
433
|
-
}
|
|
434
|
-
// Fall back to 'namespace' (singular) for backward compatibility
|
|
435
|
-
const ns = params.get('namespace')
|
|
436
|
-
if (ns) {
|
|
437
|
-
return [ns]
|
|
438
|
-
}
|
|
439
|
-
return []
|
|
440
|
-
}
|
|
441
|
-
|
|
442
419
|
// Initialize state from URL
|
|
443
420
|
const getInitialState = () => {
|
|
444
|
-
const namespaces =
|
|
421
|
+
const namespaces = namespacesFromSearch(searchParams)
|
|
445
422
|
return {
|
|
446
423
|
namespaces,
|
|
447
424
|
topologyMode: (searchParams.get('mode') as TopologyMode) || 'resources',
|
|
@@ -452,6 +429,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
452
429
|
|
|
453
430
|
// Get mainView from URL path
|
|
454
431
|
const mainView = getViewFromPath(location.pathname)
|
|
432
|
+
const activeWorkspace = workspaceForView(mainView)
|
|
455
433
|
const upgradeReadinessRoute = location.pathname.startsWith('/checks/upgrade')
|
|
456
434
|
|
|
457
435
|
// Opt-in usage data. Embedded hosts own their own consent, so Radar never asks there.
|
|
@@ -459,12 +437,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
459
437
|
// A status cached by another screen must not start recording inside a host.
|
|
460
438
|
useUsageRecording(usageView(location.pathname, mainView, upgradeReadinessRoute), navCustomization.embedded ? undefined : usageData.data)
|
|
461
439
|
|
|
462
|
-
//
|
|
463
|
-
// mount) so the omnibar can open a CRD hit with an irregular plural from any
|
|
464
|
-
// view — kindToPlural would otherwise English-guess the route before a
|
|
465
|
-
// resources view has run initNavigationMap().
|
|
440
|
+
// The omnibar needs discovered plurals even before ResourcesView mounts.
|
|
466
441
|
const { data: navApiResources } = useAPIResources()
|
|
467
|
-
useEffect(() => { if (navApiResources) initNavigationMap(navApiResources) }, [navApiResources])
|
|
468
442
|
|
|
469
443
|
// View-aware namespace scope: disabled on cluster-scoped surfaces so the
|
|
470
444
|
// chip isn't a dead control next to the cluster switcher.
|
|
@@ -482,15 +456,45 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
482
456
|
return slug || 'pods'
|
|
483
457
|
}, [location.pathname])
|
|
484
458
|
|
|
485
|
-
//
|
|
459
|
+
// Section memory and Resources filters are kept per cluster; inert until the context is known.
|
|
460
|
+
const { data: clusterInfoData, isLoading: clusterInfoLoading } = useClusterInfo()
|
|
461
|
+
const clusterContext = clusterInfoData?.context
|
|
462
|
+
const viewMemory = useMemo(
|
|
463
|
+
() => (clusterContext ? createViewMemory(`${getApiBase()}|${clusterContext}`) : undefined),
|
|
464
|
+
[clusterContext],
|
|
465
|
+
)
|
|
466
|
+
const kindFilterStore = useMemo(
|
|
467
|
+
() => (clusterContext ? createKindFilterStore(`${getApiBase()}|${clusterContext}`) : undefined),
|
|
468
|
+
[clusterContext],
|
|
469
|
+
)
|
|
470
|
+
useEffect(() => {
|
|
471
|
+
viewMemory?.record(mainView, location.pathname, location.search)
|
|
472
|
+
if (mainView === 'resources') kindFilterStore?.recordLastKind(location.pathname, location.search)
|
|
473
|
+
}, [viewMemory, kindFilterStore, mainView, location.pathname, location.search])
|
|
474
|
+
const rememberedKindSearch = useMemo(
|
|
475
|
+
() => kindFilterStore && ((kind: { name: string; group: string }) => kindFilterStore.get(kind.name, kind.group)),
|
|
476
|
+
[kindFilterStore],
|
|
477
|
+
)
|
|
478
|
+
const saveKindFilters = useMemo(
|
|
479
|
+
() => kindFilterStore && ((kind: { name: string; group: string }, search: string) => kindFilterStore.set(kind.name, kind.group, search)),
|
|
480
|
+
[kindFilterStore],
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
// Canonical URL — `/resources` is not stable for bookmarks/sharing; normalize to
|
|
484
|
+
// the last kind (hosts such as Radar Hub link to bare `/resources`), else Pods.
|
|
486
485
|
useEffect(() => {
|
|
487
486
|
const path = location.pathname.replace(/\/+$/, '') || '/'
|
|
488
|
-
|
|
487
|
+
// Wait for the cluster so its last kind can be read; landing on Pods first would overwrite it.
|
|
488
|
+
if (path !== '/resources' || clusterInfoLoading) return
|
|
489
|
+
const current = new URLSearchParams(location.search)
|
|
490
|
+
const onlyCrossView = [...current.keys()].every(key => (CROSS_VIEW_PARAMS as readonly string[]).includes(key))
|
|
491
|
+
const destination = new URL((onlyCrossView && kindFilterStore?.lastKind()) || '/resources/pods', 'http://radar.invalid')
|
|
492
|
+
current.forEach((value, key) => destination.searchParams.set(key, value))
|
|
489
493
|
navigate(
|
|
490
|
-
{ pathname:
|
|
494
|
+
{ pathname: destination.pathname, search: destination.search, hash: location.hash },
|
|
491
495
|
{ replace: true },
|
|
492
496
|
)
|
|
493
|
-
}, [location.pathname, location.search, location.hash, navigate])
|
|
497
|
+
}, [location.pathname, location.search, location.hash, navigate, kindFilterStore, clusterInfoLoading])
|
|
494
498
|
|
|
495
499
|
// Set mainView by navigating to the path
|
|
496
500
|
const setMainView = useCallback((view: ExtendedMainView, params?: Record<string, string>) => {
|
|
@@ -508,6 +512,15 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
508
512
|
}
|
|
509
513
|
}
|
|
510
514
|
|
|
515
|
+
// Explicit params are a link with its own state; otherwise go back to where the user left this section.
|
|
516
|
+
const remembered = params
|
|
517
|
+
? undefined
|
|
518
|
+
: viewMemory?.sectionPath(view) ?? (view === 'resources' ? kindFilterStore?.lastKind() : undefined)
|
|
519
|
+
if (remembered) {
|
|
520
|
+
navigate(withCrossViewParams(remembered, location.search))
|
|
521
|
+
return
|
|
522
|
+
}
|
|
523
|
+
|
|
511
524
|
const path = view === 'home' ? '/' : `/${view}`
|
|
512
525
|
|
|
513
526
|
// Start fresh — keep only cross-view params, discard view-specific ones.
|
|
@@ -532,7 +545,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
532
545
|
}
|
|
533
546
|
|
|
534
547
|
navigate({ pathname: path, search: newParams.toString() })
|
|
535
|
-
}, [location.search, navigate, takeover, goHost])
|
|
548
|
+
}, [location.search, navigate, takeover, goHost, viewMemory, kindFilterStore])
|
|
536
549
|
|
|
537
550
|
const whatsNewStatus = useWhatsNewStatus()
|
|
538
551
|
|
|
@@ -637,6 +650,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
637
650
|
|
|
638
651
|
// Diagnostics overlay state
|
|
639
652
|
const [showDiagnostics, setShowDiagnostics] = useState(false)
|
|
653
|
+
const [diagnosticsFocus, setDiagnosticsFocus] = useState<DiagnosticsFocus>()
|
|
640
654
|
|
|
641
655
|
// The peek drawer "expanded" into a fullscreen overlay = ?full=1 with a selected
|
|
642
656
|
// resource, on ANY view (resources list, topology graph, GitOps, Applications…) —
|
|
@@ -953,7 +967,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
953
967
|
category: 'General' as const,
|
|
954
968
|
scope: 'global' as const,
|
|
955
969
|
allowInInputs: true,
|
|
956
|
-
handler: () => setShowDiagnostics(prev => !prev),
|
|
970
|
+
handler: () => { setDiagnosticsFocus(undefined); setShowDiagnostics(prev => !prev) },
|
|
957
971
|
},
|
|
958
972
|
// Settings exposes local-binary controls that don't apply to embedded hosts.
|
|
959
973
|
// Register the shortcut only when standalone (matching the gear button) —
|
|
@@ -1205,11 +1219,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1205
1219
|
onContextSwitchComplete: endSwitch,
|
|
1206
1220
|
onContextSwitchProgress: updateProgress,
|
|
1207
1221
|
onContextChanged: (context) => {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
//
|
|
1211
|
-
queryClient.
|
|
1212
|
-
queryClient.invalidateQueries()
|
|
1222
|
+
resetNavigationMap()
|
|
1223
|
+
|
|
1224
|
+
// Reconnects also emit context_changed. Preserve only this context's drain record.
|
|
1225
|
+
refreshQueriesAfterReconnect(queryClient, connection.context, context)
|
|
1213
1226
|
|
|
1214
1227
|
// Cancel any pending SSE-driven invalidation — old cluster's events are irrelevant
|
|
1215
1228
|
if (fastInvalidationRef.current.timer !== null) clearTimeout(fastInvalidationRef.current.timer)
|
|
@@ -1248,10 +1261,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1248
1261
|
const nextParams = new URLSearchParams()
|
|
1249
1262
|
const diagnoseRun = new URLSearchParams(location.search).get('ai-run')
|
|
1250
1263
|
if (diagnoseRun) nextParams.set('ai-run', diagnoseRun)
|
|
1251
|
-
|
|
1252
|
-
// not in the new one instead of loading a same-named object.
|
|
1253
|
-
const pinnedCtx = new URLSearchParams(location.search).get('ctx')
|
|
1254
|
-
if (pinnedCtx && location.pathname.startsWith('/cnpg/')) nextParams.set('ctx', pinnedCtx)
|
|
1264
|
+
for (const [key, value] of workspaceContextSwitchSearch(location.pathname, new URLSearchParams(location.search))) nextParams.set(key, value)
|
|
1255
1265
|
navigate(
|
|
1256
1266
|
{ pathname: location.pathname, search: nextParams.toString() },
|
|
1257
1267
|
{ replace: true, state: location.state },
|
|
@@ -1414,11 +1424,13 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1414
1424
|
const setActiveNamespace = useSetActiveNamespace()
|
|
1415
1425
|
// Defer the state flip to onSuccess. Setting namespaces to [] before the
|
|
1416
1426
|
// server-side pref has actually been cleared makes React Query refetch
|
|
1417
|
-
// under the new empty key while
|
|
1418
|
-
//
|
|
1419
|
-
//
|
|
1420
|
-
//
|
|
1421
|
-
//
|
|
1427
|
+
// under the new empty key while a Radar that applies the stored pick to
|
|
1428
|
+
// reads naming no namespace (Hub embeds this UI against such Radars) returns
|
|
1429
|
+
// the previous pick's scope, caching stale data under the new key with no
|
|
1430
|
+
// later invalidation.
|
|
1431
|
+
// onSettled would do the same on errors, leaving the UI showing "All
|
|
1432
|
+
// namespaces" while data is still namespace-scoped — onSuccess keeps state
|
|
1433
|
+
// aligned with the server.
|
|
1422
1434
|
//
|
|
1423
1435
|
// Don't touch the URL here either: setSearchParams on a still-set state
|
|
1424
1436
|
// trips the URL→state sync into firing setNamespaces([]) and a duplicate
|
|
@@ -1432,6 +1444,34 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1432
1444
|
{ onSuccess: () => setNamespaces([]) },
|
|
1433
1445
|
)
|
|
1434
1446
|
}, [namespaceScope?.cacheScoped, namespaces.length, setActiveNamespace])
|
|
1447
|
+
// Same write as the header picker, which then mirrors it into `namespaces`.
|
|
1448
|
+
// The flash shows where that scope lives from now on. The picker owns the
|
|
1449
|
+
// namespace scope from then on, so no kind keeps a Namespace column filter.
|
|
1450
|
+
const [namespacePickerFlash, setNamespacePickerFlash] = useState(0)
|
|
1451
|
+
const applyNamespacesToAllSections = useCallback(
|
|
1452
|
+
(picked: string[]) => setActiveNamespace.mutateAsync({ namespaces: picked }).then(() => {
|
|
1453
|
+
kindFilterStore?.clearColumn('namespace')
|
|
1454
|
+
setNamespacePickerFlash(n => n + 1)
|
|
1455
|
+
}),
|
|
1456
|
+
[setActiveNamespace, kindFilterStore],
|
|
1457
|
+
)
|
|
1458
|
+
const issuesShowNamespace = useMemo(() => {
|
|
1459
|
+
if (namespaceScope?.cacheScoped) {
|
|
1460
|
+
if (!namespaceScope.namespaceRescope) return undefined
|
|
1461
|
+
return {
|
|
1462
|
+
mode: 'switch' as const,
|
|
1463
|
+
show: (ns: string) => { setNamespaces([ns]); setActiveNamespace.mutate({ namespaces: [ns] }) },
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
return {
|
|
1467
|
+
mode: 'add' as const,
|
|
1468
|
+
show: (ns: string) => {
|
|
1469
|
+
const next = namespaces.includes(ns) ? namespaces : [...namespaces, ns]
|
|
1470
|
+
setNamespaces(next)
|
|
1471
|
+
setActiveNamespace.mutate({ namespaces: next })
|
|
1472
|
+
},
|
|
1473
|
+
}
|
|
1474
|
+
}, [namespaceScope?.cacheScoped, namespaceScope?.namespaceRescope, namespaces, setActiveNamespace])
|
|
1435
1475
|
const initialBookmarkReconciledRef = useRef(false)
|
|
1436
1476
|
const scopeActives = useMemo(() => namespaceScope?.actives ?? [], [namespaceScope?.actives])
|
|
1437
1477
|
const namespaceScopeKey = useMemo(() => namespaceScope ? [...scopeActives].sort().join(',') : null, [namespaceScope, scopeActives])
|
|
@@ -1510,32 +1550,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1510
1550
|
if (skipUrlWriteAfterPopRef.current) return
|
|
1511
1551
|
const currentSearch = window.location.search
|
|
1512
1552
|
const params = new URLSearchParams(currentSearch)
|
|
1513
|
-
|
|
1514
|
-
// Update namespaces param
|
|
1515
|
-
if (namespaces.length > 0) {
|
|
1516
|
-
params.set('namespaces', namespaces.join(','))
|
|
1517
|
-
} else {
|
|
1518
|
-
params.delete('namespaces')
|
|
1519
|
-
}
|
|
1520
|
-
// Remove legacy 'namespace' param if present
|
|
1521
|
-
params.delete('namespace')
|
|
1522
|
-
|
|
1523
|
-
// Topology-specific params: only set when on topology view, clean up otherwise
|
|
1524
|
-
if (mainView === 'topology') {
|
|
1525
|
-
if (topologyMode !== 'resources') {
|
|
1526
|
-
params.set('mode', topologyMode)
|
|
1527
|
-
} else {
|
|
1528
|
-
params.delete('mode')
|
|
1529
|
-
}
|
|
1530
|
-
if (groupingMode !== 'none' && (namespaces.length === 0 || groupingMode !== 'namespace')) {
|
|
1531
|
-
params.set('group', groupingMode)
|
|
1532
|
-
} else {
|
|
1533
|
-
params.delete('group')
|
|
1534
|
-
}
|
|
1535
|
-
} else {
|
|
1536
|
-
params.delete('mode')
|
|
1537
|
-
params.delete('group')
|
|
1538
|
-
}
|
|
1553
|
+
writeViewParams(params, namespaces, mainView === 'topology' ? { mode: topologyMode, grouping: groupingMode } : null)
|
|
1539
1554
|
|
|
1540
1555
|
// Only update if params actually changed vs current URL
|
|
1541
1556
|
if (params.toString() !== new URLSearchParams(currentSearch).toString()) {
|
|
@@ -1556,7 +1571,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1556
1571
|
// server while the per-user pick was still narrowed — the picker would
|
|
1557
1572
|
// show the server scope but lists/dashboard would stay on "all namespaces".
|
|
1558
1573
|
useEffect(() => {
|
|
1559
|
-
const urlNamespaces =
|
|
1574
|
+
const urlNamespaces = namespacesFromSearch(searchParams)
|
|
1560
1575
|
debugNamespaceLog('app:url-sync', {
|
|
1561
1576
|
search: searchParams.toString(),
|
|
1562
1577
|
urlNamespaces,
|
|
@@ -1778,7 +1793,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1778
1793
|
setVisibleKinds(new Set())
|
|
1779
1794
|
}, [])
|
|
1780
1795
|
|
|
1781
|
-
const navActiveView = mainView === 'helmCompare' ? 'helm' :
|
|
1796
|
+
const navActiveView = mainView === 'helmCompare' ? 'helm' : activeWorkspace?.navView ?? mainView
|
|
1782
1797
|
|
|
1783
1798
|
return (
|
|
1784
1799
|
<PortForwardProvider>
|
|
@@ -1821,7 +1836,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1821
1836
|
<ScopePill>
|
|
1822
1837
|
<ContextSwitcher ref={contextSwitcherRef} variant="segment" />
|
|
1823
1838
|
<NamespaceSwitcher
|
|
1839
|
+
key={namespacePickerFlash}
|
|
1824
1840
|
ref={namespaceSwitcherRef}
|
|
1841
|
+
className={namespacePickerFlash ? 'reach-flash' : undefined}
|
|
1825
1842
|
variant="segment"
|
|
1826
1843
|
disabled={namespaceFilter.disabled}
|
|
1827
1844
|
disabledTooltip={namespaceFilter.tooltip}
|
|
@@ -2237,7 +2254,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2237
2254
|
)}
|
|
2238
2255
|
|
|
2239
2256
|
{/* Resources view */}
|
|
2240
|
-
{
|
|
2257
|
+
{/* Bare /resources waits for App's redirect to the last kind; mounted, the view would redirect to Pods first. */}
|
|
2258
|
+
{mainView === 'resources' && (location.pathname.replace(/\/+$/, '') || '/') !== '/resources' && (
|
|
2241
2259
|
<ResourcesView
|
|
2242
2260
|
namespaces={namespaces}
|
|
2243
2261
|
selectedResource={routeSelectedResource}
|
|
@@ -2245,6 +2263,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2245
2263
|
onResourceClickYaml={(res) => navigateToResource(res, 'yaml')}
|
|
2246
2264
|
onKindChange={() => setSelectedResource(null)}
|
|
2247
2265
|
onClearNamespaces={clearAllNamespaces}
|
|
2266
|
+
rememberedKindSearch={rememberedKindSearch}
|
|
2267
|
+
onKindFiltersChange={saveKindFilters}
|
|
2268
|
+
// Embedded hosts own their namespace picker, and a cache-scoped
|
|
2269
|
+
// Radar can't take an arbitrary set.
|
|
2270
|
+
onApplyNamespacesToAllSections={namespaceScope?.cacheScoped || !kindFilterStore ? undefined : applyNamespacesToAllSections}
|
|
2248
2271
|
/>
|
|
2249
2272
|
)}
|
|
2250
2273
|
|
|
@@ -2264,6 +2287,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2264
2287
|
setNamespaces([ns])
|
|
2265
2288
|
setActiveNamespace.mutate({ namespaces: [ns] })
|
|
2266
2289
|
}}
|
|
2290
|
+
onOpenDiagnostics={() => { setDiagnosticsFocus('timeline'); setShowDiagnostics(true) }}
|
|
2267
2291
|
/>
|
|
2268
2292
|
)}
|
|
2269
2293
|
|
|
@@ -2328,12 +2352,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2328
2352
|
<CostView namespaces={namespaces} onBack={() => setMainView('home')} onOpenResource={navigateToResource} />
|
|
2329
2353
|
)}
|
|
2330
2354
|
|
|
2331
|
-
{!viewsSyncGated &&
|
|
2332
|
-
<
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
{!viewsSyncGated && mainView === 'cnpg' && (
|
|
2336
|
-
<CNPGView
|
|
2355
|
+
{!viewsSyncGated && activeWorkspace && (
|
|
2356
|
+
<WorkspaceScreen
|
|
2357
|
+
workspace={activeWorkspace}
|
|
2337
2358
|
namespaces={namespaces}
|
|
2338
2359
|
selectedResource={routeSelectedResource}
|
|
2339
2360
|
onOpenResource={navigateToResource}
|
|
@@ -2372,6 +2393,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2372
2393
|
<IssuesPane
|
|
2373
2394
|
namespaces={namespaces}
|
|
2374
2395
|
onNavigateToResource={navigateFromIssue}
|
|
2396
|
+
showNamespace={issuesShowNamespace}
|
|
2375
2397
|
/>
|
|
2376
2398
|
)}
|
|
2377
2399
|
|
|
@@ -2410,10 +2432,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2410
2432
|
onNavigate={(res) => navigateToResource(res)}
|
|
2411
2433
|
canCollapseToDrawer={!isMobile}
|
|
2412
2434
|
onExpand={(res, opts) => {
|
|
2413
|
-
const
|
|
2414
|
-
if (
|
|
2435
|
+
const detailPath = resourceExpandedPath(res, connection.context || undefined, opts?.yaml ? 'yaml' : undefined)
|
|
2436
|
+
if (detailPath) {
|
|
2415
2437
|
navigate(
|
|
2416
|
-
|
|
2438
|
+
detailPath,
|
|
2417
2439
|
{ state: { returnLabel: currentPageLabel(), returnCtx: connection.context } },
|
|
2418
2440
|
)
|
|
2419
2441
|
return
|
|
@@ -2532,7 +2554,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2532
2554
|
{!navCustomization.embedded && <UsageDataPrompt status={usageData.data} />}
|
|
2533
2555
|
|
|
2534
2556
|
{/* Bottom Dock for Terminal/Logs */}
|
|
2535
|
-
<BottomDock />
|
|
2557
|
+
<BottomDock viewNamespaces={namespaces} />
|
|
2536
2558
|
|
|
2537
2559
|
{/* Spacer for dock */}
|
|
2538
2560
|
<DockSpacer />
|
|
@@ -2541,7 +2563,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2541
2563
|
{helpOverlay.shouldRender && <ShortcutHelpOverlay isOpen={helpOverlay.isOpen} onClose={() => setShowHelp(false)} currentView={mainView} />}
|
|
2542
2564
|
|
|
2543
2565
|
{/* Diagnostics overlay */}
|
|
2544
|
-
{diagnosticsOverlay.shouldRender && <DiagnosticsOverlay isOpen={diagnosticsOverlay.isOpen} onClose={() => setShowDiagnostics(false)} />}
|
|
2566
|
+
{diagnosticsOverlay.shouldRender && <DiagnosticsOverlay isOpen={diagnosticsOverlay.isOpen} focus={diagnosticsFocus} onClose={() => { setShowDiagnostics(false); setDiagnosticsFocus(undefined) }} />}
|
|
2545
2567
|
|
|
2546
2568
|
{/* Settings dialog — My permissions is rendered inline in its own section */}
|
|
2547
2569
|
<SettingsDialog
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { ApiError } from './client'
|
|
3
|
+
import { cnpgActionErrorCode } from './cnpg'
|
|
4
|
+
import { actionCompleted, actionOutcomeLocked } from './actions'
|
|
5
|
+
|
|
6
|
+
describe('cnpgActionErrorCode', () => {
|
|
7
|
+
it('keeps the server code when there is one', () => {
|
|
8
|
+
expect(cnpgActionErrorCode(new ApiError('changed', 409, { code: 'changed' }))).toBe('changed')
|
|
9
|
+
})
|
|
10
|
+
it('treats a lost connection or an apiserver timeout as an unknown outcome', () => {
|
|
11
|
+
expect(cnpgActionErrorCode(new TypeError('Failed to fetch'))).toBe('outcome_unknown')
|
|
12
|
+
expect(cnpgActionErrorCode(new ApiError('timeout', 504))).toBe('outcome_unknown')
|
|
13
|
+
expect(cnpgActionErrorCode(new ApiError('internal', 500))).toBe('outcome_unknown')
|
|
14
|
+
})
|
|
15
|
+
it('treats an uncoded 503 as unknown: a proxy may have forwarded the write before the upstream reset', () => {
|
|
16
|
+
const reset = new ApiError('upstream connect error or disconnect/reset before headers', 503)
|
|
17
|
+
expect(cnpgActionErrorCode(reset)).toBe('outcome_unknown')
|
|
18
|
+
expect(actionOutcomeLocked(reset)).toBe(true)
|
|
19
|
+
})
|
|
20
|
+
it('treats refusals before any write as known failures', () => {
|
|
21
|
+
expect(cnpgActionErrorCode(new ApiError('webhook down', 503, { code: 'operator_webhook_unavailable' }))).toBe('operator_webhook_unavailable')
|
|
22
|
+
expect(actionOutcomeLocked(new ApiError('webhook down', 503, { code: 'operator_webhook_unavailable' }))).toBe(false)
|
|
23
|
+
expect(actionOutcomeLocked(new ApiError('Not connected to cluster', 503, { error: 'Not connected to cluster', code: 'unavailable' }))).toBe(false)
|
|
24
|
+
expect(cnpgActionErrorCode(new ApiError('forbidden', 403))).toBeUndefined()
|
|
25
|
+
expect(cnpgActionErrorCode(null)).toBeUndefined()
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('partial outcomes', () => {
|
|
30
|
+
const partial = new ApiError('stopped', 403, { code: 'partial', completed: ['deleted PVC pg-2', 'deleted PVC pg-2-wal'] })
|
|
31
|
+
it('locks confirm and lists what already happened, whatever the status', () => {
|
|
32
|
+
expect(cnpgActionErrorCode(partial)).toBe('partial')
|
|
33
|
+
expect(actionOutcomeLocked(partial)).toBe(true)
|
|
34
|
+
expect(actionCompleted(partial)).toEqual(['deleted PVC pg-2', 'deleted PVC pg-2-wal'])
|
|
35
|
+
})
|
|
36
|
+
it('leaves known refusals unlocked', () => {
|
|
37
|
+
expect(actionOutcomeLocked(new ApiError('changed', 409, { code: 'changed' }))).toBe(false)
|
|
38
|
+
expect(actionCompleted(new ApiError('changed', 409, { code: 'changed' }))).toEqual([])
|
|
39
|
+
})
|
|
40
|
+
})
|