@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
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
initNavigationMap,
|
|
5
5
|
resetNavigationMap,
|
|
6
6
|
} from '@skyhook-io/k8s-ui/utils/navigation'
|
|
7
|
-
import { getNetworkPolicyResourceTarget, relatedResourcePath, resourcePath, withCrossViewParams } from './navigation'
|
|
7
|
+
import { getNetworkPolicyResourceTarget, relatedResourcePath, resourcePath, withCrossViewParams, writeViewParams } from './navigation'
|
|
8
8
|
|
|
9
9
|
afterEach(resetNavigationMap)
|
|
10
10
|
|
|
@@ -76,3 +76,15 @@ describe('withCrossViewParams', () => {
|
|
|
76
76
|
expect(withCrossViewParams('/helm', '')).toBe('/helm')
|
|
77
77
|
})
|
|
78
78
|
})
|
|
79
|
+
|
|
80
|
+
describe('writeViewParams', () => {
|
|
81
|
+
it('keeps topology mode and grouping only on topology', () => {
|
|
82
|
+
const topology = new URLSearchParams('namespace=old&apiGroup=example.com')
|
|
83
|
+
writeViewParams(topology, [], { mode: 'traffic', grouping: 'app' })
|
|
84
|
+
expect(topology.toString()).toBe('apiGroup=example.com&mode=traffic&group=app')
|
|
85
|
+
|
|
86
|
+
const issues = new URLSearchParams('mode=traffic&group=app&kind=Widget&apiGroup=example.com&resource=ns%2Fw')
|
|
87
|
+
writeViewParams(issues, ['ns'], null)
|
|
88
|
+
expect(issues.toString()).toBe('kind=Widget&apiGroup=example.com&resource=ns%2Fw&namespaces=ns')
|
|
89
|
+
})
|
|
90
|
+
})
|
package/src/utils/navigation.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { apiUrl, getAuthHeaders, getCredentialsMode } from '../api/config'
|
|
2
2
|
import { apiVersionToGroup, kindToPluralWithGroup } from '@skyhook-io/k8s-ui/utils/navigation'
|
|
3
3
|
import { topologyNodeResourceKind } from '@skyhook-io/k8s-ui/utils/topology-neighborhood'
|
|
4
|
-
import type { SelectedResource, Topology } from '@skyhook-io/k8s-ui/types/core'
|
|
4
|
+
import type { GroupingMode, SelectedResource, Topology, TopologyMode } from '@skyhook-io/k8s-ui/types/core'
|
|
5
5
|
import type { SearchHit } from '../api/client'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -134,10 +134,61 @@ export function openExternal(url: string): void {
|
|
|
134
134
|
})
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/** The header picker's namespace selection as the URL carries it: App keeps
|
|
138
|
+
* ?namespaces= in sync with its state (legacy ?namespace= still read). */
|
|
139
|
+
export function namespacesFromSearch(params: URLSearchParams): string[] {
|
|
140
|
+
const nsParam = params.get('namespaces')
|
|
141
|
+
if (nsParam) {
|
|
142
|
+
return nsParam.split(',').map(s => s.trim()).filter(Boolean)
|
|
143
|
+
}
|
|
144
|
+
const ns = params.get('namespace')
|
|
145
|
+
if (ns) {
|
|
146
|
+
return [ns]
|
|
147
|
+
}
|
|
148
|
+
return []
|
|
149
|
+
}
|
|
150
|
+
|
|
137
151
|
// setMainView's cross-view params. A navigation whose search omits
|
|
138
152
|
// ?namespaces= reads as an empty pick to App's URL sync, which clears the
|
|
139
153
|
// user's namespace scope.
|
|
140
|
-
const CROSS_VIEW_PARAMS = ['namespaces', 'ai-run'] as const
|
|
154
|
+
export const CROSS_VIEW_PARAMS = ['namespaces', 'ai-run'] as const
|
|
155
|
+
|
|
156
|
+
/** A Resources list route (`/resources/<plural>`), as opposed to bare `/resources` or a detail page. */
|
|
157
|
+
export const RESOURCE_LIST_PATH = /^\/resources\/[^/]+$/
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Writes App's view state into the query string. Topology's `mode` and
|
|
161
|
+
* `group` are dropped on every other view, so no other view can use those
|
|
162
|
+
* names for params of its own.
|
|
163
|
+
*/
|
|
164
|
+
export function writeViewParams(
|
|
165
|
+
params: URLSearchParams,
|
|
166
|
+
namespaces: string[],
|
|
167
|
+
topology: { mode: TopologyMode; grouping: GroupingMode } | null,
|
|
168
|
+
): void {
|
|
169
|
+
if (namespaces.length > 0) {
|
|
170
|
+
params.set('namespaces', namespaces.join(','))
|
|
171
|
+
} else {
|
|
172
|
+
params.delete('namespaces')
|
|
173
|
+
}
|
|
174
|
+
// Legacy single-namespace param
|
|
175
|
+
params.delete('namespace')
|
|
176
|
+
if (!topology) {
|
|
177
|
+
params.delete('mode')
|
|
178
|
+
params.delete('group')
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
if (topology.mode !== 'resources') {
|
|
182
|
+
params.set('mode', topology.mode)
|
|
183
|
+
} else {
|
|
184
|
+
params.delete('mode')
|
|
185
|
+
}
|
|
186
|
+
if (topology.grouping !== 'none' && (namespaces.length === 0 || topology.grouping !== 'namespace')) {
|
|
187
|
+
params.set('group', topology.grouping)
|
|
188
|
+
} else {
|
|
189
|
+
params.delete('group')
|
|
190
|
+
}
|
|
191
|
+
}
|
|
141
192
|
|
|
142
193
|
/** Carries the current cross-view params onto an in-app path that doesn't set them itself. */
|
|
143
194
|
export function withCrossViewParams(path: string, currentSearch: string): string {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The label for "← back" on the page a push lands on: the title of the page
|
|
3
|
+
* being left, which Radar keeps in the document title.
|
|
4
|
+
*/
|
|
5
|
+
export function currentPageLabel(): string {
|
|
6
|
+
return document.title.replace(/\s*·\s*Radar$/, '') || 'previous page'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Radar's Issues page narrowed to one subject (it has no link to a single issue).
|
|
11
|
+
* The subject travels as `resource=ns/name`, never `namespace=`: App reads a bare
|
|
12
|
+
* `namespace` as the view filter, and a URL without `namespaces` clears it.
|
|
13
|
+
*/
|
|
14
|
+
export function issuesPathForSubject(subject: { kind: string; group?: string; namespace: string; name: string }, viewNamespaces?: string | null): string {
|
|
15
|
+
const params = new URLSearchParams()
|
|
16
|
+
if (viewNamespaces) params.set('namespaces', viewNamespaces)
|
|
17
|
+
params.set('kind', subject.kind)
|
|
18
|
+
if (subject.group) params.set('apiGroup', subject.group)
|
|
19
|
+
params.set('resource', subject.namespace ? `${subject.namespace}/${subject.name}` : subject.name)
|
|
20
|
+
return `/issues?${params}`
|
|
21
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tab strings in sessionStorage: they survive a reload and are copied
|
|
3
|
+
* when the tab is duplicated, while a tab opened from scratch starts empty.
|
|
4
|
+
* Without sessionStorage (private mode, blocked site data) they live in
|
|
5
|
+
* memory, so a reload forgets them.
|
|
6
|
+
*/
|
|
7
|
+
export function createTabStorage() {
|
|
8
|
+
let session: Storage | undefined
|
|
9
|
+
try {
|
|
10
|
+
session = sessionStorage
|
|
11
|
+
session.getItem('')
|
|
12
|
+
} catch {
|
|
13
|
+
session = undefined
|
|
14
|
+
}
|
|
15
|
+
const memory = new Map<string, string>()
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
get(key: string): string | undefined {
|
|
19
|
+
return session ? session.getItem(key) ?? undefined : memory.get(key)
|
|
20
|
+
},
|
|
21
|
+
set(key: string, value: string) {
|
|
22
|
+
if (!session) {
|
|
23
|
+
memory.set(key, value)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
session.setItem(key, value)
|
|
28
|
+
} catch { /* over quota: keep the previous value */ }
|
|
29
|
+
},
|
|
30
|
+
keys(): string[] {
|
|
31
|
+
if (!session) return [...memory.keys()]
|
|
32
|
+
const keys: string[] = []
|
|
33
|
+
for (let i = 0; i < session.length; i++) {
|
|
34
|
+
const key = session.key(i)
|
|
35
|
+
if (key !== null) keys.push(key)
|
|
36
|
+
}
|
|
37
|
+
return keys
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { createViewMemory } from './viewMemory'
|
|
3
|
+
|
|
4
|
+
afterEach(() => vi.stubGlobal('sessionStorage', undefined))
|
|
5
|
+
|
|
6
|
+
describe('createViewMemory', () => {
|
|
7
|
+
it('remembers the last resource kind list for the Resources section', () => {
|
|
8
|
+
const memory = createViewMemory('/api|ctx')
|
|
9
|
+
memory.record('resources', '/resources/pods', '?filters=namespace:a&namespaces=x')
|
|
10
|
+
memory.record('resources', '/resources/services', '?search=web')
|
|
11
|
+
|
|
12
|
+
expect(memory.sectionPath('resources')).toBe('/resources/services?search=web')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('never remembers the global namespace pick, the investigation focus or an open drawer', () => {
|
|
16
|
+
const memory = createViewMemory('/api|ctx')
|
|
17
|
+
memory.record('resources', '/resources/pods', '?namespaces=a,b&ai-run=r1&resource=a/web&tab=yaml&full=1&problems=failed')
|
|
18
|
+
|
|
19
|
+
expect(memory.sectionPath('resources')).toBe('/resources/pods?problems=failed')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('returns to the list, not to a detail view opened on top of it', () => {
|
|
23
|
+
const memory = createViewMemory('/api|ctx')
|
|
24
|
+
memory.record('helm', '/helm', '?release=default/web&releaseStorage=secret')
|
|
25
|
+
memory.record('applications', '/applications', '?health=degraded&app=default/web&view=cost&workload=apps/Deployment/a/web&tab=logs&run=r1')
|
|
26
|
+
memory.record('cnpg', '/cnpg', '?drawer=cluster:a/db&cat=backups')
|
|
27
|
+
memory.record('timeline', '/timeline', '?event=e1&activity=warnings')
|
|
28
|
+
|
|
29
|
+
expect(memory.sectionPath('helm')).toBe('/helm')
|
|
30
|
+
expect(memory.sectionPath('applications')).toBe('/applications?health=degraded')
|
|
31
|
+
expect(memory.sectionPath('cnpg')).toBe('/cnpg?cat=backups')
|
|
32
|
+
expect(memory.sectionPath('timeline')).toBe('/timeline?activity=warnings')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it("keeps only the params that shape that section's list", () => {
|
|
36
|
+
const memory = createViewMemory('/api|ctx')
|
|
37
|
+
memory.record('timeline', '/timeline', '?app=default/Deployment/web&scopeNamespaces=default&time=all&whats-new=1')
|
|
38
|
+
memory.record('topology', '/topology', '?mode=traffic&group=namespace&unknown=x')
|
|
39
|
+
memory.record('traffic', '/traffic', '?q=web')
|
|
40
|
+
|
|
41
|
+
expect(memory.sectionPath('timeline')).toBe('/timeline?app=default%2FDeployment%2Fweb&scopeNamespaces=default&time=all')
|
|
42
|
+
expect(memory.sectionPath('topology')).toBe('/topology?mode=traffic&group=namespace')
|
|
43
|
+
expect(memory.sectionPath('traffic')).toBe('/traffic')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('remembers section list routes but not their detail pages', () => {
|
|
47
|
+
const memory = createViewMemory('/api|ctx')
|
|
48
|
+
memory.record('gitops', '/gitops', '?health=degraded')
|
|
49
|
+
memory.record('gitops', '/gitops/argo/argocd/app', '?tab=tree')
|
|
50
|
+
memory.record('home', '/', '')
|
|
51
|
+
|
|
52
|
+
expect(memory.sectionPath('gitops')).toBe('/gitops?health=degraded')
|
|
53
|
+
expect(memory.sectionPath('home')).toBe('/')
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('records a cleared list as no filters, so Clear filters also clears the memory', () => {
|
|
57
|
+
const memory = createViewMemory('/api|ctx')
|
|
58
|
+
memory.record('resources', '/resources/pods', '?filters=namespace:a')
|
|
59
|
+
memory.record('resources', '/resources/pods', '?namespaces=x')
|
|
60
|
+
|
|
61
|
+
expect(memory.sectionPath('resources')).toBe('/resources/pods')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('survives a reload of the tab, per cluster, and never reaches a new tab', () => {
|
|
65
|
+
const items = new Map<string, string>()
|
|
66
|
+
vi.stubGlobal('sessionStorage', {
|
|
67
|
+
getItem: (k: string) => items.get(k) ?? null,
|
|
68
|
+
setItem: (k: string, v: string) => void items.set(k, v),
|
|
69
|
+
})
|
|
70
|
+
createViewMemory('/api|ctx').record('timeline', '/timeline', '?activity=warnings')
|
|
71
|
+
|
|
72
|
+
expect(createViewMemory('/api|ctx').sectionPath('timeline')).toBe('/timeline?activity=warnings')
|
|
73
|
+
expect(createViewMemory('/api|other').sectionPath('timeline')).toBeUndefined()
|
|
74
|
+
|
|
75
|
+
items.clear()
|
|
76
|
+
expect(createViewMemory('/api|ctx').sectionPath('timeline')).toBeUndefined()
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RESOURCE_LIST_FILTER_PARAMS } from '../components/resources/resource-utils'
|
|
2
|
+
import { RESOURCE_LIST_PATH } from './navigation'
|
|
3
|
+
import { createTabStorage } from './tabStorage'
|
|
4
|
+
|
|
5
|
+
// The params that shape each section's list. Anything else (the global
|
|
6
|
+
// picker's params, a drawer, a detail opened on top of the list, a one-off
|
|
7
|
+
// modal) belongs to one visit, so a param a view adds later is forgotten until
|
|
8
|
+
// it is listed here. A section that isn't listed returns to its bare path.
|
|
9
|
+
const REMEMBERED: Record<string, readonly string[]> = {
|
|
10
|
+
resources: ['apiGroup', ...RESOURCE_LIST_FILTER_PARAMS],
|
|
11
|
+
topology: ['mode', 'group'],
|
|
12
|
+
timeline: ['view', 'window', 'from', 'to', 'activity', 'kinds', 'deleted', 'routine', 'pinnedOnly', 'q', 'grouping', 'sort', 'app', 'scopeNamespaces', 'time'],
|
|
13
|
+
gitops: ['q', 'sync', 'health', 'project', 'automation', 'labels', 'lifecycle', 'kind'],
|
|
14
|
+
applications: ['q', 'health', 'class', 'type', 'env', 'source', 'system'],
|
|
15
|
+
checks: ['q', 'severity', 'category', 'framework'],
|
|
16
|
+
cnpg: ['q', 'cat', 'filter'],
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function listSearch(view: string, search: string): string {
|
|
20
|
+
const remembered = REMEMBERED[view] ?? []
|
|
21
|
+
const params = new URLSearchParams(search)
|
|
22
|
+
for (const key of [...params.keys()]) {
|
|
23
|
+
if (!remembered.includes(key)) params.delete(key)
|
|
24
|
+
}
|
|
25
|
+
const query = params.toString()
|
|
26
|
+
return query ? `?${query}` : ''
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The tab's last list URL per section, per cluster. The URL stays the source
|
|
31
|
+
* of truth: entries are recorded from it and restored by navigating back to
|
|
32
|
+
* them. Kept per tab (see createTabStorage), never shared with other tabs.
|
|
33
|
+
*/
|
|
34
|
+
export function createViewMemory(cluster: string) {
|
|
35
|
+
const sections = createTabStorage()
|
|
36
|
+
const sectionKey = (view: string) => `radar-section:${cluster}:${view}`
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
/** Records a location. Only list routes are remembered, not detail pages. */
|
|
40
|
+
record(view: string, pathname: string, search: string) {
|
|
41
|
+
const path = pathname.replace(/\/+$/, '') || '/'
|
|
42
|
+
const query = listSearch(view, search)
|
|
43
|
+
const resourceList = view === 'resources' && RESOURCE_LIST_PATH.test(path)
|
|
44
|
+
if (!resourceList && path !== (view === 'home' ? '/' : `/${view}`)) return
|
|
45
|
+
sections.set(sectionKey(view), path + query)
|
|
46
|
+
},
|
|
47
|
+
/** The section's last list URL, without cross-view params. */
|
|
48
|
+
sectionPath(view: string): string | undefined {
|
|
49
|
+
return sections.get(sectionKey(view))
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type ViewMemory = ReturnType<typeof createViewMemory>
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
// these accelerators with nil callbacks (native responder chain), but WKWebView
|
|
11
11
|
// does NOT dispatch a DOM copy/cut event from the native copy: selector.
|
|
12
12
|
// The keydown event DOES reach JS, so we intercept it here.
|
|
13
|
-
// Cmd+V: Handled by menu.go's explicit WindowExecJS callback which reads
|
|
14
|
-
//
|
|
13
|
+
// Cmd+V: Handled by menu.go's explicit WindowExecJS callback, which reads
|
|
14
|
+
// through Wails on macOS. Focused Monaco editors receive a text paste command
|
|
15
|
+
// to avoid their rich paste handler reading the clipboard again. Other
|
|
16
|
+
// inputs receive a synthetic paste event.
|
|
15
17
|
// Right-click Copy/Cut (Monaco): Monaco calls document.execCommand('copy'/'cut'),
|
|
16
18
|
// intercepted by the monkey-patch below.
|
|
17
19
|
// Right-click Paste (Monaco): Not supported — Monaco calls navigator.clipboard
|