@skyhook-io/radar-app 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +11 -11
- package/src/App.tsx +138 -116
- package/src/api/actions.errorCode.test.ts +40 -0
- package/src/api/actions.test.ts +48 -0
- package/src/api/actions.ts +79 -0
- package/src/api/apiResources.navigation.test.tsx +232 -0
- package/src/api/apiResources.ts +46 -3
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.helmSource.test.ts +39 -0
- package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
- package/src/api/client.namespaceSwitch.test.ts +107 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +580 -103
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/cnpg-ha.live.test.ts +140 -0
- package/src/api/cnpg-ha.test.ts +78 -0
- package/src/api/cnpg-ha.ts +19 -0
- package/src/api/cnpg-history.ts +123 -0
- package/src/api/cnpg-inspect.ts +102 -0
- package/src/api/cnpg-protection.ts +112 -0
- package/src/api/cnpg-recovery.test.tsx +60 -0
- package/src/api/cnpg-recovery.ts +262 -0
- package/src/api/cnpg-sessions.ts +175 -0
- package/src/api/cnpg-storage.ts +138 -0
- package/src/api/cnpg.legacy-reads.test.ts +43 -0
- package/src/api/cnpg.pooler-runtime.test.ts +15 -0
- package/src/api/cnpg.ts +428 -10
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/radarFeatures.render.test.tsx +47 -3
- package/src/api/radarFeatures.ts +5 -1
- package/src/api/reviewedActionMutation.test.tsx +164 -0
- package/src/api/reviewedActionMutation.ts +66 -0
- package/src/api/timelineSource.test.ts +9 -0
- package/src/api/timelineSource.ts +8 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/audit/AuditView.tsx +9 -0
- package/src/components/capacity/CapacityActivity.tsx +3 -31
- package/src/components/capacity/CapacityDemand.tsx +4 -36
- package/src/components/capacity/CapacityOverview.tsx +217 -56
- package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
- package/src/components/capacity/CapacityView.test.tsx +323 -0
- package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
- package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
- package/src/components/capacity/routes.ts +42 -0
- package/src/components/capacity/shared.tsx +11 -129
- package/src/components/capacity/workspaceRoute.ts +18 -0
- package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
- package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
- package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
- package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
- package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
- package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
- package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
- package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
- package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
- package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
- package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
- package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
- package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
- package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
- package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
- package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
- package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
- package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
- package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
- package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
- package/src/components/cnpg/CNPGOperator.tsx +78 -30
- package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
- package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
- package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
- package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
- package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
- package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
- package/src/components/cnpg/CNPGOverview.tsx +238 -63
- package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
- package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
- package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
- package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
- package/src/components/cnpg/CNPGPerformance.tsx +477 -0
- package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
- package/src/components/cnpg/CNPGPooling.tsx +97 -40
- package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
- package/src/components/cnpg/CNPGProtection.tsx +228 -122
- package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
- package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
- package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
- package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
- package/src/components/cnpg/CNPGStorage.tsx +619 -0
- package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
- package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
- package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
- package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
- package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
- package/src/components/cnpg/CNPGTrends.test.ts +38 -0
- package/src/components/cnpg/CNPGTrends.tsx +702 -0
- package/src/components/cnpg/CNPGView.tsx +34 -21
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
- package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
- package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
- package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
- package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
- package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
- package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
- package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
- package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
- package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
- package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
- package/src/components/cnpg/actions/actionModel.test.ts +111 -0
- package/src/components/cnpg/actions/actionModel.ts +127 -0
- package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
- package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
- package/src/components/cnpg/archivingRepair.test.ts +104 -0
- package/src/components/cnpg/archivingRepair.ts +145 -0
- package/src/components/cnpg/baseBackup.test.ts +36 -0
- package/src/components/cnpg/baseBackup.ts +36 -0
- package/src/components/cnpg/blocking.test.ts +59 -0
- package/src/components/cnpg/blocking.ts +131 -0
- package/src/components/cnpg/coverageText.test.ts +27 -0
- package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
- package/src/components/cnpg/creation/targetModel.test.ts +137 -0
- package/src/components/cnpg/creation/targetModel.ts +149 -0
- package/src/components/cnpg/fleetStatus.test.ts +46 -0
- package/src/components/cnpg/fleetStatus.ts +43 -0
- package/src/components/cnpg/formFields.ts +2 -0
- package/src/components/cnpg/grantText.test.tsx +11 -0
- package/src/components/cnpg/host.test.tsx +24 -0
- package/src/components/cnpg/host.tsx +101 -0
- package/src/components/cnpg/inspectModel.test.ts +120 -0
- package/src/components/cnpg/inspectModel.ts +140 -0
- package/src/components/cnpg/logicalSlots.test.ts +30 -0
- package/src/components/cnpg/logicalSlots.ts +29 -0
- package/src/components/cnpg/lsn.test.ts +40 -0
- package/src/components/cnpg/lsn.ts +43 -0
- package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
- package/src/components/cnpg/operations/model.test.ts +510 -0
- package/src/components/cnpg/operations/model.ts +499 -0
- package/src/components/cnpg/operations/presentation.test.ts +80 -0
- package/src/components/cnpg/operations/presentation.ts +84 -0
- package/src/components/cnpg/operations/store.ts +98 -0
- package/src/components/cnpg/operatorStatus.test.ts +134 -0
- package/src/components/cnpg/operatorStatus.ts +194 -0
- package/src/components/cnpg/paths.test.ts +54 -0
- package/src/components/cnpg/paths.ts +47 -4
- package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
- package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
- package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
- package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
- package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
- package/src/components/cnpg/protection/scheduleModel.ts +16 -0
- package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
- package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
- package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
- package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
- package/src/components/cnpg/recovery/restoreModel.ts +685 -0
- package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
- package/src/components/cnpg/refresh.test.ts +38 -0
- package/src/components/cnpg/refresh.ts +17 -0
- package/src/components/cnpg/refreshNotice.test.tsx +29 -0
- package/src/components/cnpg/routes.test.ts +34 -3
- package/src/components/cnpg/routes.ts +60 -48
- package/src/components/cnpg/runtimeAssessment.ts +198 -0
- package/src/components/cnpg/runtimeModel.test.ts +175 -0
- package/src/components/cnpg/runtimeModel.ts +196 -0
- package/src/components/cnpg/runtimeParts.test.tsx +17 -0
- package/src/components/cnpg/runtimeParts.tsx +79 -0
- package/src/components/cnpg/shared.test.tsx +59 -0
- package/src/components/cnpg/shared.tsx +100 -182
- package/src/components/cnpg/storageModel.test.ts +107 -0
- package/src/components/cnpg/storageModel.ts +101 -0
- package/src/components/cnpg/trendSamples.test.ts +148 -0
- package/src/components/cnpg/trendSamples.ts +222 -0
- package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
- package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
- package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
- package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
- package/src/components/cnpg/useCNPGNavigate.ts +21 -0
- package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
- package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
- package/src/components/cnpg/workspaceRoute.ts +23 -0
- package/src/components/cost/ApplicationCostTab.test.ts +7 -0
- package/src/components/cost/ApplicationCostTab.tsx +7 -7
- package/src/components/cost/CostView.test.ts +2 -1
- package/src/components/cost/CostView.tsx +0 -2
- package/src/components/cost/WorkloadCostTab.tsx +2 -4
- package/src/components/cost/errors.ts +3 -1
- package/src/components/cost/source.test.ts +10 -0
- package/src/components/cost/source.ts +5 -1
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/types.ts +11 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/dock/BottomDock.tsx +8 -3
- package/src/components/dock/TerminalTab.test.tsx +17 -0
- package/src/components/dock/TerminalTab.tsx +7 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +23 -8
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
- package/src/components/gitops/GitOpsView.tsx +23 -23
- package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
- package/src/components/helm/HelmCompareRoute.tsx +57 -26
- package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
- package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
- package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
- package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/helm/ValuesViewer.test.tsx +301 -0
- package/src/components/helm/ValuesViewer.tsx +169 -78
- package/src/components/home/ActivitySummary.tsx +2 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +32 -12
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +82 -0
- package/src/components/home/TopologyPreview.tsx +2 -2
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +143 -0
- package/src/components/issues/IssuesPane.test.ts +65 -1
- package/src/components/issues/IssuesPane.tsx +213 -26
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +74 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
- package/src/components/resource/PVCUsageBar.test.tsx +24 -0
- package/src/components/resource/PVCUsageBar.tsx +15 -6
- package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
- package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
- package/src/components/resources/CompositeRenderer.tsx +4 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +44 -15
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
- package/src/components/settings/SettingsDialog.tsx +49 -30
- package/src/components/timeline/TimelineList.tsx +22 -24
- package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
- package/src/components/timeline/TimelineLoadError.tsx +96 -0
- package/src/components/timeline/TimelineView.tsx +18 -45
- package/src/components/timeline/ViewModeToggle.tsx +20 -0
- package/src/components/timeline/useStickyError.test.tsx +47 -0
- package/src/components/timeline/useStickyError.ts +15 -0
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficView.tsx +12 -12
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
- package/src/components/ui/Markdown.test.tsx +65 -0
- package/src/components/ui/Markdown.tsx +144 -127
- package/src/components/ui/Omnibar.tsx +13 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/omnibar-match.test.ts +30 -0
- package/src/components/ui/omnibar-match.ts +18 -0
- package/src/components/whats-new/releaseNotes.ts +63 -1
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +63 -243
- package/src/components/workspace/layout.test.tsx +29 -0
- package/src/components/workspace/layout.tsx +259 -0
- package/src/components/workspace/table.ts +7 -0
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/contexts/CapabilitiesContext.tsx +1 -1
- package/src/integrations/resourceHost.test.tsx +55 -0
- package/src/integrations/resourceHost.ts +99 -0
- package/src/integrations/resourceHosts.test.tsx +142 -0
- package/src/integrations/resourceHosts.tsx +121 -0
- package/src/integrations/workspaceRoute.ts +20 -0
- package/src/integrations/workspaceRoutes.test.ts +40 -0
- package/src/integrations/workspaceRoutes.ts +22 -0
- package/src/integrations/workspaceScreens.tsx +14 -0
- package/src/utils/drawer-trail.ts +35 -0
- package/src/utils/kindFilterStore.test.ts +147 -0
- package/src/utils/kindFilterStore.ts +91 -0
- package/src/utils/navigation.test.ts +13 -1
- package/src/utils/navigation.ts +53 -2
- package/src/utils/page-links.ts +21 -0
- package/src/utils/tabStorage.ts +40 -0
- package/src/utils/viewMemory.test.ts +78 -0
- package/src/utils/viewMemory.ts +54 -0
- package/src/utils/wails-clipboard.ts +4 -2
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, type InputHTMLAttributes, type ReactNode } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
+
import type { ChartSourceStatus, HelmRepository, SourceUpgradeSelection } from '../../types'
|
|
6
|
+
import { TrackChartSourceDialog } from './TrackChartSourceDialog'
|
|
7
|
+
|
|
8
|
+
const state = vi.hoisted(() => ({
|
|
9
|
+
status: undefined as ChartSourceStatus | undefined,
|
|
10
|
+
repositories: [] as HelmRepository[],
|
|
11
|
+
isOwner: true,
|
|
12
|
+
featureSupported: true,
|
|
13
|
+
associateSource: vi.fn(),
|
|
14
|
+
addRepository: vi.fn(),
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
vi.mock('@skyhook-io/k8s-ui/components/ui/DialogPortal', () => ({
|
|
18
|
+
DialogPortal: ({ open, children }: { open: boolean; children: ReactNode }) => (open ? <div>{children}</div> : null),
|
|
19
|
+
}))
|
|
20
|
+
vi.mock('@skyhook-io/k8s-ui', () => ({
|
|
21
|
+
Input: (props: InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
|
|
22
|
+
}))
|
|
23
|
+
vi.mock('../settings/OperatorManagedNotice', () => ({ OperatorManagedNotice: () => null }))
|
|
24
|
+
vi.mock('../../api/client', () => {
|
|
25
|
+
const idle = { mutate: vi.fn(), mutateAsync: vi.fn(), isPending: false }
|
|
26
|
+
return {
|
|
27
|
+
useRadarFeature: () => ({ support: state.featureSupported ? 'supported' : 'unsupported' }),
|
|
28
|
+
useHelmSourceStatus: () => ({ data: state.status, error: null, refetch: vi.fn() }),
|
|
29
|
+
useHelmRepositories: () => ({ data: state.repositories, isLoading: false }),
|
|
30
|
+
useHelmOCISources: () => ({ data: [] }),
|
|
31
|
+
useClusterInfo: () => ({ data: { inCluster: false } }),
|
|
32
|
+
useCapabilities: () => ({ data: { configManagement: 'local' } }),
|
|
33
|
+
useCloudRole: () => ({ canAtLeast: () => state.isOwner }),
|
|
34
|
+
useAddHelmRepository: () => ({ mutate: state.addRepository, isPending: false }),
|
|
35
|
+
useAddOCISource: () => idle,
|
|
36
|
+
useRemoveOCISource: () => idle,
|
|
37
|
+
useSetHelmSource: () => ({ ...idle, mutate: state.associateSource }),
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
42
|
+
|
|
43
|
+
const recordedURL = 'https://stefanprodan.github.io/podinfo'
|
|
44
|
+
const movedMachine: ChartSourceStatus = {
|
|
45
|
+
recorded: { type: 'repository', reference: 'podinfo', url: recordedURL },
|
|
46
|
+
configured: false,
|
|
47
|
+
available: false,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let root: Root
|
|
51
|
+
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
state.status = movedMachine
|
|
54
|
+
state.repositories = []
|
|
55
|
+
state.isOwner = true
|
|
56
|
+
state.featureSupported = true
|
|
57
|
+
state.associateSource.mockReset()
|
|
58
|
+
state.addRepository.mockReset()
|
|
59
|
+
const element = document.createElement('div')
|
|
60
|
+
document.body.appendChild(element)
|
|
61
|
+
root = createRoot(element)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
afterEach(async () => {
|
|
65
|
+
await act(async () => root.unmount())
|
|
66
|
+
document.body.replaceChildren()
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
async function renderDialog(onSelectUpgradeSource?: (selection: SourceUpgradeSelection) => void) {
|
|
70
|
+
await act(async () => root.render(<TrackChartSourceDialog onSelectUpgradeSource={onSelectUpgradeSource} open onClose={() => undefined} chartName="podinfo" namespace="web" releaseName="storefront" />))
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function addRecordedButton() {
|
|
74
|
+
return Array.from(document.querySelectorAll('button')).find(button => button.textContent?.includes('and use it'))
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
describe('TrackChartSourceDialog one-click add of the recorded repository', () => {
|
|
78
|
+
it('adds the recorded URL under the recorded name when that name is free', async () => {
|
|
79
|
+
await renderDialog()
|
|
80
|
+
const button = addRecordedButton()
|
|
81
|
+
expect(button?.textContent).toBe('Add stefanprodan.github.io/podinfo and use it')
|
|
82
|
+
expect(button?.disabled).toBe(false)
|
|
83
|
+
expect(document.body.textContent).toContain('Saved in Helm as podinfo, the name it was recorded under.')
|
|
84
|
+
|
|
85
|
+
await act(async () => button?.click())
|
|
86
|
+
expect(state.addRepository).toHaveBeenCalledWith(
|
|
87
|
+
{ name: 'podinfo', url: recordedURL, namespace: 'web', releaseName: 'storefront' },
|
|
88
|
+
expect.anything(),
|
|
89
|
+
)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('never reuses a recorded name that points at a different repository here', async () => {
|
|
93
|
+
state.repositories = [
|
|
94
|
+
{ name: 'podinfo', url: 'https://impostor.example.test/charts' },
|
|
95
|
+
{ name: 'podinfo-2', url: 'https://other.example.test' },
|
|
96
|
+
]
|
|
97
|
+
await renderDialog()
|
|
98
|
+
expect(document.body.textContent).toContain('Saved in Helm as podinfo-3. The name podinfo already points to a different repository here.')
|
|
99
|
+
|
|
100
|
+
await act(async () => addRecordedButton()?.click())
|
|
101
|
+
expect(state.addRepository).toHaveBeenCalledWith(
|
|
102
|
+
{ name: 'podinfo-3', url: recordedURL, namespace: 'web', releaseName: 'storefront' },
|
|
103
|
+
expect.anything(),
|
|
104
|
+
)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('is disabled for a non-owner, who is told who can add sources', async () => {
|
|
108
|
+
state.isOwner = false
|
|
109
|
+
await renderDialog()
|
|
110
|
+
expect(addRecordedButton()?.disabled).toBe(true)
|
|
111
|
+
expect(document.body.textContent).toContain('Only organization owners can add or remove chart sources.')
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('is not offered when the recorded source is configured, OCI, or not recorded', async () => {
|
|
115
|
+
for (const status of [
|
|
116
|
+
{ ...movedMachine, configured: true },
|
|
117
|
+
{ recorded: { type: 'oci' as const, reference: 'oci://ghcr.io/example/charts' }, configured: false, available: false },
|
|
118
|
+
{ configured: false, available: false },
|
|
119
|
+
]) {
|
|
120
|
+
state.status = status
|
|
121
|
+
await renderDialog()
|
|
122
|
+
expect(addRecordedButton()).toBeUndefined()
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
describe('explicit source choices', () => {
|
|
129
|
+
it('keeps the recorded source visible and selects a different publisher without associating it', async () => {
|
|
130
|
+
const recorded = { type: 'repository' as const, reference: 'official', url: 'https://official.example.test/charts' }
|
|
131
|
+
const other = { type: 'repository' as const, reference: 'other', url: 'https://other.example.test/charts' }
|
|
132
|
+
state.status = { recorded, configured: true, available: true, confirmed: true, revision: 4, candidates: [recorded, other], suggestions: [
|
|
133
|
+
{ source: recorded, current: true, hasInstalledVersion: true, state: 'available' },
|
|
134
|
+
{ source: other, current: false, hasInstalledVersion: true, state: 'available' },
|
|
135
|
+
] }
|
|
136
|
+
const select = vi.fn()
|
|
137
|
+
await renderDialog(select)
|
|
138
|
+
const choices = Array.from(document.querySelectorAll('button')).filter(button => button.textContent?.includes('Select for upgrade'))
|
|
139
|
+
expect(choices).toHaveLength(2)
|
|
140
|
+
expect(choices[0].getAttribute('aria-label')).toContain(recorded.url)
|
|
141
|
+
expect(choices[1].parentElement?.textContent).toContain('Other source')
|
|
142
|
+
await act(async () => choices[1].click())
|
|
143
|
+
expect(select).toHaveBeenCalledWith({source: other, expectedRevision: 4, expectedSource: recorded})
|
|
144
|
+
expect(state.associateSource).not.toHaveBeenCalled()
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('offers a pruned mirror for an explicit upgrade without claiming it supplied the installed version', async () => {
|
|
148
|
+
const mirror = { type: 'repository' as const, reference: 'mirror', url: 'https://mirror.example.test/charts' }
|
|
149
|
+
state.status = { configured: false, available: false, confirmed: false, revision: 1, candidates: [], suggestions: [
|
|
150
|
+
{ source: mirror, current: false, hasInstalledVersion: false, state: 'available' },
|
|
151
|
+
] }
|
|
152
|
+
const select = vi.fn()
|
|
153
|
+
await renderDialog(select)
|
|
154
|
+
const button = Array.from(document.querySelectorAll('button')).find(item => item.textContent?.includes('Select for upgrade'))
|
|
155
|
+
expect(button).toBeDefined()
|
|
156
|
+
await act(async () => button?.click())
|
|
157
|
+
expect(select).toHaveBeenCalledWith({source: mirror, expectedRevision: 1, expectedSource: null})
|
|
158
|
+
expect(state.associateSource).not.toHaveBeenCalled()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it('does not offer source switching on a backend without the capability', async () => {
|
|
162
|
+
state.featureSupported = false
|
|
163
|
+
state.status = { configured: false, available: false, revision: 1, suggestions: [
|
|
164
|
+
{ source: {type: 'repository', reference: 'mirror', url: 'https://mirror.example.test/charts'}, current: false, hasInstalledVersion: false, state: 'available' },
|
|
165
|
+
] }
|
|
166
|
+
await renderDialog(vi.fn())
|
|
167
|
+
expect(document.body.textContent).not.toContain('Select for upgrade')
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
describe('OCI original-source verification', () => {
|
|
173
|
+
it('can verify and record an unchecked registered OCI source without upgrading', async () => {
|
|
174
|
+
const source = { type: 'oci' as const, reference: 'oci://registry.example.test/team/podinfo' }
|
|
175
|
+
state.status = { configured: false, available: false, revision: 1, confirmed: false, candidates: [], suggestions: [
|
|
176
|
+
{source, current: false, hasInstalledVersion: false, state: 'unchecked'},
|
|
177
|
+
] }
|
|
178
|
+
const select = vi.fn()
|
|
179
|
+
await renderDialog(select)
|
|
180
|
+
const button = Array.from(document.querySelectorAll('button')).find(item => item.textContent === 'Verify and record original source')
|
|
181
|
+
expect(button).toBeDefined()
|
|
182
|
+
await act(async () => button?.click())
|
|
183
|
+
expect(state.associateSource).toHaveBeenCalledWith(source, expect.anything())
|
|
184
|
+
expect(select).not.toHaveBeenCalled()
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('shows the no-source hint when the backend omits empty suggestions', async () => {
|
|
189
|
+
state.status = { configured: false, available: false, revision: 1 }
|
|
190
|
+
await renderDialog(vi.fn())
|
|
191
|
+
expect(document.body.textContent).toContain('No configured sources found. Add a repository or OCI source.')
|
|
192
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { getSourceIssueCopy, isValidHelmRepositoryURL, normalizedRepositoryName, recordedRepositoryName, repositoryDisplayURL, sourceStateLabel, sourceStatusLine } from './TrackChartSourceDialog'
|
|
3
|
+
|
|
4
|
+
describe('chart source recovery presentation', () => {
|
|
5
|
+
it('keeps recorded, configured, and available states distinct', () => {
|
|
6
|
+
expect(sourceStateLabel(false, false, false)).toBe('Not recorded')
|
|
7
|
+
expect(sourceStateLabel(true, false, false)).toBe('Recorded · not configured here')
|
|
8
|
+
expect(sourceStateLabel(true, true, false)).toBe('Recorded and configured · source unavailable')
|
|
9
|
+
expect(sourceStateLabel(true, true, true)).toBe('Recorded · configured · available')
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('claims nothing about the recorded source until it has been read', () => {
|
|
13
|
+
expect(sourceStatusLine(undefined, undefined)).toBe('Checking the recorded source...')
|
|
14
|
+
expect(sourceStatusLine(undefined, new Error('failed to load repo file'))).toBe("Could not read this release's source: failed to load repo file")
|
|
15
|
+
expect(sourceStatusLine({ configured: false, available: false }, new Error('refetch failed'))).toBe('Not recorded')
|
|
16
|
+
expect(sourceStatusLine({ recorded: { type: 'repository', reference: 'repo', url: 'https://charts.example.test' }, configured: false, available: false }, undefined)).toBe('Recorded · not configured here')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('makes ambiguity explicit rather than selecting a source', () => {
|
|
20
|
+
expect(getSourceIssueCopy('ambiguous_source')?.title).toBe('Chart source unresolved')
|
|
21
|
+
expect(getSourceIssueCopy('ambiguous_source')?.body).toContain('choose a source for the next upgrade')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('accepts only HTTP repository URLs', () => {
|
|
25
|
+
expect(isValidHelmRepositoryURL('https://charts.example.test')).toBe(true)
|
|
26
|
+
expect(isValidHelmRepositoryURL('oci://registry.example.test/charts')).toBe(false)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('picks a free local name for the recorded repository', () => {
|
|
30
|
+
expect(recordedRepositoryName('podinfo', [])).toBe('podinfo')
|
|
31
|
+
expect(recordedRepositoryName('podinfo', [{ name: 'Podinfo', url: 'https://impostor.example.test' }])).toBe('podinfo-2')
|
|
32
|
+
expect(recordedRepositoryName('podinfo', [{ name: 'podinfo', url: 'a' }, { name: 'podinfo-2', url: 'b' }])).toBe('podinfo-3')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('checks names the way the server stores them', () => {
|
|
36
|
+
expect(normalizedRepositoryName(' My Charts! ')).toBe('my-charts')
|
|
37
|
+
const alias40 = 'a'.repeat(40)
|
|
38
|
+
expect(recordedRepositoryName(alias40, [{ name: alias40, url: 'a' }])).toBe(`${'a'.repeat(38)}-2`)
|
|
39
|
+
// A longer alias is stored cut to 40 characters, so that is the name that collides.
|
|
40
|
+
const alias45 = `${'b'.repeat(40)}extra`
|
|
41
|
+
expect(recordedRepositoryName(alias45, [])).toBe('b'.repeat(40))
|
|
42
|
+
expect(recordedRepositoryName(alias45, [{ name: 'b'.repeat(40), url: 'a' }])).toBe(`${'b'.repeat(38)}-2`)
|
|
43
|
+
expect(recordedRepositoryName('My_Repo', [{ name: 'my_repo', url: 'a' }])).toBe('my_repo-2')
|
|
44
|
+
expect(recordedRepositoryName('___', [])).toBe('')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('shortens repository URLs for labels', () => {
|
|
48
|
+
expect(repositoryDisplayURL('https://stefanprodan.github.io/podinfo/')).toBe('stefanprodan.github.io/podinfo')
|
|
49
|
+
expect(repositoryDisplayURL('https://charts.example.test')).toBe('charts.example.test')
|
|
50
|
+
})
|
|
51
|
+
})
|