@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
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
FreshnessControl,
|
|
21
21
|
PaneLoader,
|
|
22
22
|
StatusDot,
|
|
23
|
-
|
|
23
|
+
issueTitle,
|
|
24
24
|
groupLabel,
|
|
25
25
|
issueFirstSeenTitle,
|
|
26
26
|
issueTimingForDisplay,
|
|
@@ -30,6 +30,8 @@ import {
|
|
|
30
30
|
import { formatCompactAge } from '@skyhook-io/k8s-ui/utils/format'
|
|
31
31
|
import { ClusterHealthCard } from './ClusterHealthCard'
|
|
32
32
|
import { AlertTriangle, CheckCircle, Loader2, Shield } from 'lucide-react'
|
|
33
|
+
import { uncheckedSourceLines } from '../issues/uncheckedSources'
|
|
34
|
+
import { UncheckedSourceHelp } from '../issues/UncheckedSourceHelp'
|
|
33
35
|
import { clsx } from 'clsx'
|
|
34
36
|
import { getVersionUpdateStatus } from '../../utils/version'
|
|
35
37
|
import { RadarVersionLine } from './RadarVersionLine'
|
|
@@ -67,7 +69,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
67
69
|
karpenterState === 'available' || karpenterState === 'denied' || karpenterState === 'not_detected'
|
|
68
70
|
const { data, isLoading, error, dataUpdatedAt, refetch } = useDashboard(namespaces)
|
|
69
71
|
const { connection } = useConnection()
|
|
70
|
-
const { data: issuesData, isLoading: issuesLoading, isFetching: issuesFetching, error: issuesError } = useIssues(namespaces)
|
|
72
|
+
const { data: issuesData, isLoading: issuesLoading, isFetching: issuesFetching, error: issuesError, refetch: refetchIssues } = useIssues(namespaces)
|
|
71
73
|
const issues = issuesData?.issues ?? []
|
|
72
74
|
const issueCount = issuesData?.total_matched ?? issuesData?.total ?? issues.length
|
|
73
75
|
const hasCriticalIssues = issues.some((issue) => issue.severity === 'critical')
|
|
@@ -211,7 +213,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
211
213
|
/>
|
|
212
214
|
</BandItem>
|
|
213
215
|
<BandItem>
|
|
214
|
-
<CostCard onNavigate={() => onNavigateToView('cost')} />
|
|
216
|
+
<CostCard namespaces={namespaces} onNavigate={() => onNavigateToView('cost')} />
|
|
215
217
|
</BandItem>
|
|
216
218
|
</div>
|
|
217
219
|
|
|
@@ -271,6 +273,8 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
271
273
|
issues={issues}
|
|
272
274
|
issueCount={issueCount}
|
|
273
275
|
visibility={issuesData?.visibility}
|
|
276
|
+
uncheckedLines={uncheckedSourceLines(issuesData?.unchecked_sources)}
|
|
277
|
+
onRetryIssues={() => { void refetchIssues({ cancelRefetch: false }) }}
|
|
274
278
|
hasData={!!issuesData}
|
|
275
279
|
isLoading={issuesLoading && !issuesData}
|
|
276
280
|
isRefreshing={issuesFetching && !!issuesData}
|
|
@@ -300,6 +304,10 @@ interface ProblemsPanelProps {
|
|
|
300
304
|
issues: Issue[]
|
|
301
305
|
issueCount: number
|
|
302
306
|
visibility?: IssuesResponse['visibility']
|
|
307
|
+
/** One line per issue source Radar couldn't check. Any line means an
|
|
308
|
+
* empty list isn't an all-clear. */
|
|
309
|
+
uncheckedLines?: string[]
|
|
310
|
+
onRetryIssues: () => void
|
|
303
311
|
hasData: boolean
|
|
304
312
|
isLoading: boolean
|
|
305
313
|
isRefreshing: boolean
|
|
@@ -309,11 +317,12 @@ interface ProblemsPanelProps {
|
|
|
309
317
|
onResourceClick: (resource: SelectedResource) => void
|
|
310
318
|
}
|
|
311
319
|
|
|
312
|
-
|
|
313
|
-
function ProblemsPanel({
|
|
320
|
+
export function ProblemsPanel({
|
|
314
321
|
issues,
|
|
315
322
|
issueCount,
|
|
316
323
|
visibility,
|
|
324
|
+
uncheckedLines = [],
|
|
325
|
+
onRetryIssues,
|
|
317
326
|
hasData,
|
|
318
327
|
isLoading,
|
|
319
328
|
isRefreshing,
|
|
@@ -322,6 +331,7 @@ function ProblemsPanel({
|
|
|
322
331
|
onNavigateToIssues,
|
|
323
332
|
onResourceClick,
|
|
324
333
|
}: ProblemsPanelProps) {
|
|
334
|
+
const unchecked = uncheckedLines.length > 0
|
|
325
335
|
const hasCriticalIssues = issues.some((issue) => issue.severity === 'critical')
|
|
326
336
|
const hasIssues = issueCount > 0
|
|
327
337
|
const hasHardError = !!error && !hasData
|
|
@@ -329,14 +339,14 @@ function ProblemsPanel({
|
|
|
329
339
|
const isTruncated = issueCount > totalReturned
|
|
330
340
|
const titleClass = hasCriticalIssues
|
|
331
341
|
? 'text-red-500'
|
|
332
|
-
: hasIssues || hasHardError || hasLimitedVisibility
|
|
342
|
+
: hasIssues || hasHardError || hasLimitedVisibility || unchecked
|
|
333
343
|
? 'text-amber-500'
|
|
334
344
|
: 'text-theme-text-secondary'
|
|
335
345
|
const countClass = hasHardError
|
|
336
346
|
? 'status-unknown'
|
|
337
347
|
: hasCriticalIssues
|
|
338
348
|
? 'status-unhealthy'
|
|
339
|
-
: hasIssues || hasLimitedVisibility
|
|
349
|
+
: hasIssues || hasLimitedVisibility || unchecked
|
|
340
350
|
? 'status-degraded'
|
|
341
351
|
: 'status-healthy'
|
|
342
352
|
const countLabel = isLoading ? '...' : hasHardError ? 'error' : String(issueCount)
|
|
@@ -387,6 +397,12 @@ function ProblemsPanel({
|
|
|
387
397
|
Limited visibility - {visibility.impact} Results may be incomplete.
|
|
388
398
|
</ProblemsPanelNotice>
|
|
389
399
|
)}
|
|
400
|
+
{(issues.length > 0 || hasLimitedVisibility) && unchecked && (
|
|
401
|
+
<ProblemsPanelNotice tone="warning">
|
|
402
|
+
{uncheckedLines.map((line) => <p key={line}>{line}</p>)}
|
|
403
|
+
<UncheckedSourceHelp onRetry={onRetryIssues} isRefreshing={isRefreshing} />
|
|
404
|
+
</ProblemsPanelNotice>
|
|
405
|
+
)}
|
|
390
406
|
{isTruncated && (
|
|
391
407
|
<ProblemsPanelNotice tone="neutral">
|
|
392
408
|
Showing {totalReturned} of {issueCount} issues. Narrow by namespace to see the rest.
|
|
@@ -396,16 +412,19 @@ function ProblemsPanel({
|
|
|
396
412
|
{issues.length === 0 ? (
|
|
397
413
|
<ProblemsPanelState
|
|
398
414
|
icon={
|
|
399
|
-
hasLimitedVisibility
|
|
415
|
+
hasLimitedVisibility || unchecked
|
|
400
416
|
? <AlertTriangle className="h-5 w-5 text-amber-500" />
|
|
401
417
|
: <CheckCircle className="h-5 w-5 text-green-500" />
|
|
402
418
|
}
|
|
403
|
-
title={hasLimitedVisibility ? 'No visible active issues' : 'No active issues'}
|
|
419
|
+
title={hasLimitedVisibility ? 'No visible active issues' : unchecked ? 'No issues found' : 'No active issues'}
|
|
404
420
|
body={
|
|
405
421
|
hasLimitedVisibility
|
|
406
422
|
? 'Radar could not read every workload source in this scope.'
|
|
407
|
-
:
|
|
423
|
+
: unchecked
|
|
424
|
+
? uncheckedLines.join(' ')
|
|
425
|
+
: 'No critical or warning issues across the selected scope.'
|
|
408
426
|
}
|
|
427
|
+
action={unchecked && !hasLimitedVisibility ? <UncheckedSourceHelp onRetry={onRetryIssues} isRefreshing={isRefreshing} /> : undefined}
|
|
409
428
|
/>
|
|
410
429
|
) : (
|
|
411
430
|
<div className="divide-y divide-theme-border">
|
|
@@ -448,7 +467,7 @@ function ProblemsPanel({
|
|
|
448
467
|
)}
|
|
449
468
|
</div>
|
|
450
469
|
<div className="flex items-center gap-1.5 mt-0.5">
|
|
451
|
-
<span className="text-[11px] text-theme-text-secondary truncate">{
|
|
470
|
+
<span className="text-[11px] text-theme-text-secondary truncate">{issueTitle(issue)}</span>
|
|
452
471
|
<span className="text-[10px] text-theme-text-tertiary shrink-0">{groupLabel(issue.category_group)}</span>
|
|
453
472
|
{issue.namespace && <span className="text-[10px] text-theme-text-tertiary shrink-0">{issue.namespace}</span>}
|
|
454
473
|
</div>
|
|
@@ -472,7 +491,7 @@ function ProblemsPanel({
|
|
|
472
491
|
)
|
|
473
492
|
}
|
|
474
493
|
|
|
475
|
-
function ProblemsPanelState({ icon, title, body }: { icon: ReactNode; title: string; body: string }) {
|
|
494
|
+
function ProblemsPanelState({ icon, title, body, action }: { icon: ReactNode; title: string; body: string; action?: ReactNode }) {
|
|
476
495
|
return (
|
|
477
496
|
<div className="flex min-h-[220px] flex-col items-center justify-center gap-2 px-6 py-10 text-center">
|
|
478
497
|
<div className="flex h-9 w-9 items-center justify-center rounded-full bg-theme-elevated">
|
|
@@ -480,6 +499,7 @@ function ProblemsPanelState({ icon, title, body }: { icon: ReactNode; title: str
|
|
|
480
499
|
</div>
|
|
481
500
|
<p className="text-sm font-medium text-theme-text-primary">{title}</p>
|
|
482
501
|
<p className="max-w-[280px] text-xs leading-5 text-theme-text-secondary">{body}</p>
|
|
502
|
+
{action && <div className="w-full max-w-[280px]">{action}</div>}
|
|
483
503
|
</div>
|
|
484
504
|
)
|
|
485
505
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import { MCPSetupDialog } from './MCPSetupDialog'
|
|
5
|
+
import { mcpEndpointUrl, setBasename } from '../../api/config'
|
|
6
|
+
|
|
7
|
+
describe('MCP setup in read-only mode', () => {
|
|
8
|
+
it('generates client configurations for the retained endpoint and hides writes', () => {
|
|
9
|
+
setBasename('/radar')
|
|
10
|
+
try {
|
|
11
|
+
const url = mcpEndpointUrl(true)
|
|
12
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open readOnly mcpUrl={url} onClose={() => {}} />)
|
|
13
|
+
expect(html).toContain(`claude mcp add --transport http radar ${url}`)
|
|
14
|
+
expect(html).toContain(`codex mcp add radar --url ${url}`)
|
|
15
|
+
expect(html).toContain('/radar/mcp-readonly')
|
|
16
|
+
expect(html).toContain('list_namespaces')
|
|
17
|
+
expect(html).not.toContain('apply_resource')
|
|
18
|
+
expect(html).not.toContain('in_cluster')
|
|
19
|
+
expect(html).toContain('Read-only mode blocks write tools')
|
|
20
|
+
} finally {
|
|
21
|
+
setBasename('')
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('keeps the full catalog in default mode', () => {
|
|
26
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
27
|
+
expect(html).toContain('apply_resource')
|
|
28
|
+
expect(html).toContain('in_cluster')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -8,6 +8,7 @@ import { Disclosure } from '@skyhook-io/k8s-ui/components/ui/Disclosure'
|
|
|
8
8
|
interface MCPSetupDialogProps {
|
|
9
9
|
open: boolean
|
|
10
10
|
onClose: () => void
|
|
11
|
+
readOnly?: boolean
|
|
11
12
|
mcpUrl: string
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -43,7 +44,7 @@ function CodeBlock({ children }: { children: string }) {
|
|
|
43
44
|
)
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
47
|
+
export function MCPSetupDialog({ open, onClose, mcpUrl, readOnly = false }: MCPSetupDialogProps) {
|
|
47
48
|
const dialogRef = useRef<HTMLDivElement>(null)
|
|
48
49
|
const [isDesktop, setIsDesktop] = useState(false)
|
|
49
50
|
const [portPinned, setPortPinned] = useState(false)
|
|
@@ -116,6 +117,12 @@ export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
|
116
117
|
|
|
117
118
|
const currentPort = Number(window.location.port) || 80
|
|
118
119
|
|
|
120
|
+
const tools = MCP_TOOL_CATALOG
|
|
121
|
+
.filter((tool) => !readOnly || !tool.write)
|
|
122
|
+
.map((tool) => readOnly && tool.name === 'diagnose'
|
|
123
|
+
? { ...tool, params: tool.params.filter((param) => param.arg !== 'in_cluster') }
|
|
124
|
+
: tool)
|
|
125
|
+
|
|
119
126
|
const mcpServersUrlConfig = (key: 'url' | 'serverUrl') => JSON.stringify({
|
|
120
127
|
mcpServers: {
|
|
121
128
|
radar: {
|
|
@@ -210,17 +217,17 @@ export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
|
210
217
|
<a href="https://modelcontextprotocol.io" target="_blank" rel="noopener noreferrer" className="text-purple-400 hover:text-purple-300 underline underline-offset-2">
|
|
211
218
|
Model Context Protocol
|
|
212
219
|
</a>{' '}
|
|
213
|
-
(MCP) server that lets AI agents inspect, investigate, and operate your cluster through Radar.
|
|
220
|
+
(MCP) server that lets AI agents {readOnly ? 'inspect and investigate' : 'inspect, investigate, and operate'} your cluster through Radar.
|
|
214
221
|
Unlike raw kubectl access, Radar gives your AI pre-processed, enriched data —
|
|
215
222
|
topology graphs, health assessments, deduplicated events, filtered logs — so it
|
|
216
223
|
can understand your cluster state quickly without burning through context on
|
|
217
224
|
verbose YAML output.
|
|
218
225
|
</p>
|
|
219
226
|
<p className="text-sm text-theme-text-secondary leading-relaxed">
|
|
220
|
-
Most read tools do not change cluster state. An in-cluster route probe can create up
|
|
227
|
+
{readOnly ? 'Read-only mode blocks write tools and diagnostic options that create temporary Kubernetes resources. It does not restrict the Radar UI or REST API.' : <>Most read tools do not change cluster state. An in-cluster route probe can create up
|
|
221
228
|
to five self-deleting probe pods when explicitly requested. Write tools (restart,
|
|
222
229
|
scale, sync, apply, node drain) are annotated as destructive so your AI client
|
|
223
|
-
can flag them and prompt before running
|
|
230
|
+
can flag them and prompt before running.</>}
|
|
224
231
|
</p>
|
|
225
232
|
</div>
|
|
226
233
|
|
|
@@ -319,10 +326,10 @@ export function MCPSetupDialog({ open, onClose, mcpUrl }: MCPSetupDialogProps) {
|
|
|
319
326
|
<div className="space-y-2">
|
|
320
327
|
<div className="flex items-baseline justify-between">
|
|
321
328
|
<h4 className="text-sm font-semibold text-theme-text-primary">Tools</h4>
|
|
322
|
-
<span className="text-[11px] text-theme-text-tertiary">{
|
|
329
|
+
<span className="text-[11px] text-theme-text-tertiary">{tools.length} tools</span>
|
|
323
330
|
</div>
|
|
324
331
|
<div className="grid grid-cols-1 gap-1.5">
|
|
325
|
-
{
|
|
332
|
+
{tools.map((tool) => (
|
|
326
333
|
<div key={tool.name} className="card-inner space-y-1.5">
|
|
327
334
|
<div className="flex items-center gap-2">
|
|
328
335
|
<code className="inline-code text-[11px]">{tool.name}</code>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { renderToString } from 'react-dom/server'
|
|
3
|
+
import type { Issue } from '@skyhook-io/k8s-ui'
|
|
4
|
+
import { ProblemsPanel } from './HomeView'
|
|
5
|
+
import { uncheckedSourceLines } from '../issues/uncheckedSources'
|
|
6
|
+
import type { IssuesResponse } from '../../api/client'
|
|
7
|
+
|
|
8
|
+
const line = "Helm releases couldn't be checked, so failed or stuck releases may be missing."
|
|
9
|
+
const generic = "Some issue checks couldn't run, so issues may be missing."
|
|
10
|
+
const helm = [{ source: 'helm', reason: 'read_failed' }]
|
|
11
|
+
const issue: Issue = {
|
|
12
|
+
id: 'pod-failed', severity: 'critical' as const, source: 'problem', category: 'workload', category_group: 'workload', grouping_scope: 'resource',
|
|
13
|
+
kind: 'Pod', group: '', namespace: 'db', name: 'pg-1', reason: 'CrashLoopBackOff', message: 'The selected Pod keeps crashing',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function render(props: { issues?: Issue[]; unchecked?: IssuesResponse['unchecked_sources']; visibility?: { impact?: string } }) {
|
|
17
|
+
const issues = props.issues ?? []
|
|
18
|
+
return renderToString(
|
|
19
|
+
<ProblemsPanel
|
|
20
|
+
issues={issues}
|
|
21
|
+
issueCount={issues.length}
|
|
22
|
+
uncheckedLines={uncheckedSourceLines(props.unchecked)}
|
|
23
|
+
onRetryIssues={() => {}}
|
|
24
|
+
visibility={props.visibility}
|
|
25
|
+
hasData
|
|
26
|
+
isLoading={false}
|
|
27
|
+
isRefreshing={false}
|
|
28
|
+
error={null}
|
|
29
|
+
totalReturned={issues.length}
|
|
30
|
+
onNavigateToIssues={() => {}}
|
|
31
|
+
onResourceClick={() => {}}
|
|
32
|
+
/>,
|
|
33
|
+
).replaceAll('<!-- -->', '').replace(/'|'/g, "'")
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe('Home Active Issues when Radar could not read Helm releases', () => {
|
|
37
|
+
it('gives no all-clear when nothing else was found', () => {
|
|
38
|
+
const html = render({ unchecked: helm })
|
|
39
|
+
expect(html).toContain('No issues found')
|
|
40
|
+
expect(html).toContain(line)
|
|
41
|
+
expect(html).not.toContain('No active issues')
|
|
42
|
+
expect(html).not.toContain('status-healthy')
|
|
43
|
+
expect(html).not.toContain('text-green-500')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('keeps the line when limited visibility owns the empty state', () => {
|
|
47
|
+
const html = render({ unchecked: helm, visibility: { impact: 'Pods are not readable.' } })
|
|
48
|
+
expect(html).toContain('No visible active issues')
|
|
49
|
+
expect(html).toContain(line)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('says so above the rows when there are other issues', () => {
|
|
53
|
+
const html = render({ issues: [issue], unchecked: helm })
|
|
54
|
+
expect(html).toContain(line)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('keeps the all-clear when the field is absent', () => {
|
|
58
|
+
const html = render({})
|
|
59
|
+
expect(html).toContain('No active issues')
|
|
60
|
+
expect(html).toContain('status-healthy')
|
|
61
|
+
expect(html).not.toContain('couldn')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('gives no all-clear for a source this version does not know, and says so generically', () => {
|
|
65
|
+
const html = render({ unchecked: [{ source: 'some-new-source', reason: 'read_failed' }] })
|
|
66
|
+
expect(html).toContain('No issues found')
|
|
67
|
+
expect(html).toContain(generic)
|
|
68
|
+
expect(html).not.toContain('some-new-source')
|
|
69
|
+
expect(html).not.toContain('No active issues')
|
|
70
|
+
expect(html).not.toContain('status-healthy')
|
|
71
|
+
expect(html).not.toContain('text-green-500')
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('shows one line per source above the rows, without repeats', () => {
|
|
75
|
+
const html = render({
|
|
76
|
+
issues: [issue],
|
|
77
|
+
unchecked: [...helm, { source: 'a', reason: 'x' }, { source: 'b', reason: 'y' }, ...helm],
|
|
78
|
+
})
|
|
79
|
+
expect(html.split(line).length - 1).toBe(1)
|
|
80
|
+
expect(html.split(generic).length - 1).toBe(1)
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -108,7 +108,7 @@ function useTopologyStats(topology: Topology | null) {
|
|
|
108
108
|
const kindPriority: Record<string, number> = {
|
|
109
109
|
Deployment: 1, Rollout: 1, StatefulSet: 2, DaemonSet: 2,
|
|
110
110
|
Service: 3, Ingress: 4, Gateway: 4,
|
|
111
|
-
HTTPRoute: 4, GRPCRoute: 4, TCPRoute: 4, TLSRoute: 4,
|
|
111
|
+
HTTPRoute: 4, GRPCRoute: 4, TCPRoute: 4, TLSRoute: 4, UDPRoute: 4,
|
|
112
112
|
Pod: 5, PodGroup: 5,
|
|
113
113
|
Job: 6, CronJob: 6, ConfigMap: 7, Secret: 7,
|
|
114
114
|
}
|
|
@@ -125,7 +125,7 @@ const kindDotColors: Record<string, string> = {
|
|
|
125
125
|
Deployment: 'bg-emerald-400', Rollout: 'bg-emerald-400',
|
|
126
126
|
StatefulSet: 'bg-cyan-400', DaemonSet: 'bg-teal-400',
|
|
127
127
|
Service: 'bg-blue-400', Ingress: 'bg-violet-400', Gateway: 'bg-violet-400',
|
|
128
|
-
HTTPRoute: 'bg-purple-400', GRPCRoute: 'bg-purple-400', TCPRoute: 'bg-purple-400', TLSRoute: 'bg-purple-400',
|
|
128
|
+
HTTPRoute: 'bg-purple-400', GRPCRoute: 'bg-purple-400', TCPRoute: 'bg-purple-400', TLSRoute: 'bg-purple-400', UDPRoute: 'bg-purple-400',
|
|
129
129
|
Pod: 'bg-lime-500', PodGroup: 'bg-lime-500',
|
|
130
130
|
Job: 'bg-purple-400', CronJob: 'bg-purple-400',
|
|
131
131
|
ConfigMap: 'bg-amber-400', Secret: 'bg-red-400',
|
|
@@ -373,13 +373,29 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
373
373
|
{
|
|
374
374
|
name: 'manage_node',
|
|
375
375
|
write: true,
|
|
376
|
-
desc: '
|
|
376
|
+
desc: 'Cordon, uncordon, or drain a node. Drain waits for required pod deletions by default and reports complete, incomplete, unconfirmed or started. Expected exclusions do not prevent completion. Completion does not certify shutdown safety.',
|
|
377
377
|
params: [
|
|
378
378
|
{ arg: 'action', required: true, desc: 'cordon, uncordon, or drain' },
|
|
379
379
|
{ arg: 'name', required: true, desc: 'node name' },
|
|
380
380
|
{ arg: 'delete_empty_dir_data', desc: 'evict pods with emptyDir volumes (default true)' },
|
|
381
381
|
{ arg: 'force', desc: 'evict pods not managed by a controller (default false)' },
|
|
382
|
-
{ arg: '
|
|
382
|
+
{ arg: 'wait_for_deletion', desc: 'wait for pod deletion (default true); false returns after eviction acceptance' },
|
|
383
|
+
{ arg: 'timeout', desc: 'shared eviction and deletion deadline in seconds (default 120 when waiting, 60 otherwise)' },
|
|
384
|
+
],
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'wait_for',
|
|
388
|
+
desc: 'Wait after a fix for a rollout, readiness, completion, deletion, or a status condition. Each call waits at most 45s and returns met, waiting, blocked, or failed; call again within your own time limit.',
|
|
389
|
+
params: [
|
|
390
|
+
{ arg: 'kind', required: true, desc: 'resource kind, including CRDs' },
|
|
391
|
+
{ arg: 'name', desc: 'object name; or set label_selector or all' },
|
|
392
|
+
{ arg: 'uid', desc: 'with name: pin to the uid returned by a previous call' },
|
|
393
|
+
{ arg: 'label_selector', desc: "every current match; to wait for replacements, wait on their controller's rollout" },
|
|
394
|
+
{ arg: 'all', desc: 'every object of the kind in the namespace' },
|
|
395
|
+
{ arg: 'namespace', desc: 'namespace for namespaced kinds' },
|
|
396
|
+
{ arg: 'group', desc: 'API group when the kind is ambiguous' },
|
|
397
|
+
{ arg: 'condition', desc: 'rollout, complete, ready, deleted, Type[=Status], or jsonpath={.status.path}=value; defaults by kind' },
|
|
398
|
+
{ arg: 'timeout_seconds', desc: '1-45 seconds (default 45); larger values wait 45' },
|
|
383
399
|
],
|
|
384
400
|
},
|
|
385
401
|
]
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { renderToString } from 'react-dom/server'
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
4
|
+
import type { IssuesResponse, SubjectIssuesResponse } from '../../api/client'
|
|
5
|
+
import { IssuesPane } from './IssuesPane'
|
|
6
|
+
|
|
7
|
+
const state = vi.hoisted(() => ({
|
|
8
|
+
fleet: { data: undefined as IssuesResponse | undefined, isLoading: false, error: null as Error | null, dataUpdatedAt: 0, refetch: vi.fn() },
|
|
9
|
+
subject: { data: undefined as SubjectIssuesResponse | undefined, isLoading: false, error: null as Error | null, dataUpdatedAt: 0, refetch: vi.fn() },
|
|
10
|
+
}))
|
|
11
|
+
vi.mock('../../api/client', () => ({ useIssues: () => state.fleet, useSubjectIssues: () => state.subject }))
|
|
12
|
+
vi.mock('../../api/apiResources', () => ({ useAPIResources: () => ({ data: undefined }), karpenterCapacityAvailable: () => false }))
|
|
13
|
+
vi.mock('../../contexts/CapabilitiesContext', () => ({ useCapabilitiesContext: () => ({}) }))
|
|
14
|
+
vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { state: 'connected' } }) }))
|
|
15
|
+
vi.mock('../diagnose/LocalDiagnoseAction', () => ({ IssueDiagnoseButton: () => null }))
|
|
16
|
+
|
|
17
|
+
const subjectUrl = '/issues?kind=Pod&resource=db%2Fpg-1'
|
|
18
|
+
const issue = {
|
|
19
|
+
id: 'pod-failed', severity: 'critical' as const, source: 'problem', category: 'workload', category_group: 'workload', grouping_scope: 'resource',
|
|
20
|
+
kind: 'Pod', group: '', namespace: 'db', name: 'pg-1', reason: 'CrashLoopBackOff', message: 'The selected Pod keeps crashing',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function render(url = subjectUrl, namespaces: string[] = []) {
|
|
24
|
+
return renderToString(<MemoryRouter initialEntries={[url]}><IssuesPane namespaces={namespaces} onNavigateToResource={() => {}} /></MemoryRouter>).replaceAll('<!-- -->', '')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
state.fleet = { data: undefined, isLoading: false, error: null, dataUpdatedAt: 0, refetch: vi.fn() }
|
|
29
|
+
state.subject = { data: { issues: [issue], coverage: 'ok' }, isLoading: false, error: null, dataUpdatedAt: 0, refetch: vi.fn() }
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('Issues page query ownership', () => {
|
|
33
|
+
it.each(['loading', 'failed'] as const)('renders subject results while the fleet query is %s', (fleetState) => {
|
|
34
|
+
state.fleet.isLoading = fleetState === 'loading'
|
|
35
|
+
state.fleet.error = fleetState === 'failed' ? new Error('Fleet unavailable') : null
|
|
36
|
+
const html = render()
|
|
37
|
+
expect(html).toContain('The selected Pod keeps crashing')
|
|
38
|
+
expect(html).toContain('Showing issues about Pod')
|
|
39
|
+
expect(html).not.toContain('Failed to load issues')
|
|
40
|
+
expect(html).not.toContain('Loading issues…')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('uses the subject visibility rather than stale fleet visibility', () => {
|
|
44
|
+
state.fleet.data = { issues: [], visibility: { impact: 'Fleet-only limitation' } }
|
|
45
|
+
state.subject.data!.visibility = { state: 'limited', impact: 'Subject evidence is incomplete.' }
|
|
46
|
+
const html = render()
|
|
47
|
+
expect(html).toContain('Subject evidence is incomplete.')
|
|
48
|
+
expect(html).not.toContain('Fleet-only limitation')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it.each(['loading', 'failed'] as const)('reports a %s subject lookup independently of fleet failure', (subjectState) => {
|
|
52
|
+
state.fleet.error = new Error('Fleet unavailable')
|
|
53
|
+
state.subject.data = undefined
|
|
54
|
+
state.subject.isLoading = subjectState === 'loading'
|
|
55
|
+
state.subject.error = subjectState === 'failed' ? new Error('Subject unavailable') : null
|
|
56
|
+
const html = render()
|
|
57
|
+
expect(html).toContain(subjectState === 'loading' ? 'Checking issues about Pod' : 'Subject unavailable')
|
|
58
|
+
expect(html).not.toContain('Failed to load issues')
|
|
59
|
+
expect(html).not.toContain('none now')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('explains a hidden subject even when the fleet query fails', () => {
|
|
63
|
+
state.fleet.error = new Error('Fleet unavailable')
|
|
64
|
+
const html = render(subjectUrl, ['other'])
|
|
65
|
+
expect(html).toContain('namespace filter hides')
|
|
66
|
+
expect(html).not.toContain('The selected Pod keeps crashing')
|
|
67
|
+
expect(html).not.toContain('Failed to load issues')
|
|
68
|
+
expect(html).not.toContain('Auto-updating')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it.each(['loading', 'failed'] as const)('retains the fleet %s state on the unfiltered page', (fleetState) => {
|
|
72
|
+
state.fleet.isLoading = fleetState === 'loading'
|
|
73
|
+
state.fleet.error = fleetState === 'failed' ? new Error('Fleet unavailable') : null
|
|
74
|
+
expect(render('/issues')).toContain(fleetState === 'loading' ? 'Loading issues…' : 'Failed to load issues')
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
describe('Issues page when Radar could not read Helm releases', () => {
|
|
79
|
+
const line = "Helm releases couldn't be checked, so failed or stuck releases may be missing."
|
|
80
|
+
const text = (html: string) => html.replace(/'|'/g, "'")
|
|
81
|
+
|
|
82
|
+
it('shows no all-clear when nothing else was found', () => {
|
|
83
|
+
state.fleet.data = { issues: [], total: 0, total_matched: 0, unchecked_sources: [{ source: 'helm', reason: 'read_failed' }] }
|
|
84
|
+
const html = text(render('/issues'))
|
|
85
|
+
expect(html).toContain('No issues found')
|
|
86
|
+
expect(html).toContain(line)
|
|
87
|
+
expect(html).not.toContain('Nothing broken right now')
|
|
88
|
+
expect(html.split(line).length - 1).toBe(1)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it('says so above the rows when there are other issues', () => {
|
|
92
|
+
state.fleet.data = { issues: [issue], total: 1, total_matched: 1, unchecked_sources: [{ source: 'helm', reason: 'read_failed' }] }
|
|
93
|
+
const html = text(render('/issues'))
|
|
94
|
+
expect(html).toContain(line)
|
|
95
|
+
expect(html).toContain('The selected Pod keeps crashing')
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it.each([true, false])('keeps the last unchecked result and retry after a failed refresh (rows: %s)', (hasRows) => {
|
|
99
|
+
state.fleet.data = { issues: hasRows ? [issue] : [], unchecked_sources: [{ source: 'helm', reason: 'read_failed' }] }
|
|
100
|
+
state.fleet.error = new Error('Refresh unavailable')
|
|
101
|
+
const html = text(render('/issues'))
|
|
102
|
+
expect(html).toContain('Issue refresh failed. Showing the last successful result.')
|
|
103
|
+
expect(html).toContain(line)
|
|
104
|
+
expect(html).toContain('Check again')
|
|
105
|
+
expect(html).not.toContain('Failed to load issues')
|
|
106
|
+
expect(html).not.toContain('Nothing broken right now')
|
|
107
|
+
if (hasRows) expect(html).toContain('The selected Pod keeps crashing')
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('does not show an all-clear from a cached empty result after refresh fails', () => {
|
|
111
|
+
state.fleet.data = { issues: [], total: 0 }
|
|
112
|
+
state.fleet.error = new Error('Refresh unavailable')
|
|
113
|
+
const html = text(render('/issues'))
|
|
114
|
+
expect(html).toContain('No issues in the last successful result')
|
|
115
|
+
expect(html).not.toContain('Nothing broken right now')
|
|
116
|
+
expect(html).not.toContain('Failed to load issues')
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it('shows no all-clear for a source this version does not know, with a generic line', () => {
|
|
120
|
+
state.fleet.data = { issues: [], total: 0, total_matched: 0, unchecked_sources: [{ source: 'some-new-source', reason: 'read_failed' }] }
|
|
121
|
+
const html = text(render('/issues'))
|
|
122
|
+
expect(html).toContain('No issues found')
|
|
123
|
+
expect(html).toContain("Some issue checks couldn't run, so issues may be missing.")
|
|
124
|
+
expect(html).not.toContain('some-new-source')
|
|
125
|
+
expect(html).not.toContain('Nothing broken right now')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('keeps the all-clear for a Radar that read Helm or predates the field', () => {
|
|
129
|
+
state.fleet.data = { issues: [], total: 0, total_matched: 0 }
|
|
130
|
+
const html = text(render('/issues'))
|
|
131
|
+
expect(html).toContain('Nothing broken right now')
|
|
132
|
+
expect(html).not.toContain('couldn')
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
describe('Helm notice in subject mode', () => {
|
|
137
|
+
it('is left out: the per-resource lookup never reads Helm storage', () => {
|
|
138
|
+
state.fleet.data = { issues: [], unchecked_sources: [{ source: 'helm', reason: 'read_failed' }] }
|
|
139
|
+
const html = render()
|
|
140
|
+
expect(html).toContain('The selected Pod keeps crashing')
|
|
141
|
+
expect(html).not.toContain('Helm releases couldn')
|
|
142
|
+
})
|
|
143
|
+
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import type { Issue } from "@skyhook-io/k8s-ui";
|
|
3
|
-
import {
|
|
3
|
+
import type { SubjectIssuesResponse } from "../../api/client";
|
|
4
|
+
import { writeViewParams } from "../../utils/navigation";
|
|
5
|
+
import { capacityHrefForIssue, issueSubjectFromParams, issueSubjectKindLabel, issueSubjectState } from "./IssuesPane";
|
|
4
6
|
|
|
5
7
|
function issue(partial: Partial<Issue>): Issue {
|
|
6
8
|
return {
|
|
@@ -140,3 +142,65 @@ describe("capacityHrefForIssue subject carry", () => {
|
|
|
140
142
|
).toBe("/capacity/demand");
|
|
141
143
|
});
|
|
142
144
|
});
|
|
145
|
+
|
|
146
|
+
describe('issue subject links', () => {
|
|
147
|
+
it('reads the subject a link narrows to, with its API group', () => {
|
|
148
|
+
expect(issueSubjectFromParams(new URLSearchParams('kind=Cluster&apiGroup=postgresql.cnpg.io&resource=pg%2Fpg-main'))).toEqual({ kind: 'Cluster', group: 'postgresql.cnpg.io', namespace: 'pg', name: 'pg-main' })
|
|
149
|
+
expect(issueSubjectFromParams(new URLSearchParams('kind=Pod&resource=pg%2Fpg-main-1'))).toEqual({ kind: 'Pod', group: '', namespace: 'pg', name: 'pg-main-1' })
|
|
150
|
+
expect(issueSubjectFromParams(new URLSearchParams('kind=ClusterImageCatalog&apiGroup=postgresql.cnpg.io&resource=pg'))).toEqual({ kind: 'ClusterImageCatalog', group: 'postgresql.cnpg.io', namespace: '', name: 'pg' })
|
|
151
|
+
expect(issueSubjectFromParams(new URLSearchParams('kind=Cluster'))).toBeNull()
|
|
152
|
+
expect(issueSubjectFromParams(new URLSearchParams('kind=Cluster&resource=pg%2F'))).toBeNull()
|
|
153
|
+
})
|
|
154
|
+
it('keeps the API group through App’s URL sync on the Issues view', () => {
|
|
155
|
+
for (const [search, subject] of [
|
|
156
|
+
['kind=Cluster&apiGroup=postgresql.cnpg.io&resource=pg%2Fpg-main', { kind: 'Cluster', group: 'postgresql.cnpg.io', namespace: 'pg', name: 'pg-main' }],
|
|
157
|
+
['kind=Service&apiGroup=serving.knative.dev&resource=web%2Fapi', { kind: 'Service', group: 'serving.knative.dev', namespace: 'web', name: 'api' }],
|
|
158
|
+
] as const) {
|
|
159
|
+
const params = new URLSearchParams(search)
|
|
160
|
+
writeViewParams(params, ['web'], null)
|
|
161
|
+
expect(issueSubjectFromParams(params)).toEqual(subject)
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
it('names the API group when the kind could be another resource', () => {
|
|
165
|
+
expect(issueSubjectKindLabel({ kind: 'Service', group: 'serving.knative.dev', namespace: 'web', name: 'api' })).toBe('Service (serving.knative.dev)')
|
|
166
|
+
expect(issueSubjectKindLabel({ kind: 'Cluster', group: 'postgresql.cnpg.io', namespace: 'pg', name: 'main' })).toBe('Cluster (postgresql.cnpg.io)')
|
|
167
|
+
expect(issueSubjectKindLabel({ kind: 'Service', group: '', namespace: 'web', name: 'api' })).toBe('Service')
|
|
168
|
+
expect(issueSubjectKindLabel({ kind: 'Deployment', group: 'apps', namespace: 'web', name: 'api' })).toBe('Deployment')
|
|
169
|
+
})
|
|
170
|
+
it('never reads the view filter as the subject namespace', () => {
|
|
171
|
+
expect(issueSubjectFromParams(new URLSearchParams('kind=Cluster&namespace=pg&name=pg-main'))).toBeNull()
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
describe('issueSubjectState', () => {
|
|
176
|
+
const subject = { kind: 'Cluster', group: 'postgresql.cnpg.io', namespace: 'pg', name: 'main' }
|
|
177
|
+
const loaded = (data: Partial<SubjectIssuesResponse>) => ({ isLoading: false, error: null, data: { issues: [], coverage: 'ok' as const, ...data } })
|
|
178
|
+
it('says the view filter hides the subject rather than none', () => {
|
|
179
|
+
expect(issueSubjectState(subject, ['app'], loaded({}))).toEqual({ state: 'hidden' })
|
|
180
|
+
expect(issueSubjectState(subject, ['app', 'pg'], loaded({}))).toEqual({ state: 'none' })
|
|
181
|
+
expect(issueSubjectState(subject, [], loaded({}))).toEqual({ state: 'none' })
|
|
182
|
+
expect(issueSubjectState({ ...subject, kind: 'ClusterImageCatalog', namespace: '' }, ['app'], loaded({}))).toEqual({ state: 'none' })
|
|
183
|
+
})
|
|
184
|
+
it('reads an empty answer as unconfirmed when Radar does not read the kind', () => {
|
|
185
|
+
expect(issueSubjectState(subject, [], loaded({ coverage: 'notWatched' }))).toEqual({ state: 'unconfirmed', why: "Radar isn't watching Cluster" })
|
|
186
|
+
expect(issueSubjectState(subject, [], loaded({ coverage: 'syncing' }))).toEqual({ state: 'unconfirmed', why: 'Radar is still loading Cluster' })
|
|
187
|
+
})
|
|
188
|
+
it('says when the cluster has no such kind, as for a link made on another cluster', () => {
|
|
189
|
+
expect(issueSubjectState(subject, [], loaded({ coverage: 'unknownKind' }))).toEqual({ state: 'unconfirmed', why: 'this cluster has no such kind' })
|
|
190
|
+
})
|
|
191
|
+
it('reads an empty answer as unconfirmed when RBAC withheld issues about it', () => {
|
|
192
|
+
expect(issueSubjectState(subject, [], loaded({ withheld: { issues: 2 } }))).toEqual({ state: 'unconfirmed', why: 'your permissions withhold 2 issues about it' })
|
|
193
|
+
})
|
|
194
|
+
it('reads an empty answer under limited visibility as unconfirmed, never none', () => {
|
|
195
|
+
expect(issueSubjectState(subject, [], loaded({ visibility: { state: 'degraded', impact: 'Pods are not readable.' } }))).toEqual({ state: 'unconfirmed', why: "some evidence isn't readable (Pods are not readable)" })
|
|
196
|
+
expect(issueSubjectState(subject, [], loaded({ visibility: { state: 'limited' } }))).toEqual({ state: 'unconfirmed', why: "some evidence isn't readable" })
|
|
197
|
+
})
|
|
198
|
+
it('reports a failed lookup as unconfirmed and a pending one as checking', () => {
|
|
199
|
+
expect(issueSubjectState(subject, [], { isLoading: false, error: new Error('no access to Cluster main'), data: undefined })).toEqual({ state: 'unconfirmed', why: 'no access to Cluster main' })
|
|
200
|
+
expect(issueSubjectState(subject, [], { isLoading: true, error: null, data: undefined })).toEqual({ state: 'checking' })
|
|
201
|
+
})
|
|
202
|
+
it('takes the per-resource answer, which covers members past the inline cap', () => {
|
|
203
|
+
const grouped = issue({ kind: 'Cluster', group: 'postgresql.cnpg.io', namespace: 'pg', name: 'main', members: [], members_truncated: true })
|
|
204
|
+
expect(issueSubjectState(subject, [], loaded({ issues: [grouped], withheld: { issues: 1 } }))).toEqual({ state: 'found', issues: [grouped], withheld: 1 })
|
|
205
|
+
})
|
|
206
|
+
})
|