@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useState } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-dom";
|
|
3
|
-
import { useIssues } from "../../api/client";
|
|
2
|
+
import { useNavigate, useSearchParams } from "react-router-dom";
|
|
3
|
+
import { useIssues, useSubjectIssues, type SubjectIssuesResponse } from "../../api/client";
|
|
4
4
|
import {
|
|
5
5
|
useAPIResources,
|
|
6
6
|
karpenterCapacityAvailable,
|
|
@@ -9,6 +9,7 @@ import { useCapabilitiesContext } from "../../contexts/CapabilitiesContext";
|
|
|
9
9
|
import { useConnection } from "../../context/ConnectionContext";
|
|
10
10
|
import type { SelectedResource } from "../../types";
|
|
11
11
|
import {
|
|
12
|
+
EmptyState,
|
|
12
13
|
IssuesView,
|
|
13
14
|
PaneLoader,
|
|
14
15
|
PageHeader,
|
|
@@ -21,8 +22,11 @@ import {
|
|
|
21
22
|
type IssueSeverity,
|
|
22
23
|
type SummaryTone,
|
|
23
24
|
} from "@skyhook-io/k8s-ui";
|
|
25
|
+
import { builtinGroupForKind } from "@skyhook-io/k8s-ui/utils/api-resources";
|
|
24
26
|
import { AlertTriangle } from "lucide-react";
|
|
25
27
|
import { IssueDiagnoseButton } from "../diagnose/LocalDiagnoseAction";
|
|
28
|
+
import { uncheckedSourceLines } from "./uncheckedSources";
|
|
29
|
+
import { UncheckedSourceHelp } from "./UncheckedSourceHelp";
|
|
26
30
|
|
|
27
31
|
// A capacity-relevant issue links to its Karpenter diagnosis. Karpenter is
|
|
28
32
|
// always single-cluster (unlike Argo hub-and-spoke), so the issue and the
|
|
@@ -75,6 +79,82 @@ export function capacityHrefForIssue(
|
|
|
75
79
|
return null;
|
|
76
80
|
}
|
|
77
81
|
|
|
82
|
+
/**
|
|
83
|
+
* The subject a link into Issues narrows to (?kind=&apiGroup=&resource=ns/name),
|
|
84
|
+
* or null. The group is `apiGroup`, as in resource links: App's URL sync owns
|
|
85
|
+
* `group` (topology grouping) and drops it on every other view.
|
|
86
|
+
*/
|
|
87
|
+
export function issueSubjectFromParams(params: URLSearchParams): IssueSubject | null {
|
|
88
|
+
const kind = params.get("kind");
|
|
89
|
+
const resource = params.get("resource");
|
|
90
|
+
if (!kind || !resource) return null;
|
|
91
|
+
const group = params.get("apiGroup") ?? "";
|
|
92
|
+
const slash = resource.indexOf("/");
|
|
93
|
+
if (slash < 0) return { kind, group, namespace: "", name: resource };
|
|
94
|
+
const name = resource.slice(slash + 1);
|
|
95
|
+
return name ? { kind, group, namespace: resource.slice(0, slash), name } : null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface IssueSubject {
|
|
99
|
+
kind: string;
|
|
100
|
+
/** The API group; "" for the core group. Tells a CNPG Cluster from a CAPI one. */
|
|
101
|
+
group: string;
|
|
102
|
+
namespace: string;
|
|
103
|
+
name: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The subject's kind, with its API group when that isn't the built-in kind's (a Knative Service). */
|
|
107
|
+
export function issueSubjectKindLabel(subject: IssueSubject): string {
|
|
108
|
+
return subject.group && subject.group !== builtinGroupForKind(subject.kind)
|
|
109
|
+
? `${subject.kind} (${subject.group})`
|
|
110
|
+
: subject.kind;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type IssueSubjectState =
|
|
114
|
+
| { state: "hidden" }
|
|
115
|
+
| { state: "checking" }
|
|
116
|
+
| { state: "unconfirmed"; why: string }
|
|
117
|
+
| { state: "found"; issues: Issue[]; withheld: number }
|
|
118
|
+
| { state: "none" };
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* What can be said about the subject's issues. They come from the per-resource
|
|
122
|
+
* lookup, which matches every grouped member (the list's inline members are
|
|
123
|
+
* capped) by exact API group; an empty answer is "none" only when Radar reads
|
|
124
|
+
* the subject's kind, nothing kept it from the evidence, and RBAC withheld no
|
|
125
|
+
* issue about it.
|
|
126
|
+
*/
|
|
127
|
+
export function issueSubjectState(
|
|
128
|
+
subject: IssueSubject,
|
|
129
|
+
viewNamespaces: string[],
|
|
130
|
+
related: { isLoading: boolean; error: unknown; data: SubjectIssuesResponse | undefined },
|
|
131
|
+
): IssueSubjectState {
|
|
132
|
+
if (subject.namespace && viewNamespaces.length > 0 && !viewNamespaces.includes(subject.namespace)) {
|
|
133
|
+
return { state: "hidden" };
|
|
134
|
+
}
|
|
135
|
+
if (related.error) {
|
|
136
|
+
return { state: "unconfirmed", why: related.error instanceof Error ? related.error.message : String(related.error) };
|
|
137
|
+
}
|
|
138
|
+
const data = related.data;
|
|
139
|
+
if (related.isLoading || !data) return { state: "checking" };
|
|
140
|
+
if (data.issues.length > 0) return { state: "found", issues: data.issues, withheld: data.withheld?.issues ?? 0 };
|
|
141
|
+
if (data.coverage === "unknownKind") return { state: "unconfirmed", why: "this cluster has no such kind" };
|
|
142
|
+
if (data.coverage === "notWatched") return { state: "unconfirmed", why: `Radar isn't watching ${subject.kind}` };
|
|
143
|
+
if (data.coverage === "syncing") return { state: "unconfirmed", why: `Radar is still loading ${subject.kind}` };
|
|
144
|
+
const withheld = data.withheld?.issues ?? 0;
|
|
145
|
+
if (withheld > 0) {
|
|
146
|
+
return { state: "unconfirmed", why: `your permissions withhold ${withheld} ${withheld === 1 ? "issue" : "issues"} about it` };
|
|
147
|
+
}
|
|
148
|
+
const visibility = data.visibility;
|
|
149
|
+
if (visibility?.state === "degraded" || visibility?.state === "limited") {
|
|
150
|
+
return {
|
|
151
|
+
state: "unconfirmed",
|
|
152
|
+
why: `some evidence isn't readable${visibility.impact ? ` (${visibility.impact.replace(/\.$/, "")})` : ""}`,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return { state: "none" };
|
|
156
|
+
}
|
|
157
|
+
|
|
78
158
|
const SEVERITY_TONE: Record<IssueSeverity, SummaryTone> = {
|
|
79
159
|
critical: "error",
|
|
80
160
|
warning: "warning",
|
|
@@ -83,6 +163,8 @@ const SEVERITY_TONE: Record<IssueSeverity, SummaryTone> = {
|
|
|
83
163
|
interface IssuesPaneProps {
|
|
84
164
|
namespaces: string[];
|
|
85
165
|
onNavigateToResource: (resource: SelectedResource) => void;
|
|
166
|
+
/** Brings a namespace into the view filter: added to it, or (where Radar's scope allows only one) switched to it. */
|
|
167
|
+
showNamespace?: { mode: "add" | "switch"; show: (namespace: string) => void };
|
|
86
168
|
}
|
|
87
169
|
|
|
88
170
|
// The per-cluster Issues surface. Renders the same shared triage queue
|
|
@@ -96,9 +178,12 @@ interface IssuesPaneProps {
|
|
|
96
178
|
export function IssuesPane({
|
|
97
179
|
namespaces,
|
|
98
180
|
onNavigateToResource,
|
|
181
|
+
showNamespace,
|
|
99
182
|
}: IssuesPaneProps) {
|
|
100
|
-
const
|
|
101
|
-
|
|
183
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
184
|
+
const subject = useMemo(() => issueSubjectFromParams(searchParams), [searchParams]);
|
|
185
|
+
const { data, isLoading, isFetching, error, dataUpdatedAt, refetch } =
|
|
186
|
+
useIssues(namespaces, !subject);
|
|
102
187
|
const { connection } = useConnection();
|
|
103
188
|
const navigate = useNavigate();
|
|
104
189
|
const apiResources = useAPIResources();
|
|
@@ -110,15 +195,37 @@ export function IssuesPane({
|
|
|
110
195
|
new Set(),
|
|
111
196
|
);
|
|
112
197
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
198
|
+
const subjectHidden =
|
|
199
|
+
!!subject?.namespace && namespaces.length > 0 && !namespaces.includes(subject.namespace);
|
|
200
|
+
const related = useSubjectIssues(subject, !subjectHidden);
|
|
201
|
+
const subjectState = subject
|
|
202
|
+
? issueSubjectState(subject, namespaces, related)
|
|
203
|
+
: null;
|
|
204
|
+
const visibility = subject
|
|
205
|
+
? subjectHidden ? undefined : related.data?.visibility
|
|
206
|
+
: data?.visibility;
|
|
207
|
+
const pageIssues = useMemo(() => data?.issues ?? [], [data]);
|
|
208
|
+
const uncheckedLines = subject ? [] : uncheckedSourceLines(data?.unchecked_sources);
|
|
209
|
+
// With a subject set, the tiles and the list both describe the subject.
|
|
210
|
+
const scopeIssues = subjectState
|
|
211
|
+
? subjectState.state === "found" ? subjectState.issues : []
|
|
212
|
+
: pageIssues;
|
|
213
|
+
const totals: Record<IssueSeverity, number> = { critical: 0, warning: 0 };
|
|
214
|
+
for (const i of scopeIssues) totals[i.severity] = (totals[i.severity] ?? 0) + 1;
|
|
119
215
|
const shown = severityFilter.size
|
|
120
|
-
?
|
|
121
|
-
:
|
|
216
|
+
? scopeIssues.filter((i) => severityFilter.has(i.severity))
|
|
217
|
+
: scopeIssues;
|
|
218
|
+
const clearSubject = () =>
|
|
219
|
+
setSearchParams(
|
|
220
|
+
(prev) => {
|
|
221
|
+
const next = new URLSearchParams(prev);
|
|
222
|
+
next.delete("kind");
|
|
223
|
+
next.delete("apiGroup");
|
|
224
|
+
next.delete("resource");
|
|
225
|
+
return next;
|
|
226
|
+
},
|
|
227
|
+
{ replace: true },
|
|
228
|
+
);
|
|
122
229
|
|
|
123
230
|
const toggleSeverity = (s: IssueSeverity) =>
|
|
124
231
|
setSeverityFilter((prev) => {
|
|
@@ -136,11 +243,11 @@ export function IssuesPane({
|
|
|
136
243
|
group: ref.group ?? "",
|
|
137
244
|
});
|
|
138
245
|
|
|
139
|
-
if (isLoading) {
|
|
246
|
+
if (!subject && isLoading) {
|
|
140
247
|
return <PaneLoader label="Loading issues…" className="flex-1" />;
|
|
141
248
|
}
|
|
142
249
|
|
|
143
|
-
if (error) {
|
|
250
|
+
if (!subject && error && !data) {
|
|
144
251
|
return (
|
|
145
252
|
<div className="flex-1 flex items-center justify-center text-theme-text-secondary">
|
|
146
253
|
<p>Failed to load issues</p>
|
|
@@ -156,17 +263,20 @@ export function IssuesPane({
|
|
|
156
263
|
description="Live cluster problems — crashes, scheduling failures, bad references — grouped by the resource they affect."
|
|
157
264
|
actions={
|
|
158
265
|
<>
|
|
159
|
-
<FreshnessControl
|
|
266
|
+
{subjectHidden ? null : <FreshnessControl
|
|
160
267
|
mode="auto"
|
|
161
|
-
dataUpdatedAt={dataUpdatedAt}
|
|
162
|
-
onRefresh={() =>
|
|
268
|
+
dataUpdatedAt={subject ? related.dataUpdatedAt : dataUpdatedAt}
|
|
269
|
+
onRefresh={() => {
|
|
270
|
+
if (subject) related.refetch();
|
|
271
|
+
else refetch();
|
|
272
|
+
}}
|
|
163
273
|
connectionState={connection.state}
|
|
164
|
-
/>
|
|
165
|
-
{
|
|
274
|
+
/>}
|
|
275
|
+
{scopeIssues.length > 0 && (
|
|
166
276
|
<>
|
|
167
277
|
<SummaryTile
|
|
168
|
-
label={
|
|
169
|
-
value={
|
|
278
|
+
label={scopeIssues.length === 1 ? "issue" : "issues"}
|
|
279
|
+
value={scopeIssues.length}
|
|
170
280
|
/>
|
|
171
281
|
{ISSUE_SEVERITIES.map((s) =>
|
|
172
282
|
totals[s] > 0 || severityFilter.has(s) ? (
|
|
@@ -186,22 +296,42 @@ export function IssuesPane({
|
|
|
186
296
|
}
|
|
187
297
|
/>
|
|
188
298
|
|
|
299
|
+
{!subject && error && (
|
|
300
|
+
<div className="flex items-start gap-2 rounded-lg border border-theme-border bg-theme-elevated px-3 py-2 text-xs text-theme-text-secondary">
|
|
301
|
+
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-500" aria-hidden />
|
|
302
|
+
<span>Issue refresh failed. Showing the last successful result.</span>
|
|
303
|
+
</div>
|
|
304
|
+
)}
|
|
305
|
+
|
|
189
306
|
{/* Visibility honesty: when RBAC reads are incomplete, an empty queue may
|
|
190
307
|
mean "can't see" rather than "nothing broken" — say so up front so the
|
|
191
308
|
empty state isn't mistaken for a clean bill of health. */}
|
|
192
|
-
{
|
|
309
|
+
{visibility?.impact && (
|
|
193
310
|
<div className="flex items-start gap-2 rounded-lg border border-theme-border bg-theme-elevated px-3 py-2 text-xs text-theme-text-secondary">
|
|
194
311
|
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-500" />
|
|
195
312
|
<span>
|
|
196
|
-
Limited visibility — {
|
|
313
|
+
Limited visibility — {visibility.impact} Results may be
|
|
197
314
|
incomplete.
|
|
198
315
|
</span>
|
|
199
316
|
</div>
|
|
200
317
|
)}
|
|
201
318
|
|
|
319
|
+
{/* Unchecked-source honesty: the rows can't include issues from a
|
|
320
|
+
source Radar couldn't check. With no rows the empty state below says
|
|
321
|
+
it instead. */}
|
|
322
|
+
{scopeIssues.length > 0 && uncheckedLines.length > 0 && (
|
|
323
|
+
<div className="flex items-start gap-2 rounded-lg border border-theme-border bg-theme-elevated px-3 py-2 text-xs text-theme-text-secondary">
|
|
324
|
+
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-500" />
|
|
325
|
+
<div className="min-w-0 flex-1">
|
|
326
|
+
{uncheckedLines.map((line) => <p key={line}>{line}</p>)}
|
|
327
|
+
<UncheckedSourceHelp onRetry={() => { void refetch({ cancelRefetch: false }); }} isRefreshing={isFetching} />
|
|
328
|
+
</div>
|
|
329
|
+
</div>
|
|
330
|
+
)}
|
|
331
|
+
|
|
202
332
|
{/* Truncation honesty: when more issues matched than were returned, say
|
|
203
333
|
so — don't present a capped list as the complete picture. */}
|
|
204
|
-
{data?.total_matched != null &&
|
|
334
|
+
{!subject && data?.total_matched != null &&
|
|
205
335
|
data.total_matched > (data.issues?.length ?? 0) && (
|
|
206
336
|
<p className="text-xs text-theme-text-tertiary">
|
|
207
337
|
Showing {data.issues?.length ?? 0} of {data.total_matched} issues
|
|
@@ -209,10 +339,52 @@ export function IssuesPane({
|
|
|
209
339
|
</p>
|
|
210
340
|
)}
|
|
211
341
|
|
|
342
|
+
{subject && subjectState && (
|
|
343
|
+
<div className="flex flex-wrap items-center gap-2 text-xs text-theme-text-secondary">
|
|
344
|
+
{subjectState.state === "hidden" ? (
|
|
345
|
+
<>
|
|
346
|
+
<span>
|
|
347
|
+
{issueSubjectKindLabel(subject)}{" "}
|
|
348
|
+
<span className="font-mono">{subject.namespace}/{subject.name}</span>{" "}
|
|
349
|
+
is in namespace <span className="font-mono">{subject.namespace}</span>, which your
|
|
350
|
+
namespace filter hides.
|
|
351
|
+
</span>
|
|
352
|
+
{showNamespace && (
|
|
353
|
+
<button
|
|
354
|
+
type="button"
|
|
355
|
+
onClick={() => showNamespace.show(subject.namespace)}
|
|
356
|
+
className="text-accent-text hover:underline"
|
|
357
|
+
>
|
|
358
|
+
{showNamespace.mode === "add" ? "Add" : "Switch to"}{" "}
|
|
359
|
+
<span className="font-mono">{subject.namespace}</span>
|
|
360
|
+
{showNamespace.mode === "add" ? " to the view" : ""}
|
|
361
|
+
</button>
|
|
362
|
+
)}
|
|
363
|
+
</>
|
|
364
|
+
) : (
|
|
365
|
+
<span>
|
|
366
|
+
{subjectState.state === "checking" ? "Checking issues about" : "Showing issues about"}{" "}
|
|
367
|
+
{issueSubjectKindLabel(subject)}{" "}
|
|
368
|
+
<span className="font-mono">
|
|
369
|
+
{subject.namespace ? `${subject.namespace}/` : ""}
|
|
370
|
+
{subject.name}
|
|
371
|
+
</span>
|
|
372
|
+
{subjectState.state === "none" && " — none now"}
|
|
373
|
+
{subjectState.state === "unconfirmed" && ` — can't confirm: ${subjectState.why}`}
|
|
374
|
+
{subjectState.state === "found" && subjectState.withheld > 0 &&
|
|
375
|
+
` — your permissions withhold ${subjectState.withheld} more`}
|
|
376
|
+
</span>
|
|
377
|
+
)}
|
|
378
|
+
<button type="button" onClick={clearSubject} className="text-accent-text hover:underline">
|
|
379
|
+
Show all issues
|
|
380
|
+
</button>
|
|
381
|
+
</div>
|
|
382
|
+
)}
|
|
383
|
+
|
|
212
384
|
{/* Filtered-empty is NOT the healthy empty state: when a severity filter
|
|
213
385
|
hides every row but issues still exist, say "no matches" rather than
|
|
214
386
|
letting IssuesView render its "nothing broken" terminal state. */}
|
|
215
|
-
{severityFilter.size > 0 &&
|
|
387
|
+
{subject && scopeIssues.length === 0 ? null : severityFilter.size > 0 && scopeIssues.length > 0 && shown.length === 0 ? (
|
|
216
388
|
<div className="flex flex-col items-center gap-2 py-12 text-center text-sm text-theme-text-secondary">
|
|
217
389
|
<p>No issues match the selected severity.</p>
|
|
218
390
|
<button
|
|
@@ -223,12 +395,27 @@ export function IssuesPane({
|
|
|
223
395
|
Clear filter
|
|
224
396
|
</button>
|
|
225
397
|
</div>
|
|
398
|
+
) : uncheckedLines.length > 0 && scopeIssues.length === 0 ? (
|
|
399
|
+
<EmptyState
|
|
400
|
+
tone="neutral"
|
|
401
|
+
variant="card"
|
|
402
|
+
headline="No issues found"
|
|
403
|
+
body={uncheckedLines.join(" ")}
|
|
404
|
+
action={<UncheckedSourceHelp onRetry={() => { void refetch({ cancelRefetch: false }); }} isRefreshing={isFetching} />}
|
|
405
|
+
/>
|
|
406
|
+
) : !subject && error && scopeIssues.length === 0 ? (
|
|
407
|
+
<EmptyState
|
|
408
|
+
tone="neutral"
|
|
409
|
+
variant="card"
|
|
410
|
+
headline="No issues in the last successful result"
|
|
411
|
+
body="Current issues could not be checked."
|
|
412
|
+
/>
|
|
226
413
|
) : (
|
|
227
414
|
/* anyData = the query resolved, i.e. the cluster is reachable; an empty
|
|
228
415
|
list then means "nothing broken" rather than "not connected". */
|
|
229
416
|
<IssuesView
|
|
230
417
|
issues={shown}
|
|
231
|
-
anyData={!!data}
|
|
418
|
+
anyData={subject ? !!related.data : !!data}
|
|
232
419
|
onResourceClick={onResourceClick}
|
|
233
420
|
renderActions={({ issue }) => {
|
|
234
421
|
const capacityHref = capacityHrefForIssue(issue, hasKarpenter);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { expect, it, vi } from 'vitest'
|
|
5
|
+
import { UncheckedSourceHelp } from './UncheckedSourceHelp'
|
|
6
|
+
|
|
7
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
8
|
+
|
|
9
|
+
it('keeps the coverage warning visible when help closes and prevents duplicate retries', async () => {
|
|
10
|
+
const host = document.createElement('div')
|
|
11
|
+
document.body.append(host)
|
|
12
|
+
const root = createRoot(host)
|
|
13
|
+
const retry = vi.fn()
|
|
14
|
+
const render = (refreshing: boolean) => (
|
|
15
|
+
<div>
|
|
16
|
+
<p>Helm releases couldn't be checked.</p>
|
|
17
|
+
<UncheckedSourceHelp onRetry={retry} isRefreshing={refreshing} />
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
try {
|
|
21
|
+
await act(async () => root.render(render(false)))
|
|
22
|
+
const disclosure = host.querySelector<HTMLButtonElement>('button[aria-expanded]')
|
|
23
|
+
expect(disclosure).not.toBeNull()
|
|
24
|
+
expect(disclosure?.getAttribute('aria-expanded')).toBe('false')
|
|
25
|
+
await act(async () => disclosure?.click())
|
|
26
|
+
expect(disclosure?.getAttribute('aria-expanded')).toBe('true')
|
|
27
|
+
const button = [...host.querySelectorAll('button')].find((b) => b.textContent === 'Check again')
|
|
28
|
+
expect(button).toBeDefined()
|
|
29
|
+
await act(async () => button?.click())
|
|
30
|
+
expect(retry).toHaveBeenCalledTimes(1)
|
|
31
|
+
await act(async () => root.render(render(true)))
|
|
32
|
+
expect(button?.disabled).toBe(true)
|
|
33
|
+
await act(async () => button?.click())
|
|
34
|
+
expect(retry).toHaveBeenCalledTimes(1)
|
|
35
|
+
await act(async () => disclosure?.click())
|
|
36
|
+
expect(disclosure?.getAttribute('aria-expanded')).toBe('false')
|
|
37
|
+
expect(host.querySelector('p')?.textContent).toBe("Helm releases couldn't be checked.")
|
|
38
|
+
} finally {
|
|
39
|
+
await act(async () => root.unmount())
|
|
40
|
+
host.remove()
|
|
41
|
+
}
|
|
42
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Disclosure } from '@skyhook-io/k8s-ui'
|
|
2
|
+
|
|
3
|
+
export function UncheckedSourceHelp({ onRetry, isRefreshing }: { onRetry: () => void; isRefreshing: boolean }) {
|
|
4
|
+
return (
|
|
5
|
+
<Disclosure
|
|
6
|
+
summary="Why is this shown?"
|
|
7
|
+
className="mt-2 text-left text-xs text-theme-text-secondary"
|
|
8
|
+
summaryClassName="min-h-9 text-accent-text hover:underline"
|
|
9
|
+
>
|
|
10
|
+
<div className="space-y-2 pt-2 leading-5">
|
|
11
|
+
<p>Some checks didn’t return a usable result. Issues found by other checks are still shown.</p>
|
|
12
|
+
<p>Radar checks again automatically. If this keeps happening, check Radar’s connection and access to Kubernetes.</p>
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
onClick={onRetry}
|
|
16
|
+
disabled={isRefreshing}
|
|
17
|
+
className="btn-secondary min-h-9 min-w-32 px-2.5 py-1 font-medium disabled:cursor-not-allowed"
|
|
18
|
+
>
|
|
19
|
+
{isRefreshing ? 'Checking again…' : 'Check again'}
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
</Disclosure>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { UNKNOWN_SOURCE_LINE, uncheckedSourceLines } from './uncheckedSources'
|
|
3
|
+
|
|
4
|
+
describe('uncheckedSourceLines', () => {
|
|
5
|
+
it('names the kinds still loading', () => {
|
|
6
|
+
expect(uncheckedSourceLines([{
|
|
7
|
+
source: 'resources', reason: 'kind_sync_pending',
|
|
8
|
+
kinds: [{ group: 'autoscaling', kind: 'HorizontalPodAutoscaler' }, { kind: 'PersistentVolumeClaim' }],
|
|
9
|
+
}])).toEqual(['Still loading HorizontalPodAutoscalers and PersistentVolumeClaims, so their issues may be missing.'])
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('caps a long kind list', () => {
|
|
13
|
+
const kinds = ['Pod', 'Node', 'Service', 'Secret', 'ConfigMap'].map((kind) => ({ kind }))
|
|
14
|
+
expect(uncheckedSourceLines([{ source: 'resources', reason: 'kind_sync_failed', kinds }]))
|
|
15
|
+
.toEqual(["Pods, Nodes and 3 more couldn't be loaded, so their issues may be missing."])
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('says custom resources are loading when no kind can be named', () => {
|
|
19
|
+
expect(uncheckedSourceLines([{ source: 'custom_resources', reason: 'kind_sync_pending' }]))
|
|
20
|
+
.toEqual(['Custom resources are still loading, so failing ones may be missing.'])
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('names the Helm namespaces that failed, so the rest reads as checked', () => {
|
|
24
|
+
expect(uncheckedSourceLines([{ source: 'helm', reason: 'read_failed', namespaces: ['payments'] }]))
|
|
25
|
+
.toEqual(["Helm releases in payments couldn't be checked, so failed or stuck releases there may be missing."])
|
|
26
|
+
expect(uncheckedSourceLines([{ source: 'helm', reason: 'read_failed', namespaces: ['a', 'b'] }]))
|
|
27
|
+
.toEqual(["Helm releases in 2 namespaces (a and b) couldn't be checked, so failed or stuck releases there may be missing."])
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it("says when Radar's own service account is the problem", () => {
|
|
31
|
+
expect(uncheckedSourceLines([{ source: 'helm', reason: 'collector_access_denied' }]))
|
|
32
|
+
.toEqual(["Helm releases couldn't be checked because Radar's service account isn't allowed to impersonate users, so failed or stuck releases may be missing."])
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('falls back to the source line for a reason this version does not know', () => {
|
|
36
|
+
expect(uncheckedSourceLines([{ source: 'karpenter', reason: 'something_new' }]))
|
|
37
|
+
.toEqual(["Karpenter resources couldn't be checked, so NodePool and NodeClaim issues may be missing."])
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('keeps the generic line for an unknown source', () => {
|
|
41
|
+
expect(uncheckedSourceLines([{ source: 'brand_new', reason: 'read_failed' }])).toEqual([UNKNOWN_SOURCE_LINE])
|
|
42
|
+
})
|
|
43
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { englishPlural } from "@skyhook-io/k8s-ui/utils/pluralize";
|
|
2
|
+
import type { IssuesResponse, UncheckedSource } from "../../api/client";
|
|
3
|
+
|
|
4
|
+
// The line each issue source gets wherever Radar's issues would otherwise read
|
|
5
|
+
// as complete, when nothing more specific can be said about the gap.
|
|
6
|
+
const SOURCE_LINES: Record<string, string> = {
|
|
7
|
+
helm: "Helm releases couldn't be checked, so failed or stuck releases may be missing.",
|
|
8
|
+
resources: "Some resources couldn't be checked, so their issues may be missing.",
|
|
9
|
+
custom_resources: "Custom resources couldn't be checked, so failing ones may be missing.",
|
|
10
|
+
karpenter: "Karpenter resources couldn't be checked, so NodePool and NodeClaim issues may be missing.",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// For a source this version doesn't know, sent by a newer Radar.
|
|
14
|
+
export const UNKNOWN_SOURCE_LINE = "Some issue checks couldn't run, so issues may be missing.";
|
|
15
|
+
|
|
16
|
+
const NAMED_LIMIT = 3;
|
|
17
|
+
|
|
18
|
+
/** "A", "A and B", "A, B and C", "A, B and 4 more". */
|
|
19
|
+
function nameList(names: string[]): string {
|
|
20
|
+
if (names.length <= NAMED_LIMIT) {
|
|
21
|
+
return names.length === 1 ? names[0] : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
22
|
+
}
|
|
23
|
+
return `${names.slice(0, NAMED_LIMIT - 1).join(", ")} and ${names.length - (NAMED_LIMIT - 1)} more`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function helmLine({ reason, namespaces }: UncheckedSource): string {
|
|
27
|
+
const where = namespaces?.length
|
|
28
|
+
? namespaces.length === 1
|
|
29
|
+
? `in ${namespaces[0]} `
|
|
30
|
+
: `in ${namespaces.length} namespaces (${nameList(namespaces)}) `
|
|
31
|
+
: "";
|
|
32
|
+
const missing = where ? "failed or stuck releases there may be missing" : "failed or stuck releases may be missing";
|
|
33
|
+
if (reason === "collector_access_denied") {
|
|
34
|
+
return `Helm releases ${where}couldn't be checked because Radar's service account isn't allowed to impersonate users, so ${missing}.`;
|
|
35
|
+
}
|
|
36
|
+
return `Helm releases ${where}couldn't be checked, so ${missing}.`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function kindsLine(source: UncheckedSource): string | undefined {
|
|
40
|
+
const kinds = [...new Set((source.kinds ?? []).map((k) => englishPlural(k.kind)))];
|
|
41
|
+
if (kinds.length === 0) {
|
|
42
|
+
if (source.source === "custom_resources" && source.reason === "kind_sync_pending") {
|
|
43
|
+
return "Custom resources are still loading, so failing ones may be missing.";
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const names = nameList(kinds);
|
|
48
|
+
switch (source.reason) {
|
|
49
|
+
case "kind_sync_pending":
|
|
50
|
+
return `Still loading ${names}, so their issues may be missing.`;
|
|
51
|
+
case "kind_sync_failed":
|
|
52
|
+
return `${names} couldn't be loaded, so their issues may be missing.`;
|
|
53
|
+
default:
|
|
54
|
+
return `${names} couldn't be checked, so their issues may be missing.`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function lineFor(source: UncheckedSource): string | undefined {
|
|
59
|
+
if (!Object.hasOwn(SOURCE_LINES, source.source)) return undefined;
|
|
60
|
+
if (source.source === "helm") return helmLine(source);
|
|
61
|
+
return kindsLine(source) ?? SOURCE_LINES[source.source];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** One line per unchecked source, known sources first, without repeats. */
|
|
65
|
+
export function uncheckedSourceLines(sources: IssuesResponse["unchecked_sources"]): string[] {
|
|
66
|
+
const known = new Set<string>();
|
|
67
|
+
let unknown = false;
|
|
68
|
+
for (const source of sources ?? []) {
|
|
69
|
+
const line = lineFor(source);
|
|
70
|
+
if (line) known.add(line);
|
|
71
|
+
else unknown = true;
|
|
72
|
+
}
|
|
73
|
+
return unknown ? [...known, UNKNOWN_SOURCE_LINE] : [...known];
|
|
74
|
+
}
|
|
@@ -11,6 +11,8 @@ interface ScheduledWorkloadLogsViewerProps {
|
|
|
11
11
|
name: string
|
|
12
12
|
selectedRunKey?: string
|
|
13
13
|
onSelectRun?: (runKey: string) => void
|
|
14
|
+
/** The view's namespace selection; narrows a cluster-scoped template's runs. */
|
|
15
|
+
viewNamespaces?: string[]
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
const EMPTY_RUNS: WorkloadRun[] = []
|
|
@@ -19,7 +21,7 @@ export function ScheduledWorkloadLogsViewer(props: ScheduledWorkloadLogsViewerPr
|
|
|
19
21
|
return <ScheduledWorkloadLogsContent key={JSON.stringify([props.kind, props.namespace, props.name])} {...props} />
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
function ScheduledWorkloadLogsContent({ kind, namespace, name, selectedRunKey, onSelectRun }: ScheduledWorkloadLogsViewerProps) {
|
|
24
|
+
function ScheduledWorkloadLogsContent({ kind, namespace, name, selectedRunKey, onSelectRun, viewNamespaces }: ScheduledWorkloadLogsViewerProps) {
|
|
23
25
|
const clusterScoped = kind === 'ClusterWorkflowTemplate' || kind === 'clusterworkflowtemplates'
|
|
24
26
|
const jobSet = kind.toLowerCase() === 'jobset' || kind.toLowerCase() === 'jobsets'
|
|
25
27
|
const [localRunKey, setLocalRunKey] = useState('')
|
|
@@ -28,7 +30,7 @@ function ScheduledWorkloadLogsContent({ kind, namespace, name, selectedRunKey, o
|
|
|
28
30
|
const [scope, setScope] = useState('selected')
|
|
29
31
|
const [role, setRole] = useState('')
|
|
30
32
|
const rootQuery = useResource<any>('jobsets', namespace, name, 'jobset.x-k8s.io', { enabled: jobSet })
|
|
31
|
-
const runsQuery = useWorkloadRuns(kind, namespace, name, true, { clusterScoped, refetchActive: true, ...(jobSet ? { selected: effectiveRunKey } : {}) })
|
|
33
|
+
const runsQuery = useWorkloadRuns(kind, namespace, name, true, { clusterScoped, namespaces: viewNamespaces, refetchActive: true, ...(jobSet ? { selected: effectiveRunKey } : {}) })
|
|
32
34
|
const memberCollection = runsQuery.data?.collection === 'members'
|
|
33
35
|
const runs = runsQuery.data?.runs ?? EMPTY_RUNS
|
|
34
36
|
const selectedRunFromResponse = runsQuery.data?.selected
|
|
@@ -182,3 +182,35 @@ describe('PVC metrics next step', () => {
|
|
|
182
182
|
expect(render()).not.toContain('Ask your operator')
|
|
183
183
|
})
|
|
184
184
|
})
|
|
185
|
+
|
|
186
|
+
describe('PVC scope remedies', () => {
|
|
187
|
+
it.each(['ambiguous_scope', 'scope_mismatch'] as const)('shows operator scope controls for %s to owners and viewers', scope => {
|
|
188
|
+
statusResult = { data: { connected: true } }
|
|
189
|
+
usageResult = { data: { ...measured, hasData: false, status: scope } }
|
|
190
|
+
roleLoading = false
|
|
191
|
+
for (const owner of [true, false]) {
|
|
192
|
+
canConfigure = owner
|
|
193
|
+
const html = render()
|
|
194
|
+
expect(html).toContain('--prometheus-cluster-label')
|
|
195
|
+
expect(html).toContain('traffic.prometheusClusterLabels')
|
|
196
|
+
expect(html).toContain('not available in Settings or Desktop')
|
|
197
|
+
expect(html).not.toContain('Configure metrics')
|
|
198
|
+
expect(html).not.toContain('verified labels')
|
|
199
|
+
if (scope === 'scope_mismatch') {
|
|
200
|
+
expect(html).toContain('align cluster labels')
|
|
201
|
+
expect(html).toContain('affects all these charts')
|
|
202
|
+
expect(html).toContain('dedicated to this cluster')
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
it('keeps connection settings when a cached scope failure outlives the connection', () => {
|
|
208
|
+
canConfigure = true
|
|
209
|
+
roleLoading = false
|
|
210
|
+
statusResult = { data: { connected: false } }
|
|
211
|
+
usageResult = { data: { ...measured, hasData: false, status: 'ambiguous_scope' } }
|
|
212
|
+
const html = render()
|
|
213
|
+
expect(html).toContain('Configure metrics')
|
|
214
|
+
expect(html).not.toContain('--prometheus-cluster-label')
|
|
215
|
+
})
|
|
216
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
2
|
+
import { expect, it, vi } from 'vitest'
|
|
3
|
+
import { PVCUsageBar } from './PVCUsageBar'
|
|
4
|
+
|
|
5
|
+
const state = vi.hoisted(() => ({ status: 'ambiguous_scope' }))
|
|
6
|
+
vi.mock('../../api/client', () => ({
|
|
7
|
+
isForbiddenError: () => false,
|
|
8
|
+
useAutoPromConnect: () => {},
|
|
9
|
+
useCloudRole: () => ({ canAtLeast: () => false, isLoading: false }),
|
|
10
|
+
usePrometheusStatus: () => ({ data: { connected: true } }),
|
|
11
|
+
usePrometheusPVCUsage: () => ({ data: { status: state.status, hasData: false } }),
|
|
12
|
+
}))
|
|
13
|
+
vi.mock('../../context/NavCustomization', () => ({ useNavCustomization: () => ({ embedded: true }) }))
|
|
14
|
+
vi.mock('../../hooks/usePreviousIntegrationSettings', () => ({ usePreviousIntegrationSettings: () => ({}), previousSettingsNote: () => undefined }))
|
|
15
|
+
|
|
16
|
+
it('distinguishes mismatched volume-stat labels from multiple cluster identities', () => {
|
|
17
|
+
state.status = 'ambiguous_scope'
|
|
18
|
+
expect(renderToStaticMarkup(<PVCUsageBar namespace="demo" name="disk" />)).toContain('more than one cluster')
|
|
19
|
+
state.status = 'scope_mismatch'
|
|
20
|
+
const html = renderToStaticMarkup(<PVCUsageBar namespace="demo" name="disk" />)
|
|
21
|
+
expect(html).toContain('could not match this volume’s stats to this cluster')
|
|
22
|
+
expect(html).toContain('Used space is unknown')
|
|
23
|
+
expect(html).not.toContain('more than one cluster')
|
|
24
|
+
})
|