@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
|
@@ -33,23 +33,32 @@ export function PVCUsageBar({ namespace, name }: { namespace: string; name: stri
|
|
|
33
33
|
unavailable = 'Loading usage measurements…'
|
|
34
34
|
} else if (usage.status === 'no_series') {
|
|
35
35
|
unavailable = 'No usage measurements reported for this volume.'
|
|
36
|
+
} else if (usage.status === 'ambiguous_scope') {
|
|
37
|
+
unavailable = 'Prometheus has volume stats with this name from more than one cluster. Radar cannot tell which belong to this cluster. Used space is unknown.'
|
|
38
|
+
} else if (usage.status === 'scope_mismatch') {
|
|
39
|
+
unavailable = 'Radar could not match this volume’s stats to this cluster. Used space is unknown.'
|
|
36
40
|
} else if (usage.status === 'invalid_data') {
|
|
37
41
|
unavailable = 'Volume usage measurements are invalid. Used space is unknown.'
|
|
38
42
|
} else if (!usage.hasData) {
|
|
39
43
|
unavailable = 'Usage measurements are unavailable.'
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
const scopeFailure = isConnected && !error && !statusError && (usage?.status === 'ambiguous_scope' || usage?.status === 'scope_mismatch')
|
|
42
47
|
const denied = isForbiddenError(error) || isForbiddenError(statusError)
|
|
43
48
|
const waiting = !denied && !statusError && (!status || status.discovering || (isConnected && !usage && !error))
|
|
44
49
|
const offers = usePreviousIntegrationSettings(canConfigure && !waiting && !denied && !statusError && !isConnected)
|
|
45
50
|
const previousNote = offers.metrics ? previousSettingsNote('metrics', offers.metrics) : undefined
|
|
46
51
|
const guidance = denied
|
|
47
52
|
? 'Ask your operator to review your metrics access.'
|
|
48
|
-
:
|
|
49
|
-
?
|
|
50
|
-
? '
|
|
51
|
-
: 'Ask your operator to
|
|
52
|
-
:
|
|
53
|
+
: scopeFailure
|
|
54
|
+
? usage.status === 'ambiguous_scope'
|
|
55
|
+
? 'An operator can set this cluster’s exact metrics labels with --prometheus-cluster-label, or traffic.prometheusClusterLabels in Helm. These scope controls are not available in Settings or Desktop.'
|
|
56
|
+
: 'Ask your operator to align cluster labels across kube-state-metrics, workload metrics and volume stats. --prometheus-cluster-label (Helm: traffic.prometheusClusterLabels) affects all these charts; its labels must exist on every affected source. For a backend dedicated to this cluster, an operator can use --prometheus-single-cluster instead. These scope controls are not available in Settings or Desktop.'
|
|
57
|
+
: !canConfigure && !roleLoading
|
|
58
|
+
? !isConnected || statusError
|
|
59
|
+
? 'Ask your operator to check the metrics connection for this cluster.'
|
|
60
|
+
: 'Ask your operator to check metrics availability for this volume.'
|
|
61
|
+
: undefined
|
|
53
62
|
|
|
54
63
|
if (unavailable || !usage) {
|
|
55
64
|
return (
|
|
@@ -58,7 +67,7 @@ export function PVCUsageBar({ namespace, name }: { namespace: string; name: stri
|
|
|
58
67
|
<p className="text-sm text-theme-text-tertiary">{unavailable}</p>
|
|
59
68
|
{previousNote && <p className="mt-2 text-xs text-theme-text-secondary">{previousNote}</p>}
|
|
60
69
|
{!waiting && (
|
|
61
|
-
canConfigure && !denied ? (
|
|
70
|
+
canConfigure && !denied && !scopeFailure ? (
|
|
62
71
|
<button
|
|
63
72
|
type="button"
|
|
64
73
|
className="mt-2 text-xs text-accent hover:underline"
|
|
@@ -35,7 +35,9 @@ describe('Metrics help', () => {
|
|
|
35
35
|
expect(html).toContain('--prometheus-single-cluster')
|
|
36
36
|
expect(html).toContain('they do not add missing metrics')
|
|
37
37
|
expect(html).toContain('Leave both unset for automatic matching')
|
|
38
|
-
expect(html).toContain('
|
|
38
|
+
expect(html).toContain('It does not scope rightsizing')
|
|
39
|
+
expect(html).toContain('Pod comparison and PVC usage')
|
|
40
|
+
expect(html).toContain('labels must exist on the kubelet volume stats')
|
|
39
41
|
expect(html).toContain('Standalone CLI:')
|
|
40
42
|
expect(html).toContain('when starting Radar')
|
|
41
43
|
expect(html).toContain('traffic.prometheusSingleCluster')
|
|
@@ -133,7 +133,7 @@ export function WorkloadMetricsHelpContent({ data, pending, error }: Pick<Props,
|
|
|
133
133
|
<div><dt className="font-medium">Backend dedicated to this cluster</dt><dd><code className="break-all font-mono text-xs">--prometheus-single-cluster</code><p className="mt-1">Helm: <code className="break-all font-mono text-xs">traffic.prometheusSingleCluster: true</code></p></dd></div>
|
|
134
134
|
<div><dt className="font-medium">Shared backend with a cluster label</dt><dd><code className="break-all font-mono text-xs">--prometheus-cluster-label cluster=your-cluster</code><p className="mt-1">Helm: set the backend’s actual label and value in <code className="break-all font-mono text-xs">traffic.prometheusClusterLabels</code>.</p></dd></div>
|
|
135
135
|
</dl>
|
|
136
|
-
<p>Leave both unset for automatic matching. An override replaces automatic matching for workload requests, resources, history
|
|
136
|
+
<p>Leave both unset for automatic matching. An override replaces automatic matching for workload requests, resources, history, Pod comparison and PVC usage. For PVC usage, its labels must exist on the kubelet volume stats. It does not scope rightsizing, node/HPA or legacy network/storage metrics.</p>
|
|
137
137
|
<h4 className="font-medium text-theme-text-primary">Operator configuration</h4>
|
|
138
138
|
<p><strong className="font-medium">Standalone CLI:</strong> supply the flag when starting Radar. Overrides are not saved; after changing the cluster, backend or credentials, verify the new scope before restarting with a fresh override.</p>
|
|
139
139
|
<p><strong className="font-medium">In-cluster OSS or Radar Cloud:</strong> ask the installation’s operator to update its Helm values or GitOps configuration. These are shared backend settings, not viewer preferences.</p>
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type CrossplaneResourceRef,
|
|
13
13
|
} from '@skyhook-io/k8s-ui/components/resources/resource-utils-crossplane'
|
|
14
14
|
import { getResourceStatus } from '@skyhook-io/k8s-ui'
|
|
15
|
-
import {
|
|
15
|
+
import { kindToPluralWithGroup } from '@skyhook-io/k8s-ui/utils/navigation'
|
|
16
16
|
import type { ResourceRef as NavRef } from '../../types'
|
|
17
17
|
import { fetchJSON, ApiError } from '../../api/client'
|
|
18
18
|
|
|
@@ -59,8 +59,8 @@ export function CompositeRenderer({ data, onNavigate }: CompositeRendererProps)
|
|
|
59
59
|
],
|
|
60
60
|
queryFn: async () => {
|
|
61
61
|
const ns = boundXRRef!.namespace || '_'
|
|
62
|
-
const plural = kindToPlural(boundXRRef!.kind)
|
|
63
62
|
const group = groupFromApiVersion(boundXRRef!.apiVersion)
|
|
63
|
+
const plural = kindToPluralWithGroup(boundXRRef!.kind, group)
|
|
64
64
|
const query = group ? `?group=${encodeURIComponent(group)}` : ''
|
|
65
65
|
return fetchJSON<{ resource: any }>(`/resources/${plural}/${ns}/${boundXRRef!.name}${query}`)
|
|
66
66
|
},
|
|
@@ -99,7 +99,7 @@ export function CompositeRenderer({ data, onNavigate }: CompositeRendererProps)
|
|
|
99
99
|
queryKey: ['composed-ref', group, ref.kind, ref.namespace ?? '', ref.name],
|
|
100
100
|
queryFn: async () => {
|
|
101
101
|
const ns = ref.namespace || '_'
|
|
102
|
-
const plural =
|
|
102
|
+
const plural = kindToPluralWithGroup(ref.kind, group)
|
|
103
103
|
const query = group ? `?group=${encodeURIComponent(group)}` : ''
|
|
104
104
|
return fetchJSON<{ resource: any }>(`/resources/${plural}/${ns}/${ref.name}${query}`)
|
|
105
105
|
},
|
|
@@ -137,7 +137,7 @@ export function CompositeRenderer({ data, onNavigate }: CompositeRendererProps)
|
|
|
137
137
|
map.set(key, { ref, missing: true })
|
|
138
138
|
return
|
|
139
139
|
}
|
|
140
|
-
const status = getResourceStatus(
|
|
140
|
+
const status = getResourceStatus(kindToPluralWithGroup(ref.kind, groupFromApiVersion(ref.apiVersion)), q.data.resource) ?? undefined
|
|
141
141
|
map.set(key, {
|
|
142
142
|
ref,
|
|
143
143
|
status: status ? { ...status, level: (status as any).level ?? 'unknown' } : undefined,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { afterEach, expect, it, vi } from 'vitest'
|
|
5
|
+
import { ImageFilesystemModal } from './ImageFilesystemModal'
|
|
6
|
+
import { ApiError } from '../../api/client'
|
|
7
|
+
|
|
8
|
+
const state = vi.hoisted(() => ({ authEnabled: false, showMetadata: false }))
|
|
9
|
+
vi.mock('../../contexts/CapabilitiesContext', () => ({ useIsAuthEnabled: () => state.authEnabled }))
|
|
10
|
+
vi.mock('../../api/client', () => ({
|
|
11
|
+
ApiError: class extends Error {
|
|
12
|
+
status = 401
|
|
13
|
+
data = { registryType: 'google' }
|
|
14
|
+
},
|
|
15
|
+
useImageMetadata: () => state.showMetadata ? ({
|
|
16
|
+
data: { image: 'gcr.io/project/app:v1', digest: 'sha256:abc', platform: 'linux/amd64', totalSize: 1024, layerCount: 1, authMethod: 'google', cached: false },
|
|
17
|
+
refetch: vi.fn(),
|
|
18
|
+
}) : ({ error: new ApiError('Authentication required', 401), refetch: vi.fn() }),
|
|
19
|
+
}))
|
|
20
|
+
|
|
21
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
22
|
+
let root: ReturnType<typeof createRoot>
|
|
23
|
+
|
|
24
|
+
afterEach(async () => {
|
|
25
|
+
await act(async () => root.unmount())
|
|
26
|
+
state.showMetadata = false
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it.each([true, false])('shows private-image guidance for authEnabled=%s', async (authEnabled) => {
|
|
30
|
+
state.authEnabled = authEnabled
|
|
31
|
+
root = createRoot(document.createElement('div'))
|
|
32
|
+
await act(async () => {
|
|
33
|
+
root.render(<ImageFilesystemModal open onClose={() => {}} image="gcr.io/project/app:v1" namespace="team" podName="app" pullSecrets={[]} />)
|
|
34
|
+
})
|
|
35
|
+
const text = document.body.textContent || ''
|
|
36
|
+
expect(text).toContain('Authentication Required')
|
|
37
|
+
if (authEnabled) {
|
|
38
|
+
expect(text).toContain("Private images need exec access to the Pod, or read access to its imagePullSecrets. Exec access also lets Radar use its own registry credentials.")
|
|
39
|
+
expect(text).not.toContain('~/.docker/config.json')
|
|
40
|
+
expect(text).not.toContain('Run this command to authenticate')
|
|
41
|
+
expect(text).not.toContain('gcloud')
|
|
42
|
+
} else {
|
|
43
|
+
expect(text).toContain('~/.docker/config.json')
|
|
44
|
+
expect(text).toContain('Run this command to authenticate')
|
|
45
|
+
expect(text).toContain('gcloud')
|
|
46
|
+
expect(text).not.toContain("Private images are read with the Pod's imagePullSecrets")
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it.each([true, false])('shows download confirmation for authEnabled=%s', async (authEnabled) => {
|
|
51
|
+
state.authEnabled = authEnabled
|
|
52
|
+
state.showMetadata = true
|
|
53
|
+
root = createRoot(document.createElement('div'))
|
|
54
|
+
await act(async () => {
|
|
55
|
+
root.render(<ImageFilesystemModal open onClose={() => {}} image="gcr.io/project/app:v1" namespace="team" podName="app" pullSecrets={[]} />)
|
|
56
|
+
})
|
|
57
|
+
const text = document.body.textContent || ''
|
|
58
|
+
expect(text).toContain('Download Image Layers?')
|
|
59
|
+
expect(text).toContain('Download & View')
|
|
60
|
+
if (authEnabled) {
|
|
61
|
+
expect(text).not.toContain('Authentication Command')
|
|
62
|
+
expect(text).not.toContain('gcloud')
|
|
63
|
+
expect(text).not.toContain('Run this command')
|
|
64
|
+
} else {
|
|
65
|
+
expect(text).toContain('Authentication Command')
|
|
66
|
+
expect(text).toContain('gcloud')
|
|
67
|
+
}
|
|
68
|
+
})
|
|
@@ -12,6 +12,7 @@ import { Tooltip } from '../ui/Tooltip'
|
|
|
12
12
|
import { apiUrl, getAuthHeaders, getCredentialsMode } from '../../api/config'
|
|
13
13
|
import { readErrorBody } from '../../api/httpErrors'
|
|
14
14
|
import { Input } from '@skyhook-io/k8s-ui'
|
|
15
|
+
import { useIsAuthEnabled } from '../../contexts/CapabilitiesContext'
|
|
15
16
|
|
|
16
17
|
const radarLoadingIconUrl = assetUrl(radarLoadingIcon)
|
|
17
18
|
|
|
@@ -293,8 +294,9 @@ interface DownloadConfirmationProps {
|
|
|
293
294
|
}
|
|
294
295
|
|
|
295
296
|
function DownloadConfirmation({ metadata, onConfirm, onCancel }: DownloadConfirmationProps) {
|
|
297
|
+
const authEnabled = useIsAuthEnabled()
|
|
296
298
|
const isPublic = metadata.authMethod === 'anonymous'
|
|
297
|
-
const authCommand = !isPublic ? getAuthCommand(metadata.authMethod, metadata.image) : null
|
|
299
|
+
const authCommand = !authEnabled && !isPublic ? getAuthCommand(metadata.authMethod, metadata.image) : null
|
|
298
300
|
const [copied, setCopied] = useState(false)
|
|
299
301
|
|
|
300
302
|
const handleCopy = async () => {
|
|
@@ -417,11 +419,12 @@ interface AuthenticationHelpProps {
|
|
|
417
419
|
}
|
|
418
420
|
|
|
419
421
|
function AuthenticationHelp({ image, registryType, onRetry }: AuthenticationHelpProps) {
|
|
422
|
+
const authEnabled = useIsAuthEnabled()
|
|
420
423
|
const [copied, setCopied] = useState(false)
|
|
421
424
|
const [retrying, setRetrying] = useState(false)
|
|
422
425
|
const registry = getRegistryHost(image)
|
|
423
426
|
const authMethod = registryType || 'generic'
|
|
424
|
-
const authCommand = getAuthCommand(authMethod, image)
|
|
427
|
+
const authCommand = authEnabled ? null : getAuthCommand(authMethod, image)
|
|
425
428
|
|
|
426
429
|
const handleCopy = async () => {
|
|
427
430
|
if (!authCommand) return
|
|
@@ -489,8 +492,12 @@ function AuthenticationHelp({ image, registryType, onRetry }: AuthenticationHelp
|
|
|
489
492
|
|
|
490
493
|
{/* Explanation */}
|
|
491
494
|
<p className="text-xs text-theme-text-tertiary text-center max-w-md mb-6">
|
|
492
|
-
|
|
493
|
-
|
|
495
|
+
{authEnabled ? (
|
|
496
|
+
<>Private images need exec access to the Pod, or read access to its imagePullSecrets. Exec access also lets Radar use its own registry credentials.</>
|
|
497
|
+
) : (
|
|
498
|
+
<>Radar uses your local Docker credentials (<span className="font-mono">~/.docker/config.json</span>).
|
|
499
|
+
Run the command above in your terminal, then click Retry.</>
|
|
500
|
+
)}
|
|
494
501
|
</p>
|
|
495
502
|
|
|
496
503
|
{/* Retry button */}
|
|
@@ -127,7 +127,7 @@ interface PodFilesystemModalProps {
|
|
|
127
127
|
podName: string
|
|
128
128
|
containers: string[]
|
|
129
129
|
initialContainer?: string
|
|
130
|
-
onSwitchToImageFiles?: () => void
|
|
130
|
+
onSwitchToImageFiles?: (containerName: string) => void
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
export function PodFilesystemModal({
|
|
@@ -389,7 +389,7 @@ export function PodFilesystemModal({
|
|
|
389
389
|
)}
|
|
390
390
|
{onSwitchToImageFiles && (
|
|
391
391
|
<button
|
|
392
|
-
onClick={() => { onClose(); onSwitchToImageFiles() }}
|
|
392
|
+
onClick={() => { onClose(); onSwitchToImageFiles(selectedContainer) }}
|
|
393
393
|
className="ml-auto text-blue-400 hover:text-blue-300 hover:underline"
|
|
394
394
|
>
|
|
395
395
|
Browse static image from registry →
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResourceDetailDrawer as BaseResourceDetailDrawer } from '@skyhook-io/k8s-ui'
|
|
2
2
|
import type { SelectedResource } from '../../types'
|
|
3
3
|
import { WorkloadView } from '../workload/WorkloadView'
|
|
4
|
-
import {
|
|
4
|
+
import { ResourceDrawerNavigation } from '../../integrations/resourceHosts'
|
|
5
5
|
|
|
6
6
|
interface ResourceDetailDrawerProps {
|
|
7
7
|
resource: SelectedResource
|
|
@@ -33,7 +33,7 @@ export function ResourceDetailDrawer(props: ResourceDetailDrawerProps) {
|
|
|
33
33
|
<BaseResourceDetailDrawer {...props}>
|
|
34
34
|
{({ resource, expanded, active, initialTab, onClose, onExpand, onExpandIntent, onCancelExpandIntent, onBack, onNavigateToResource, onCollapseToDrawer }) => (
|
|
35
35
|
<div className="flex h-full min-h-0 flex-col">
|
|
36
|
-
{!expanded && <
|
|
36
|
+
{!expanded && <ResourceDrawerNavigation resource={resource} />}
|
|
37
37
|
<div className="min-h-0 flex-1">
|
|
38
38
|
<WorkloadView
|
|
39
39
|
kind={resource.kind}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { ResourcesView } from './ResourcesView'
|
|
8
|
+
|
|
9
|
+
vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { state: 'connected', context: 'test' } }) }))
|
|
10
|
+
vi.mock('../dock', () => ({ useOpenLogs: () => () => {}, useOpenWorkloadLogs: () => () => {} }))
|
|
11
|
+
vi.mock('../../context/RadarUpgradeHost', () => ({ useRadarUpgradeHost: () => ({}) }))
|
|
12
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
13
|
+
|
|
14
|
+
const requested: URL[] = []
|
|
15
|
+
let root: ReturnType<typeof createRoot>
|
|
16
|
+
let client: QueryClient
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
requested.length = 0
|
|
20
|
+
vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener: () => {}, removeEventListener: () => {} }))
|
|
21
|
+
vi.stubGlobal('fetch', vi.fn((input: RequestInfo | URL) => {
|
|
22
|
+
requested.push(new URL(String(input), 'http://radar.invalid'))
|
|
23
|
+
return new Promise<Response>(() => {})
|
|
24
|
+
}))
|
|
25
|
+
root = createRoot(document.createElement('div'))
|
|
26
|
+
client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
afterEach(async () => {
|
|
30
|
+
await act(async () => root.unmount())
|
|
31
|
+
client.clear()
|
|
32
|
+
vi.unstubAllGlobals()
|
|
33
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
async function certExpiryScope(namespaces: string[]) {
|
|
37
|
+
await act(async () => {
|
|
38
|
+
root.render(
|
|
39
|
+
<QueryClientProvider client={client}>
|
|
40
|
+
<MemoryRouter initialEntries={['/resources/secrets']}>
|
|
41
|
+
<ResourcesView namespaces={namespaces} selectedResource={null} onResourceClick={() => {}} />
|
|
42
|
+
</MemoryRouter>
|
|
43
|
+
</QueryClientProvider>,
|
|
44
|
+
)
|
|
45
|
+
})
|
|
46
|
+
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 0)) })
|
|
47
|
+
const certExpiry = requested.filter((url) => url.pathname.endsWith('/secrets/certificate-expiry'))
|
|
48
|
+
if (certExpiry.length === 0) throw new Error(`no certificate-expiry request: ${requested.map(String).join(', ')}`)
|
|
49
|
+
return certExpiry.map((url) => url.searchParams.get('namespaces'))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
it('scopes certificate expiry to the namespaces in view', async () => {
|
|
53
|
+
expect(await certExpiryScope(['team-a', 'team-b'])).toEqual(['team-a,team-b'])
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('asks for every namespace when the view covers all', async () => {
|
|
57
|
+
expect(await certExpiryScope([])).toEqual([null])
|
|
58
|
+
})
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { useState, useMemo, useCallback
|
|
1
|
+
import { useState, useMemo, useCallback } from 'react'
|
|
2
2
|
import { useLocation, useNavigate } from 'react-router-dom'
|
|
3
3
|
import { useQuery } from '@tanstack/react-query'
|
|
4
|
-
import { ApiError, debugNamespaceLog, fetchJSON, isForbiddenError, isKindSyncFailed, isStillLoadingError, useCapabilities, useNamespaceCapabilities, useResources, useSecretCertExpiry, useTopPodMetrics, useTopNodeMetrics, useBulkDeleteResources, useBulkRestartWorkloads, useBulkScaleWorkloads, useAudit } from '../../api/client'
|
|
4
|
+
import { ApiError, debugNamespaceLog, fetchJSON, isForbiddenError, isKindSyncFailed, isStillLoadingError, useCapabilities, useNamespaceCapabilities, useResources, useSecretCertExpiry, useTopPodMetrics, useTopNodeMetrics, useBulkDeleteResources, useBulkRestartWorkloads, useBulkScaleWorkloads, useAudit, useIssues } from '../../api/client'
|
|
5
5
|
import { isBadgeWorthy } from '../../utils/auditBadges'
|
|
6
|
-
import
|
|
6
|
+
import { ISSUE_SEVERITY_RANK } from '@skyhook-io/k8s-ui'
|
|
7
|
+
import type { Issue, AuditBadgeMessage } from '@skyhook-io/k8s-ui'
|
|
7
8
|
import { apiUrl, getAuthHeaders, getCredentialsMode, stripBasename } from '../../api/config'
|
|
8
9
|
import { readErrorBody } from '../../api/httpErrors'
|
|
9
10
|
import { useAPIResources } from '../../api/apiResources'
|
|
10
11
|
import { useConnection } from '../../context/ConnectionContext'
|
|
11
|
-
import {
|
|
12
|
+
import { getSecretStoreProviderType } from '@skyhook-io/k8s-ui'
|
|
12
13
|
import { usePinnedKinds } from '../../hooks/useFavorites'
|
|
13
14
|
import { useResourceCounts } from '../../hooks/useResourceCounts'
|
|
14
15
|
import { useCNPGSidebarWorkspace } from '../cnpg/useCNPGSidebarWorkspace'
|
|
16
|
+
import { renderResourceKindList, resourceKindListMode, useResourceHostFeatures } from '../../integrations/resourceHosts'
|
|
15
17
|
import { useOpenLogs, useOpenWorkloadLogs } from '../dock'
|
|
16
18
|
import {
|
|
17
19
|
canBulkRestartKind,
|
|
@@ -35,6 +37,9 @@ interface ResourcesViewProps {
|
|
|
35
37
|
onResourceClickYaml?: NavigateToResource
|
|
36
38
|
onKindChange?: () => void
|
|
37
39
|
onClearNamespaces?: () => void
|
|
40
|
+
rememberedKindSearch?: (kind: { name: string; group: string }) => string | undefined
|
|
41
|
+
onKindFiltersChange?: (kind: { name: string; group: string }, search: string) => void
|
|
42
|
+
onApplyNamespacesToAllSections?: (namespaces: string[]) => Promise<unknown> | void
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
type SelectedKindInfo = { name: string; kind: string; group: string } | null
|
|
@@ -70,12 +75,13 @@ function hasResourceCount(counts: Record<string, number> | undefined, key: strin
|
|
|
70
75
|
return Object.prototype.hasOwnProperty.call(counts ?? {}, key)
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
export function ResourcesView({ namespaces, selectedResource, onResourceClick, onResourceClickYaml, onKindChange, onClearNamespaces }: ResourcesViewProps) {
|
|
78
|
+
export function ResourcesView({ namespaces, selectedResource, onResourceClick, onResourceClickYaml, onKindChange, onClearNamespaces, rememberedKindSearch, onKindFiltersChange, onApplyNamespacesToAllSections }: ResourcesViewProps) {
|
|
74
79
|
const location = useLocation()
|
|
75
80
|
const navigate = useNavigate()
|
|
76
81
|
const { connection } = useConnection()
|
|
77
82
|
|
|
78
|
-
const { data: capabilities } = useCapabilities()
|
|
83
|
+
const { data: capabilities, isPending: capabilitiesPending } = useCapabilities()
|
|
84
|
+
const hostFeatures = useResourceHostFeatures()
|
|
79
85
|
const namespaceForCapabilities = namespaces.length === 1 ? namespaces[0] : undefined
|
|
80
86
|
const { data: namespaceCapabilities } = useNamespaceCapabilities(namespaceForCapabilities, capabilities)
|
|
81
87
|
const namespaceCapabilityNames = useMemo(() => namespaces.length > 1 ? [...namespaces].sort() : [], [namespaces])
|
|
@@ -104,15 +110,21 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
104
110
|
// API resources discovery
|
|
105
111
|
const { data: apiResources } = useAPIResources()
|
|
106
112
|
|
|
107
|
-
// Initialize navigation kind↔plural maps from discovered API resources
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
if (apiResources) initNavigationMap(apiResources)
|
|
110
|
-
}, [apiResources])
|
|
111
|
-
|
|
112
|
-
const cnpgSidebarWorkspace = useCNPGSidebarWorkspace({ apiResources, namespaces })
|
|
113
|
-
|
|
114
113
|
// Track the selected kind from the k8s-ui component
|
|
115
114
|
const [selectedKind, setSelectedKind] = useState<SelectedKindInfo>(null)
|
|
115
|
+
const { data: issuesData } = useIssues(namespaces, selectedKind?.group === 'batch' && selectedKind?.name === 'cronjobs', 'CronJob')
|
|
116
|
+
const operationalIssues = useMemo(() => {
|
|
117
|
+
const result: Record<string, Issue> = {}
|
|
118
|
+
for (const issue of issuesData?.issues ?? []) {
|
|
119
|
+
if (issue.kind !== 'CronJob' || issue.group !== 'batch') continue
|
|
120
|
+
const key = `${issue.namespace ?? ''}/${issue.name}`
|
|
121
|
+
const previous = result[key]
|
|
122
|
+
if (!previous || ISSUE_SEVERITY_RANK[issue.severity] > ISSUE_SEVERITY_RANK[previous.severity] ||
|
|
123
|
+
(issue.severity === previous.severity && issue.id < previous.id)) result[key] = issue
|
|
124
|
+
}
|
|
125
|
+
return result
|
|
126
|
+
}, [issuesData])
|
|
127
|
+
const cnpgSidebarWorkspace = useCNPGSidebarWorkspace({ apiResources, namespaces, withMetrics: selectedKind?.group === 'postgresql.cnpg.io' })
|
|
116
128
|
const workloadWrites = namespaces.length === 0
|
|
117
129
|
? capabilities?.workloadWrites
|
|
118
130
|
: namespaces.length === 1
|
|
@@ -281,7 +293,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
281
293
|
printerTable: sanitizePrinterTable(body),
|
|
282
294
|
}
|
|
283
295
|
},
|
|
284
|
-
enabled: !!selectedKind && !selectedKindQueryBlocked,
|
|
296
|
+
enabled: !!selectedKind && !selectedKindQueryBlocked && resourceKindListMode(selectedKind, hostFeatures, capabilitiesPending) === 'table',
|
|
285
297
|
staleTime: 30000,
|
|
286
298
|
refetchInterval: 120000, // Safety net — SSE k8s_event drives near-real-time invalidation
|
|
287
299
|
retry: (failureCount: number, error: Error) => {
|
|
@@ -315,7 +327,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
315
327
|
const { data: topNodeMetrics } = useTopNodeMetrics({ enabled: topNodeMetricsEnabled })
|
|
316
328
|
|
|
317
329
|
// Certificate expiry
|
|
318
|
-
const { data: certExpiry, isError: certExpiryError } = useSecretCertExpiry()
|
|
330
|
+
const { data: certExpiry, isError: certExpiryError } = useSecretCertExpiry(namespaces)
|
|
319
331
|
|
|
320
332
|
// An ExternalSecret names a store; only the store says which backend it reads
|
|
321
333
|
// from. Two list calls per page beat one lookup per row, and the column shows
|
|
@@ -385,6 +397,17 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
385
397
|
setCreateDialogOpen(true)
|
|
386
398
|
}, [])
|
|
387
399
|
|
|
400
|
+
const renderKindView = useCallback(
|
|
401
|
+
(kind: SelectedKindInfo) => renderResourceKindList(kind, hostFeatures, capabilitiesPending, {
|
|
402
|
+
namespaces,
|
|
403
|
+
inspected: selectedResource ?? null,
|
|
404
|
+
onInspect: (resource) => onResourceClick?.(resource),
|
|
405
|
+
onClearNamespaces: onClearNamespaces ?? (() => {}),
|
|
406
|
+
onCreate: handleCreateResource,
|
|
407
|
+
}),
|
|
408
|
+
[hostFeatures, capabilitiesPending, namespaces, selectedResource, onResourceClick, onClearNamespaces, handleCreateResource],
|
|
409
|
+
)
|
|
410
|
+
|
|
388
411
|
return (
|
|
389
412
|
<>
|
|
390
413
|
<BaseResourcesView
|
|
@@ -395,6 +418,9 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
395
418
|
onResourceClickYaml={onResourceClickYaml}
|
|
396
419
|
onKindChange={onKindChange}
|
|
397
420
|
onClearNamespaces={onClearNamespaces}
|
|
421
|
+
rememberedKindSearch={rememberedKindSearch}
|
|
422
|
+
onKindFiltersChange={onKindFiltersChange}
|
|
423
|
+
onApplyNamespacesToAllSections={onApplyNamespacesToAllSections}
|
|
398
424
|
// Injected data
|
|
399
425
|
apiResources={apiResources}
|
|
400
426
|
// Lightweight counts for sidebar (replaces 233 parallel queries)
|
|
@@ -413,6 +439,8 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
413
439
|
certExpiry={certExpiry}
|
|
414
440
|
storeProviders={storeProviders}
|
|
415
441
|
certExpiryError={certExpiryError}
|
|
442
|
+
operationalIssues={operationalIssues}
|
|
443
|
+
operationalIssuesIncomplete={Boolean(issuesData && (issuesData.total_matched ?? issuesData.total ?? issuesData.issues.length) > issuesData.issues.length)}
|
|
416
444
|
auditBadges={auditBadges}
|
|
417
445
|
// Pinned kinds
|
|
418
446
|
pinned={pinned}
|
|
@@ -434,6 +462,7 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
434
462
|
onOpenWorkloadLogs={openWorkloadLogs}
|
|
435
463
|
// Create resource
|
|
436
464
|
onCreateResource={handleCreateResource}
|
|
465
|
+
renderKindView={renderKindView}
|
|
437
466
|
// Bulk operations
|
|
438
467
|
onBulkDelete={(items, options) => bulkDeleteMutation.mutate({ items, force: options?.force }, { onSuccess: options?.onSuccess })}
|
|
439
468
|
isBulkDeleting={bulkDeleteMutation.isPending}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
+
import type { FluxValuesReference } from '@skyhook-io/k8s-ui/components/resources/renderers/FluxHelmReleaseRenderer'
|
|
6
|
+
import { FluxHelmReleaseRenderer } from './FluxHelmReleaseRenderer'
|
|
7
|
+
|
|
8
|
+
const query = vi.hoisted(() => ({
|
|
9
|
+
data: undefined as 'present' | 'missing' | 'unchecked' | undefined,
|
|
10
|
+
error: null as Error & { status?: number } | null,
|
|
11
|
+
isLoading: false,
|
|
12
|
+
isFetching: false,
|
|
13
|
+
refetch: vi.fn(),
|
|
14
|
+
}))
|
|
15
|
+
const lookup = vi.hoisted(() => vi.fn())
|
|
16
|
+
vi.mock('../../../api/client', () => ({
|
|
17
|
+
useResourceAvailability: (...args: unknown[]) => { lookup(...args); return query },
|
|
18
|
+
isForbiddenError: (error: unknown) => error instanceof Error && 'status' in error && error.status === 403,
|
|
19
|
+
}))
|
|
20
|
+
|
|
21
|
+
let container: HTMLDivElement
|
|
22
|
+
let root: Root
|
|
23
|
+
const navigate = vi.fn()
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
container = document.createElement('div')
|
|
27
|
+
document.body.append(container)
|
|
28
|
+
root = createRoot(container)
|
|
29
|
+
Object.assign(query, { data: undefined, error: null, isLoading: false, isFetching: false })
|
|
30
|
+
vi.clearAllMocks()
|
|
31
|
+
})
|
|
32
|
+
afterEach(async () => {
|
|
33
|
+
await act(async () => root.unmount())
|
|
34
|
+
container.remove()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
async function render(reference: FluxValuesReference = { name: 'overrides', optional: true }) {
|
|
38
|
+
await act(async () => root.render(<FluxHelmReleaseRenderer
|
|
39
|
+
data={{ metadata: { namespace: 'apps' }, spec: { valuesFrom: [reference] } }}
|
|
40
|
+
onNavigate={navigate}
|
|
41
|
+
/>))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function referenceButton() {
|
|
45
|
+
return [...container.querySelectorAll('button')].find(button => button.textContent === 'overrides')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
describe('Flux Helm values references', () => {
|
|
49
|
+
it.each(['ConfigMap', 'Secret'] as const)('labels an absent optional %s and does not link it', async kind => {
|
|
50
|
+
query.data = 'missing'
|
|
51
|
+
await render({ name: 'overrides', kind, optional: true })
|
|
52
|
+
expect(container.textContent).toContain('Optional')
|
|
53
|
+
expect(container.textContent).toContain('Not found - skipped by Flux')
|
|
54
|
+
expect(referenceButton()).toBeUndefined()
|
|
55
|
+
expect(lookup).toHaveBeenCalledWith(kind === 'Secret' ? 'secrets' : 'configmaps', 'apps', 'overrides')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('marks an absent required reference as required', async () => {
|
|
59
|
+
query.data = 'missing'
|
|
60
|
+
await render({ name: 'overrides' })
|
|
61
|
+
expect(container.textContent).toContain('Not found - required by Flux')
|
|
62
|
+
expect(container.textContent).not.toContain('Optional')
|
|
63
|
+
expect(referenceButton()).toBeUndefined()
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it.each([403, 404, 500])('does not mistake HTTP %s for an absent optional reference', async status => {
|
|
67
|
+
query.error = Object.assign(new Error('read failed'), { status })
|
|
68
|
+
await render()
|
|
69
|
+
expect(container.textContent).toContain(status === 403 ? 'Access denied' : 'Could not check availability')
|
|
70
|
+
expect(container.textContent).not.toContain('skipped by Flux')
|
|
71
|
+
expect(referenceButton()).toBeUndefined()
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('waits for availability before offering navigation', async () => {
|
|
75
|
+
query.isLoading = true
|
|
76
|
+
await render()
|
|
77
|
+
expect(container.textContent).toContain('Checking availability')
|
|
78
|
+
expect(referenceButton()).toBeUndefined()
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('rechecks a missing reference and links it once available', async () => {
|
|
82
|
+
query.data = 'missing'
|
|
83
|
+
await render()
|
|
84
|
+
const retry = container.querySelector<HTMLButtonElement>('[aria-label="Check overrides again"]')
|
|
85
|
+
expect(retry).not.toBeNull()
|
|
86
|
+
await act(async () => retry?.click())
|
|
87
|
+
expect(query.refetch).toHaveBeenCalledOnce()
|
|
88
|
+
query.error = null
|
|
89
|
+
query.data = 'present'
|
|
90
|
+
await render()
|
|
91
|
+
expect(container.textContent).not.toContain('Not found')
|
|
92
|
+
await act(async () => referenceButton()?.click())
|
|
93
|
+
expect(navigate).toHaveBeenCalledWith({ kind: 'configmaps', namespace: 'apps', name: 'overrides', group: undefined })
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('does not trust stale successful data after a failed refresh', async () => {
|
|
97
|
+
query.data = 'present'
|
|
98
|
+
query.error = Object.assign(new Error('forbidden'), { status: 403 })
|
|
99
|
+
await render()
|
|
100
|
+
expect(container.textContent).toContain('Access denied')
|
|
101
|
+
expect(referenceButton()).toBeUndefined()
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('keeps navigation when the connected Radar cannot check availability', async () => {
|
|
105
|
+
query.data = 'unchecked'
|
|
106
|
+
await render()
|
|
107
|
+
expect(container.textContent).toContain('Availability not checked')
|
|
108
|
+
expect(referenceButton()).toBeDefined()
|
|
109
|
+
expect(container.textContent).not.toContain('Not found')
|
|
110
|
+
})
|
|
111
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FluxHelmReleaseRenderer as BaseFluxHelmReleaseRenderer, type FluxValuesReference } from '@skyhook-io/k8s-ui/components/resources/renderers/FluxHelmReleaseRenderer'
|
|
2
|
+
import { AlertBanner, ResourceLink } from '@skyhook-io/k8s-ui/components/ui/drawer-components'
|
|
3
|
+
import type { ResourceRef } from '@skyhook-io/k8s-ui'
|
|
4
|
+
import { isForbiddenError, useResourceAvailability } from '../../../api/client'
|
|
5
|
+
|
|
6
|
+
interface FluxHelmReleaseData {
|
|
7
|
+
metadata?: { namespace?: string }
|
|
8
|
+
spec?: { valuesFrom?: FluxValuesReference[] }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FluxHelmReleaseRenderer({ data, onNavigate }: {
|
|
12
|
+
data: FluxHelmReleaseData
|
|
13
|
+
onNavigate?: (ref: ResourceRef) => void
|
|
14
|
+
}) {
|
|
15
|
+
return <BaseFluxHelmReleaseRenderer
|
|
16
|
+
data={data}
|
|
17
|
+
onNavigate={onNavigate}
|
|
18
|
+
renderValuesReference={reference => <ValuesReference
|
|
19
|
+
reference={reference}
|
|
20
|
+
namespace={data.metadata?.namespace ?? ''}
|
|
21
|
+
onNavigate={onNavigate}
|
|
22
|
+
/>}
|
|
23
|
+
/>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ValuesReference({ reference, namespace, onNavigate }: {
|
|
27
|
+
reference: FluxValuesReference
|
|
28
|
+
namespace: string
|
|
29
|
+
onNavigate?: (ref: ResourceRef) => void
|
|
30
|
+
}) {
|
|
31
|
+
const kind = reference.kind === 'Secret' ? 'secrets' : 'configmaps'
|
|
32
|
+
const query = useResourceAvailability(kind, namespace, reference.name)
|
|
33
|
+
|
|
34
|
+
if ((query.data === 'present' || query.data === 'unchecked') && !query.error) {
|
|
35
|
+
return <>
|
|
36
|
+
<ResourceLink name={reference.name} kind={kind} namespace={namespace} onNavigate={onNavigate} />
|
|
37
|
+
{query.data === 'unchecked' && <span className="text-theme-text-tertiary text-xs">Availability not checked</span>}
|
|
38
|
+
</>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const missing = query.data === 'missing' && !query.error
|
|
42
|
+
const message = query.isLoading ? 'Checking availability…'
|
|
43
|
+
: missing ? reference.optional ? 'Not found - skipped by Flux' : 'Not found - required by Flux'
|
|
44
|
+
: isForbiddenError(query.error) ? 'Access denied - cannot check availability'
|
|
45
|
+
: 'Could not check availability'
|
|
46
|
+
|
|
47
|
+
const retry = !query.isLoading && <button
|
|
48
|
+
type="button"
|
|
49
|
+
onClick={() => { void query.refetch() }}
|
|
50
|
+
disabled={query.isFetching}
|
|
51
|
+
aria-label={`Check ${reference.name} again`}
|
|
52
|
+
className="text-xs text-theme-text-secondary hover:text-theme-text-primary disabled:opacity-50"
|
|
53
|
+
>Check again</button>
|
|
54
|
+
|
|
55
|
+
return <>
|
|
56
|
+
<span className="text-theme-text-secondary">{reference.name}</span>
|
|
57
|
+
{query.isLoading || (missing && reference.optional) ? <>
|
|
58
|
+
<span className="text-theme-text-tertiary text-xs">{message}</span>
|
|
59
|
+
{retry}
|
|
60
|
+
</> : <AlertBanner
|
|
61
|
+
variant={missing ? 'error' : 'unknown'}
|
|
62
|
+
title={message}
|
|
63
|
+
action={retry}
|
|
64
|
+
className="w-full"
|
|
65
|
+
/>}
|
|
66
|
+
</>
|
|
67
|
+
}
|