@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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
5
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
6
|
+
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
|
7
|
+
import { KyvernoPolicyCoverage } from './KyvernoPolicyCoverage'
|
|
8
|
+
|
|
9
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
10
|
+
|
|
11
|
+
const requested: URL[] = []
|
|
12
|
+
let root: ReturnType<typeof createRoot>
|
|
13
|
+
let client: QueryClient
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
requested.length = 0
|
|
17
|
+
vi.stubGlobal('fetch', vi.fn((input: RequestInfo | URL) => {
|
|
18
|
+
requested.push(new URL(String(input), 'http://radar.invalid'))
|
|
19
|
+
return new Promise<Response>(() => {})
|
|
20
|
+
}))
|
|
21
|
+
root = createRoot(document.createElement('div'))
|
|
22
|
+
client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
afterEach(async () => {
|
|
26
|
+
await act(async () => root.unmount())
|
|
27
|
+
client.clear()
|
|
28
|
+
vi.unstubAllGlobals()
|
|
29
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
async function coverageRequest(policy: object, url: string) {
|
|
33
|
+
await act(async () => {
|
|
34
|
+
root.render(
|
|
35
|
+
<QueryClientProvider client={client}>
|
|
36
|
+
<MemoryRouter initialEntries={[url]}>
|
|
37
|
+
<KyvernoPolicyCoverage data={policy} />
|
|
38
|
+
</MemoryRouter>
|
|
39
|
+
</QueryClientProvider>,
|
|
40
|
+
)
|
|
41
|
+
})
|
|
42
|
+
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 0)) })
|
|
43
|
+
const coverage = requested.find((u) => u.pathname.includes('/policy/policies/'))
|
|
44
|
+
if (!coverage) throw new Error(`no coverage request: ${requested.map(String).join(', ')}`)
|
|
45
|
+
return { namespace: coverage.searchParams.get('namespace'), namespaces: coverage.searchParams.get('namespaces') }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
it("narrows a ClusterPolicy's subjects to the namespaces in view", async () => {
|
|
49
|
+
const clusterPolicy = { kind: 'ClusterPolicy', metadata: { name: 'require-limits' } }
|
|
50
|
+
expect(await coverageRequest(clusterPolicy, '/resources/clusterpolicies?namespaces=team-a,team-b'))
|
|
51
|
+
.toEqual({ namespace: null, namespaces: 'team-a,team-b' })
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('lists every namespace when the view covers all', async () => {
|
|
55
|
+
const clusterPolicy = { kind: 'ClusterPolicy', metadata: { name: 'require-limits' } }
|
|
56
|
+
expect(await coverageRequest(clusterPolicy, '/resources/clusterpolicies'))
|
|
57
|
+
.toEqual({ namespace: null, namespaces: null })
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it("keeps a namespaced Policy on its own namespace", async () => {
|
|
61
|
+
const policy = { kind: 'Policy', metadata: { name: 'require-limits', namespace: 'team-a' } }
|
|
62
|
+
expect(await coverageRequest(policy, '/resources/policies?namespaces=team-b'))
|
|
63
|
+
.toEqual({ namespace: 'team-a', namespaces: null })
|
|
64
|
+
})
|
|
@@ -3,6 +3,7 @@ import { useLocation } from 'react-router-dom'
|
|
|
3
3
|
import { PolicyCoverageSection } from '@skyhook-io/k8s-ui/components/resources/renderers/PolicyCoverageSection'
|
|
4
4
|
import type { PolicyCoverageSubject, ResourceRef } from '@skyhook-io/k8s-ui'
|
|
5
5
|
import { usePolicyCoverage } from '../../../api/policy'
|
|
6
|
+
import { namespacesFromSearch } from '../../../utils/navigation'
|
|
6
7
|
|
|
7
8
|
/** Mirrors maxPolicyCoverageSubjectsHard in internal/server/policy_handlers.go —
|
|
8
9
|
* asking for more than the server will send just returns the same list. */
|
|
@@ -32,13 +33,11 @@ export function KyvernoPolicyCoverage({
|
|
|
32
33
|
// ceiling — past which the response says what it could not send.
|
|
33
34
|
const [limit, setLimit] = useState<number | undefined>(undefined)
|
|
34
35
|
|
|
35
|
-
//
|
|
36
|
-
// the
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// behaviour you get depends on where you navigated from.
|
|
41
|
-
const viewFilter = useLocation().search
|
|
36
|
+
// A ClusterPolicy's subjects are narrowed to the header's namespace filter,
|
|
37
|
+
// which the server applies only when the request names it. A namespaced
|
|
38
|
+
// Policy's own namespace is its filter.
|
|
39
|
+
const viewNamespaces = namespacesFromSearch(new URLSearchParams(useLocation().search))
|
|
40
|
+
const viewFilter = namespace ? [] : viewNamespaces
|
|
42
41
|
const query = usePolicyCoverage(name, namespace || undefined, !!name, limit, viewFilter)
|
|
43
42
|
|
|
44
43
|
return (
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import type { useArgoStatus } from '../../api/client'
|
|
4
|
+
import type { IntegrationProfile } from './LocalConnectionSettings'
|
|
5
|
+
import { LocalIntegrationStatus } from './LocalIntegrationStatus'
|
|
6
|
+
|
|
7
|
+
vi.mock('../../api/client', () => ({
|
|
8
|
+
usePrometheusStatus: () => ({}),
|
|
9
|
+
useOpenCostSummary: () => ({}),
|
|
10
|
+
}))
|
|
11
|
+
|
|
12
|
+
const profile: IntegrationProfile = {
|
|
13
|
+
target: {
|
|
14
|
+
binding: 'opaque',
|
|
15
|
+
context: 'development',
|
|
16
|
+
source: '/configs/team',
|
|
17
|
+
inFileName: 'dev',
|
|
18
|
+
fingerprint: 'target',
|
|
19
|
+
clientGeneration: 1,
|
|
20
|
+
operationGeneration: 1,
|
|
21
|
+
identity: { server: 'https://kubernetes', user: 'developer', trust: 'trust', insecureTls: false },
|
|
22
|
+
},
|
|
23
|
+
revision: 'revision',
|
|
24
|
+
state: 'saved',
|
|
25
|
+
mode: 'auto',
|
|
26
|
+
url: '',
|
|
27
|
+
headerKeys: [],
|
|
28
|
+
envHeaderKeys: [],
|
|
29
|
+
headersManaged: false,
|
|
30
|
+
secretSet: true,
|
|
31
|
+
insecureTls: false,
|
|
32
|
+
clusterId: '',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const render = (data: Record<string, unknown>) => {
|
|
36
|
+
const argo = { data, isError: false, isPlaceholderData: false, isFetching: false, dataUpdatedAt: 1, errorUpdatedAt: 0 } as unknown as ReturnType<typeof useArgoStatus>
|
|
37
|
+
return renderToStaticMarkup(<LocalIntegrationStatus kind="argocd" profile={profile} argo={argo} busy={false} changedAt={0} />)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
describe('LocalIntegrationStatus for Argo CD', () => {
|
|
41
|
+
it('says Connecting while the first connection is being made', () => {
|
|
42
|
+
const html = render({ configured: true, connected: false, connecting: true })
|
|
43
|
+
expect(html).toContain('Connecting…')
|
|
44
|
+
expect(html).not.toContain('Not connected')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('shows why the last read failed on a working connection', () => {
|
|
48
|
+
const html = render({ configured: true, connected: true, address: 'https://argocd', reason: "Radar's last read from Argo CD failed: the request timed out." })
|
|
49
|
+
expect(html).toContain('Connected')
|
|
50
|
+
expect(html).toContain('the request timed out')
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -26,13 +26,12 @@ export function LocalIntegrationStatus({ kind, profile, argo, busy, changedAt }:
|
|
|
26
26
|
status = prom.data.connected ? 'Connected' : prom.data.discovering ? 'Discovering…' : 'Not connected'
|
|
27
27
|
detail = prom.data.connected ? !profile.url ? `Discovered: ${prom.data.address}` : undefined : prom.data.error
|
|
28
28
|
} else if (kind === 'argocd' && argo.data) {
|
|
29
|
-
status = argo.data.connected ? argo.data.anonymous ? 'Connected · no token needed' : 'Connected' : 'Not connected'
|
|
30
|
-
detail = argo.data.connected
|
|
29
|
+
status = argo.data.connected ? argo.data.anonymous ? 'Connected · no token needed' : 'Connected' : argo.data.connecting ? 'Connecting…' : 'Not connected'
|
|
30
|
+
detail = argo.data.reason ?? (argo.data.connected && !profile.url ? `Discovered: ${argo.data.address}` : undefined)
|
|
31
31
|
} else if (kind === 'cost' && cost.data) {
|
|
32
32
|
status = cost.data.available ? `Available · ${costSourceLabel(cost.data.source)}`
|
|
33
33
|
: ['no_prometheus', 'no_cost_source', 'no_metrics'].includes(cost.data.reason ?? '') ? 'No cost data' : 'Unavailable'
|
|
34
|
-
detail = cost.data.reason ? costIntegrationUnavailableMessage(cost.data.reason)
|
|
35
|
-
?? (cost.data.reason === 'query_error' ? 'The active cost source query failed.' : undefined) : undefined
|
|
34
|
+
detail = cost.data.reason ? costIntegrationUnavailableMessage(cost.data.reason) : undefined
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
const lastDetail = useRef({ text: detail, visible: !!detail })
|
|
@@ -10,7 +10,7 @@ import { clsx } from 'clsx'
|
|
|
10
10
|
import { useQueryClient } from '@tanstack/react-query'
|
|
11
11
|
import { useAnimatedUnmount } from '../../hooks/useAnimatedUnmount'
|
|
12
12
|
import { TRANSITION_BACKDROP, TRANSITION_PANEL, overlayExitMs, overlayTransitionStyle } from '../../utils/animation'
|
|
13
|
-
import { apiUrl, getApiBase, getAuthHeaders, getCredentialsMode,
|
|
13
|
+
import { apiUrl, getApiBase, getAuthHeaders, getCredentialsMode, mcpEndpointUrl } from '../../api/config'
|
|
14
14
|
import {
|
|
15
15
|
useCloudRole, useVersionCheck, useClusterInfo, usePrometheusStatus, useArgoStatus,
|
|
16
16
|
useOpenCostSummary,
|
|
@@ -46,10 +46,6 @@ import { OperatorManagedNotice } from './OperatorManagedNotice'
|
|
|
46
46
|
import { FormSaveActions } from './FormSaveActions'
|
|
47
47
|
export type { SettingsSectionId } from './settings-state'
|
|
48
48
|
|
|
49
|
-
function mcpEndpointUrl(): string {
|
|
50
|
-
return `${window.location.origin}${routePath('/mcp')}`
|
|
51
|
-
}
|
|
52
|
-
|
|
53
49
|
interface Config {
|
|
54
50
|
kubeconfig?: string
|
|
55
51
|
kubeconfigDirs?: string[]
|
|
@@ -68,6 +64,7 @@ interface Config {
|
|
|
68
64
|
argoCdUrl?: string
|
|
69
65
|
argoCdInsecureTls?: boolean
|
|
70
66
|
mcp?: boolean | null
|
|
67
|
+
mcpReadOnly?: boolean | null
|
|
71
68
|
restoreLastDesktopContext?: boolean | null
|
|
72
69
|
}
|
|
73
70
|
|
|
@@ -134,6 +131,7 @@ function normalizeStartup(c: Config) {
|
|
|
134
131
|
timelineDbPath: c.timelineDbPath ?? '',
|
|
135
132
|
historyLimit: c.historyLimit ?? null,
|
|
136
133
|
mcp: c.mcp ?? true,
|
|
134
|
+
mcpReadOnly: c.mcpReadOnly ?? false,
|
|
137
135
|
restoreLastDesktopContext: c.restoreLastDesktopContext ?? true,
|
|
138
136
|
}
|
|
139
137
|
}
|
|
@@ -242,7 +240,7 @@ export function SettingsDialog({
|
|
|
242
240
|
edN.restoreLastDesktopContext !== svN.restoreLastDesktopContext
|
|
243
241
|
const serverDirty =
|
|
244
242
|
edN.port !== svN.port || edN.noBrowser !== svN.noBrowser || edN.browser !== svN.browser
|
|
245
|
-
const mcpDirty = edN.mcp !== svN.mcp
|
|
243
|
+
const mcpDirty = edN.mcp !== svN.mcp || edN.mcpReadOnly !== svN.mcpReadOnly
|
|
246
244
|
const timelineDirty =
|
|
247
245
|
edN.timelineStorage !== svN.timelineStorage ||
|
|
248
246
|
edN.timelineDbPath !== svN.timelineDbPath ||
|
|
@@ -856,11 +854,8 @@ export function SettingsDialog({
|
|
|
856
854
|
anonymous={argoSectionStatus?.connected && argoSectionStatus.anonymous}
|
|
857
855
|
connectedAddress={argoSectionStatus?.connected && !argoSectionStatus.anonymous ? argoSectionStatus.address : undefined}
|
|
858
856
|
active={section === 'argocd'}
|
|
859
|
-
statusReason={
|
|
860
|
-
|
|
861
|
-
? argoSectionStatus.reason
|
|
862
|
-
: undefined
|
|
863
|
-
}
|
|
857
|
+
statusReason={argoSectionStatus?.configured ? argoSectionStatus.reason : undefined}
|
|
858
|
+
connecting={argoSectionStatus?.connecting}
|
|
864
859
|
onChangeUrl={(v) => updateConfigField('argoCdUrl', v || undefined)}
|
|
865
860
|
onChangeInsecureTls={(v) => updateConfigField('argoCdInsecureTls', v || undefined)}
|
|
866
861
|
onApplied={({ url, insecureTls, tokenSet }) => {
|
|
@@ -953,7 +948,9 @@ export function SettingsDialog({
|
|
|
953
948
|
<SubHeading>MCP</SubHeading>
|
|
954
949
|
<MCPSection
|
|
955
950
|
mcpEnabled={editedConfig.mcp ?? true}
|
|
956
|
-
onToggle={(v) =>
|
|
951
|
+
onToggle={(v) => setEditedConfig((c) => ({ ...c, mcp: v, mcpReadOnly: v && (c.mcpReadOnly ?? false) }))}
|
|
952
|
+
readOnly={editedConfig.mcpReadOnly ?? false}
|
|
953
|
+
onReadOnlyChange={(v) => updateConfigField('mcpReadOnly', v)}
|
|
957
954
|
isDesktop={isDesktop}
|
|
958
955
|
portPinned={editedConfig.port != null && editedConfig.port > 0}
|
|
959
956
|
onPinPort={(port) => updateConfigField('port', port)}
|
|
@@ -1218,7 +1215,7 @@ function OperatorSettingsSummary({ section, config }: { section: SettingsSection
|
|
|
1218
1215
|
break
|
|
1219
1216
|
case 'argocd':
|
|
1220
1217
|
rows = [
|
|
1221
|
-
['Status', argoError ? 'Status unavailable' : !argo ? 'Checking…' : argo.connected ? 'Connected' : 'Not connected'],
|
|
1218
|
+
['Status', argoError ? 'Status unavailable' : !argo ? 'Checking…' : argo.connected ? 'Connected' : argo.connecting ? 'Connecting…' : 'Not connected'],
|
|
1222
1219
|
['Endpoint', argo?.address || c.argoCdUrl || 'Auto-discovery'],
|
|
1223
1220
|
['Token', config.argoCdTokenSet ? 'Configured' : 'None configured'],
|
|
1224
1221
|
['TLS verification', c.argoCdInsecureTls ? 'Disabled' : 'Enabled'],
|
|
@@ -1238,7 +1235,7 @@ function OperatorSettingsSummary({ section, config }: { section: SettingsSection
|
|
|
1238
1235
|
break
|
|
1239
1236
|
case 'advanced':
|
|
1240
1237
|
rows = [
|
|
1241
|
-
['MCP', c.mcp ? 'Enabled' : 'Disabled'],
|
|
1238
|
+
['MCP', c.mcp ? (c.mcpReadOnly ? 'Read-only' : 'Enabled') : 'Disabled'],
|
|
1242
1239
|
['Timeline storage', c.timelineStorage || 'Memory'],
|
|
1243
1240
|
['Event history limit', c.historyLimit ?? '—'],
|
|
1244
1241
|
]
|
|
@@ -1308,7 +1305,7 @@ function OverviewPanel({ active, onNavigate }: { active: boolean; onNavigate: (s
|
|
|
1308
1305
|
const agentLabel =
|
|
1309
1306
|
diag.agents.find((a) => a.name === diag.selectedAgent)?.label ?? diag.agents[0]?.label
|
|
1310
1307
|
const mcpOn = capabilities.mcpEnabled
|
|
1311
|
-
const mcpUrl = mcpEndpointUrl()
|
|
1308
|
+
const mcpUrl = mcpEndpointUrl(capabilities.mcpReadOnly)
|
|
1312
1309
|
const costMissing = cost?.reason === 'no_prometheus' || cost?.reason === 'no_cost_source' || cost?.reason === 'no_metrics'
|
|
1313
1310
|
const costUnavailableDetail = cost?.reason === 'no_prometheus'
|
|
1314
1311
|
? 'Connect OpenCost metrics in Metrics.'
|
|
@@ -1317,7 +1314,7 @@ function OverviewPanel({ active, onNavigate }: { active: boolean; onNavigate: (s
|
|
|
1317
1314
|
: cost?.reason === 'access_denied'
|
|
1318
1315
|
? 'Your current permissions do not allow cost data.'
|
|
1319
1316
|
: cost?.reason
|
|
1320
|
-
? costIntegrationUnavailableMessage(cost.reason) ?? 'The active cost source
|
|
1317
|
+
? costIntegrationUnavailableMessage(cost.reason) ?? 'The active cost source could not provide data.'
|
|
1321
1318
|
: undefined
|
|
1322
1319
|
|
|
1323
1320
|
const rows: OverviewRow[] = [
|
|
@@ -1347,14 +1344,14 @@ function OverviewPanel({ active, onNavigate }: { active: boolean; onNavigate: (s
|
|
|
1347
1344
|
},
|
|
1348
1345
|
{
|
|
1349
1346
|
id: 'argocd', icon: GitBranch, label: 'Argo CD',
|
|
1350
|
-
tone: argo?.connected ? 'ok' : argo?.configured || argo?.reason ? 'warn' : 'off',
|
|
1351
|
-
value: argo?.connected ? (argo.anonymous ? 'Connected · no token needed' : 'Connected') : 'Not connected',
|
|
1352
|
-
detail: argo?.
|
|
1347
|
+
tone: argo?.connected ? (argo.reason ? 'warn' : 'ok') : argo?.connecting ? 'unknown' : argo?.configured || argo?.reason ? 'warn' : 'off',
|
|
1348
|
+
value: argo?.connected ? (argo.anonymous ? 'Connected · no token needed' : 'Connected') : argo?.connecting ? 'Connecting…' : 'Not connected',
|
|
1349
|
+
detail: argo?.reason ? 'Open Argo CD for connection details.' : argo?.connected ? argo.address : undefined,
|
|
1353
1350
|
},
|
|
1354
1351
|
{
|
|
1355
1352
|
id: 'advanced', icon: Zap, label: 'MCP',
|
|
1356
1353
|
tone: mcpOn ? 'ok' : 'off',
|
|
1357
|
-
value: mcpOn ? 'On' : 'Off',
|
|
1354
|
+
value: mcpOn ? (capabilities.mcpReadOnly ? 'Read-only' : 'On') : 'Off',
|
|
1358
1355
|
detail: mcpOn ? mcpUrl : undefined,
|
|
1359
1356
|
copyable: mcpOn,
|
|
1360
1357
|
},
|
|
@@ -2099,12 +2096,16 @@ function CostSection({
|
|
|
2099
2096
|
|
|
2100
2097
|
function MCPSection({
|
|
2101
2098
|
mcpEnabled,
|
|
2099
|
+
readOnly,
|
|
2100
|
+
onReadOnlyChange,
|
|
2102
2101
|
onToggle,
|
|
2103
2102
|
isDesktop,
|
|
2104
2103
|
portPinned,
|
|
2105
2104
|
onPinPort,
|
|
2106
2105
|
}: {
|
|
2107
2106
|
mcpEnabled: boolean
|
|
2107
|
+
readOnly: boolean
|
|
2108
|
+
onReadOnlyChange: (value: boolean) => void
|
|
2108
2109
|
onToggle: (value: boolean) => void
|
|
2109
2110
|
isDesktop: boolean
|
|
2110
2111
|
portPinned: boolean
|
|
@@ -2113,7 +2114,8 @@ function MCPSection({
|
|
|
2113
2114
|
const [copied, setCopied] = useState(false)
|
|
2114
2115
|
|
|
2115
2116
|
const currentPort = Number(window.location.port) || 80
|
|
2116
|
-
const
|
|
2117
|
+
const capabilities = useCapabilitiesContext()
|
|
2118
|
+
const mcpUrl = mcpEndpointUrl(capabilities.mcpReadOnly)
|
|
2117
2119
|
|
|
2118
2120
|
const handleCopy = () => {
|
|
2119
2121
|
navigator.clipboard.writeText(mcpUrl)
|
|
@@ -2128,8 +2130,8 @@ function MCPSection({
|
|
|
2128
2130
|
return (
|
|
2129
2131
|
<div className="space-y-3">
|
|
2130
2132
|
<p className="text-xs text-theme-text-tertiary">
|
|
2131
|
-
Lets AI tools
|
|
2132
|
-
|
|
2133
|
+
Lets AI tools query this cluster through Radar over the Model Context Protocol.
|
|
2134
|
+
Full mode also allows changes. Settings take effect after restarting Radar.
|
|
2133
2135
|
</p>
|
|
2134
2136
|
<ConfigToggle
|
|
2135
2137
|
label="MCP Server"
|
|
@@ -2137,10 +2139,11 @@ function MCPSection({
|
|
|
2137
2139
|
onChange={onToggle}
|
|
2138
2140
|
/>
|
|
2139
2141
|
|
|
2140
|
-
{mcpEnabled &&
|
|
2142
|
+
{mcpEnabled && <ConfigToggle label="Read-only MCP" value={readOnly} onChange={onReadOnlyChange} />}
|
|
2143
|
+
{mcpEnabled && capabilities.mcpEnabled && (
|
|
2141
2144
|
<div className="space-y-2 pl-0.5">
|
|
2142
2145
|
<div>
|
|
2143
|
-
<label className="block text-xs text-theme-text-secondary mb-1">MCP Endpoint</label>
|
|
2146
|
+
<label className="block text-xs text-theme-text-secondary mb-1">Running MCP Endpoint</label>
|
|
2144
2147
|
<div className="flex items-center gap-2">
|
|
2145
2148
|
<code className="flex-1 px-2.5 py-1.5 text-xs font-mono bg-theme-elevated border border-theme-border rounded-md text-theme-text-primary truncate">
|
|
2146
2149
|
{mcpUrl}
|
|
@@ -2228,6 +2231,7 @@ function ArgoCDConfigField({
|
|
|
2228
2231
|
envError,
|
|
2229
2232
|
cliSession,
|
|
2230
2233
|
statusReason,
|
|
2234
|
+
connecting,
|
|
2231
2235
|
anonymous,
|
|
2232
2236
|
connectedAddress,
|
|
2233
2237
|
active,
|
|
@@ -2242,6 +2246,7 @@ function ArgoCDConfigField({
|
|
|
2242
2246
|
envError?: string
|
|
2243
2247
|
cliSession?: { server: string; user: string; insecure?: boolean }
|
|
2244
2248
|
statusReason?: string
|
|
2249
|
+
connecting?: boolean
|
|
2245
2250
|
anonymous?: boolean
|
|
2246
2251
|
connectedAddress?: string
|
|
2247
2252
|
active?: boolean
|
|
@@ -2250,7 +2255,7 @@ function ArgoCDConfigField({
|
|
|
2250
2255
|
onApplied?: (v: { url: string; insecureTls: boolean; tokenSet: boolean }) => void
|
|
2251
2256
|
}) {
|
|
2252
2257
|
if (envManaged) {
|
|
2253
|
-
return <ArgoCDEnvManagedField url={url} insecureTls={insecureTls} envError={envError} connectedAddress={connectedAddress} statusReason={statusReason} />
|
|
2258
|
+
return <ArgoCDEnvManagedField url={url} insecureTls={insecureTls} envError={envError} connectedAddress={connectedAddress} statusReason={statusReason} connecting={connecting} />
|
|
2254
2259
|
}
|
|
2255
2260
|
return (
|
|
2256
2261
|
<ArgoCDEditableField
|
|
@@ -2259,6 +2264,7 @@ function ArgoCDConfigField({
|
|
|
2259
2264
|
tokenSet={tokenSet}
|
|
2260
2265
|
cliSession={cliSession}
|
|
2261
2266
|
statusReason={statusReason}
|
|
2267
|
+
connecting={connecting}
|
|
2262
2268
|
anonymous={anonymous}
|
|
2263
2269
|
connectedAddress={connectedAddress}
|
|
2264
2270
|
active={active}
|
|
@@ -2279,6 +2285,7 @@ function ArgoCDEnvManagedField({
|
|
|
2279
2285
|
envError,
|
|
2280
2286
|
connectedAddress,
|
|
2281
2287
|
statusReason,
|
|
2288
|
+
connecting,
|
|
2282
2289
|
}: {
|
|
2283
2290
|
url: string
|
|
2284
2291
|
insecureTls: boolean
|
|
@@ -2288,6 +2295,7 @@ function ArgoCDEnvManagedField({
|
|
|
2288
2295
|
// so this is the one thing on it that can change after deploy.
|
|
2289
2296
|
connectedAddress?: string
|
|
2290
2297
|
statusReason?: string
|
|
2298
|
+
connecting?: boolean
|
|
2291
2299
|
}) {
|
|
2292
2300
|
if (envError) {
|
|
2293
2301
|
return (
|
|
@@ -2344,10 +2352,15 @@ function ArgoCDEnvManagedField({
|
|
|
2344
2352
|
<dt className="w-24 shrink-0 text-theme-text-tertiary">Status</dt>
|
|
2345
2353
|
<dd className="min-w-0 truncate text-theme-text-secondary">
|
|
2346
2354
|
{connectedAddress ? (
|
|
2347
|
-
|
|
2348
|
-
<
|
|
2349
|
-
|
|
2350
|
-
|
|
2355
|
+
<>
|
|
2356
|
+
<span className="inline-flex items-center gap-1">
|
|
2357
|
+
<Check className="w-3 h-3 shrink-0 text-green-600 dark:text-green-400/80" />
|
|
2358
|
+
Connected at {connectedAddress}
|
|
2359
|
+
</span>
|
|
2360
|
+
{statusReason && <span className="block whitespace-normal text-warning-text">{statusReason}</span>}
|
|
2361
|
+
</>
|
|
2362
|
+
) : connecting ? (
|
|
2363
|
+
'Connecting…'
|
|
2351
2364
|
) : statusReason ? (
|
|
2352
2365
|
<span className="text-warning-text">Not connected — {statusReason}</span>
|
|
2353
2366
|
) : (
|
|
@@ -2377,6 +2390,7 @@ function ArgoCDEditableField({
|
|
|
2377
2390
|
tokenSet,
|
|
2378
2391
|
cliSession,
|
|
2379
2392
|
statusReason,
|
|
2393
|
+
connecting: serverConnecting,
|
|
2380
2394
|
anonymous,
|
|
2381
2395
|
connectedAddress,
|
|
2382
2396
|
active,
|
|
@@ -2389,6 +2403,7 @@ function ArgoCDEditableField({
|
|
|
2389
2403
|
tokenSet: boolean
|
|
2390
2404
|
cliSession?: { server: string; user: string; insecure?: boolean }
|
|
2391
2405
|
statusReason?: string
|
|
2406
|
+
connecting?: boolean
|
|
2392
2407
|
anonymous?: boolean
|
|
2393
2408
|
connectedAddress?: string
|
|
2394
2409
|
active?: boolean
|
|
@@ -2517,6 +2532,10 @@ function ArgoCDEditableField({
|
|
|
2517
2532
|
</p>
|
|
2518
2533
|
)}
|
|
2519
2534
|
|
|
2535
|
+
{serverConnecting && state.status === 'idle' && !anonymous && !connectedAddress && (
|
|
2536
|
+
<p className="mb-3 text-xs text-theme-text-secondary">Connecting to Argo CD…</p>
|
|
2537
|
+
)}
|
|
2538
|
+
|
|
2520
2539
|
{statusReason && state.status !== 'connected' && (
|
|
2521
2540
|
<div className="mb-3 rounded-md border border-theme-border bg-theme-elevated p-3">
|
|
2522
2541
|
<p className="flex items-center gap-1.5 text-sm font-medium text-warning-text">
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState, useCallback, useMemo } from 'react'
|
|
2
2
|
import {
|
|
3
|
-
SEVERITY_TEXT,
|
|
4
3
|
TimelineList as TimelineListUI,
|
|
5
4
|
eventsForApplication,
|
|
6
5
|
isTimelineProblem,
|
|
@@ -16,7 +15,9 @@ import { isManagedTimelineEvent } from '../../api/timelineSource'
|
|
|
16
15
|
import { TimelineRetentionBanner } from './TimelineRetentionNote'
|
|
17
16
|
import { useHasLimitedAccess } from '../../contexts/CapabilitiesContext'
|
|
18
17
|
import type { NavigateToResource } from '../../utils/navigation'
|
|
19
|
-
import {
|
|
18
|
+
import { TimelineLoadError, TimelineStaleNote } from './TimelineLoadError'
|
|
19
|
+
import { useStickyError } from './useStickyError'
|
|
20
|
+
import { ViewModeToggle } from './ViewModeToggle'
|
|
20
21
|
|
|
21
22
|
export type { ActivityTypeFilter, ActivityFilterKey }
|
|
22
23
|
|
|
@@ -93,9 +94,10 @@ interface TimelineListProps {
|
|
|
93
94
|
appScoped?: boolean
|
|
94
95
|
topology?: Topology
|
|
95
96
|
appScopeLoading?: boolean
|
|
97
|
+
onOpenDiagnostics?: () => void
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
export function TimelineList({ namespaces, onViewChange, currentView, onResourceClick, initialFilter, initialTimeRange, showDeleted, onShowDeletedChange, showRoutine, onShowRoutineChange, search, onSearchChange, activityFilter, onActivityFilterChange, kindFilter, onKindFilterChange, selectionWindow, onVisibleWindowChange, scrollToMs, focusedAppIndex, appScoped = false, topology, appScopeLoading = false }: TimelineListProps) {
|
|
100
|
+
export function TimelineList({ namespaces, onViewChange, currentView, onResourceClick, initialFilter, initialTimeRange, showDeleted, onShowDeletedChange, showRoutine, onShowRoutineChange, search, onSearchChange, activityFilter, onActivityFilterChange, kindFilter, onKindFilterChange, selectionWindow, onVisibleWindowChange, scrollToMs, focusedAppIndex, appScoped = false, topology, appScopeLoading = false, onOpenDiagnostics }: TimelineListProps) {
|
|
99
101
|
const hasLimitedAccess = useHasLimitedAccess()
|
|
100
102
|
const timelineSource = useTimelineSource()
|
|
101
103
|
const [queryParams, setQueryParams] = useState<{ timeRange: TimeRange; kinds: string[] }>({
|
|
@@ -112,7 +114,7 @@ export function TimelineList({ namespaces, onViewChange, currentView, onResource
|
|
|
112
114
|
const splitRows = !appScoped
|
|
113
115
|
// Uncapped when splitting: each part gets its own cap below. The rows come
|
|
114
116
|
// from the loaded ring, so this costs no extra fetch.
|
|
115
|
-
const { data: fetchedEvents, isLoading, isError, error, refetch } = timelineSource.useEvents({
|
|
117
|
+
const { data: fetchedEvents, isLoading, isFetching, isError, error, refetch } = timelineSource.useEvents({
|
|
116
118
|
namespaces,
|
|
117
119
|
kinds: queryParams.kinds,
|
|
118
120
|
timeRange: queryParams.timeRange,
|
|
@@ -123,6 +125,7 @@ export function TimelineList({ namespaces, onViewChange, currentView, onResource
|
|
|
123
125
|
fromMs: selectionWindow?.fromMs,
|
|
124
126
|
toMs: selectionWindow?.toMs,
|
|
125
127
|
})
|
|
128
|
+
const loadError = useStickyError(error, fetchedEvents != null)
|
|
126
129
|
const split = useMemo(
|
|
127
130
|
() => (splitRows && fetchedEvents ? splitRoutineActivity(fetchedEvents, fetchLimit) : undefined),
|
|
128
131
|
[splitRows, fetchedEvents, fetchLimit],
|
|
@@ -141,21 +144,22 @@ export function TimelineList({ namespaces, onViewChange, currentView, onResource
|
|
|
141
144
|
|
|
142
145
|
// Full-screen error only when nothing is loaded; a failing background poll
|
|
143
146
|
// with data on screen keeps rendering (data before error).
|
|
144
|
-
if (
|
|
147
|
+
if (loadError && !fetchedEvents) {
|
|
145
148
|
return (
|
|
146
|
-
<div className="flex flex-col
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
<div className="flex flex-col h-full">
|
|
150
|
+
{currentView && onViewChange && (
|
|
151
|
+
<div className="flex items-center justify-between px-4 py-2 border-b border-theme-border">
|
|
152
|
+
<div />
|
|
153
|
+
<ViewModeToggle viewMode={currentView} onViewModeChange={onViewChange} />
|
|
154
|
+
</div>
|
|
151
155
|
)}
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
<TimelineLoadError
|
|
157
|
+
className="flex-1"
|
|
158
|
+
error={loadError}
|
|
159
|
+
retrying={isFetching}
|
|
160
|
+
onRetry={() => refetch()}
|
|
161
|
+
onOpenDiagnostics={onOpenDiagnostics}
|
|
162
|
+
/>
|
|
159
163
|
</div>
|
|
160
164
|
)
|
|
161
165
|
}
|
|
@@ -165,13 +169,7 @@ export function TimelineList({ namespaces, onViewChange, currentView, onResource
|
|
|
165
169
|
// view-level banner already reports the shared failure, and a second note
|
|
166
170
|
// would double up.
|
|
167
171
|
const staleNote = isError && fetchedEvents && !selectionWindow ? (
|
|
168
|
-
<
|
|
169
|
-
<AlertTriangle className={`h-3.5 w-3.5 shrink-0 ${SEVERITY_TEXT.warning}`} />
|
|
170
|
-
Live updates are failing — the list may be stale.
|
|
171
|
-
<button type="button" onClick={() => refetch()} className="underline hover:text-theme-text-primary">
|
|
172
|
-
Retry now
|
|
173
|
-
</button>
|
|
174
|
-
</div>
|
|
172
|
+
<TimelineStaleNote error={error} subject="list" onRetry={() => refetch()} />
|
|
175
173
|
) : null
|
|
176
174
|
|
|
177
175
|
return (
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import { ApiError } from '../../api/client'
|
|
4
|
+
import { TimelineLoadError, TimelineStaleNote } from './TimelineLoadError'
|
|
5
|
+
|
|
6
|
+
const driverError = 'open PostgreSQL timeline database: dial tcp 10.0.0.5:5432: connect: connection refused'
|
|
7
|
+
|
|
8
|
+
function databaseDown(): ApiError {
|
|
9
|
+
return new ApiError('Timeline history is unavailable because Radar can\'t connect to its PostgreSQL database.', 503, {
|
|
10
|
+
error_code: 'timeline_database_unreachable',
|
|
11
|
+
detail: driverError,
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function render(error: Error, onOpenDiagnostics?: () => void): string {
|
|
16
|
+
return renderToStaticMarkup(
|
|
17
|
+
<TimelineLoadError error={error} onRetry={() => {}} onOpenDiagnostics={onOpenDiagnostics} />,
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('TimelineLoadError', () => {
|
|
22
|
+
it('names the database and points to the logs when PostgreSQL is unreachable', () => {
|
|
23
|
+
const html = render(databaseDown(), () => {})
|
|
24
|
+
expect(html).toContain('Timeline history is unavailable')
|
|
25
|
+
expect(html).toContain('can't connect to its PostgreSQL database')
|
|
26
|
+
expect(html).toContain('[timeline]')
|
|
27
|
+
// The driver's error names the database host; it belongs in the logs and
|
|
28
|
+
// diagnostics, not on the page.
|
|
29
|
+
expect(html).not.toContain(driverError)
|
|
30
|
+
expect(html).toContain('Open diagnostics')
|
|
31
|
+
expect(html).not.toContain('Failed to load timeline data')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('omits the diagnostics link when the host cannot open diagnostics', () => {
|
|
35
|
+
expect(render(databaseDown())).not.toContain('Open diagnostics')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('keeps the generic state, without a diagnostics link, for other failures', () => {
|
|
39
|
+
const html = render(new ApiError('upstream timed out', 502, { error: 'upstream timed out' }), () => {})
|
|
40
|
+
expect(html).toContain('Failed to load timeline data')
|
|
41
|
+
expect(html).toContain('upstream timed out')
|
|
42
|
+
expect(html).not.toContain('Open diagnostics')
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('TimelineStaleNote', () => {
|
|
47
|
+
const note = (error: Error) =>
|
|
48
|
+
renderToStaticMarkup(<TimelineStaleNote error={error} subject="timeline" onRetry={() => {}} />)
|
|
49
|
+
|
|
50
|
+
it('names the database and points to the logs when PostgreSQL is the cause', () => {
|
|
51
|
+
const html = note(databaseDown())
|
|
52
|
+
expect(html).toContain('can't connect to its PostgreSQL database, so the timeline may be stale')
|
|
53
|
+
expect(html).toContain('[timeline]')
|
|
54
|
+
expect(html).not.toContain(driverError)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('keeps the generic note for other failures', () => {
|
|
58
|
+
const html = note(new ApiError('upstream timed out', 502, { error: 'upstream timed out' }))
|
|
59
|
+
expect(html).toContain('Live updates are failing, so the timeline may be stale')
|
|
60
|
+
expect(html).not.toContain('PostgreSQL')
|
|
61
|
+
})
|
|
62
|
+
})
|