@skyhook-io/radar-app 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +11 -11
- package/src/App.tsx +138 -116
- package/src/api/actions.errorCode.test.ts +40 -0
- package/src/api/actions.test.ts +48 -0
- package/src/api/actions.ts +79 -0
- package/src/api/apiResources.navigation.test.tsx +232 -0
- package/src/api/apiResources.ts +46 -3
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.helmSource.test.ts +39 -0
- package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
- package/src/api/client.namespaceSwitch.test.ts +107 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +580 -103
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/cnpg-ha.live.test.ts +140 -0
- package/src/api/cnpg-ha.test.ts +78 -0
- package/src/api/cnpg-ha.ts +19 -0
- package/src/api/cnpg-history.ts +123 -0
- package/src/api/cnpg-inspect.ts +102 -0
- package/src/api/cnpg-protection.ts +112 -0
- package/src/api/cnpg-recovery.test.tsx +60 -0
- package/src/api/cnpg-recovery.ts +262 -0
- package/src/api/cnpg-sessions.ts +175 -0
- package/src/api/cnpg-storage.ts +138 -0
- package/src/api/cnpg.legacy-reads.test.ts +43 -0
- package/src/api/cnpg.pooler-runtime.test.ts +15 -0
- package/src/api/cnpg.ts +428 -10
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/radarFeatures.render.test.tsx +47 -3
- package/src/api/radarFeatures.ts +5 -1
- package/src/api/reviewedActionMutation.test.tsx +164 -0
- package/src/api/reviewedActionMutation.ts +66 -0
- package/src/api/timelineSource.test.ts +9 -0
- package/src/api/timelineSource.ts +8 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/audit/AuditView.tsx +9 -0
- package/src/components/capacity/CapacityActivity.tsx +3 -31
- package/src/components/capacity/CapacityDemand.tsx +4 -36
- package/src/components/capacity/CapacityOverview.tsx +217 -56
- package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
- package/src/components/capacity/CapacityView.test.tsx +323 -0
- package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
- package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
- package/src/components/capacity/routes.ts +42 -0
- package/src/components/capacity/shared.tsx +11 -129
- package/src/components/capacity/workspaceRoute.ts +18 -0
- package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
- package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
- package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
- package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
- package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
- package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
- package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
- package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
- package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
- package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
- package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
- package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
- package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
- package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
- package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
- package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
- package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
- package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
- package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
- package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
- package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
- package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
- package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
- package/src/components/cnpg/CNPGOperator.tsx +78 -30
- package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
- package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
- package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
- package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
- package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
- package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
- package/src/components/cnpg/CNPGOverview.tsx +238 -63
- package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
- package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
- package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
- package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
- package/src/components/cnpg/CNPGPerformance.tsx +477 -0
- package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
- package/src/components/cnpg/CNPGPooling.tsx +97 -40
- package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
- package/src/components/cnpg/CNPGProtection.tsx +228 -122
- package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
- package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
- package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
- package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
- package/src/components/cnpg/CNPGStorage.tsx +619 -0
- package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
- package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
- package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
- package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
- package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
- package/src/components/cnpg/CNPGTrends.test.ts +38 -0
- package/src/components/cnpg/CNPGTrends.tsx +702 -0
- package/src/components/cnpg/CNPGView.tsx +34 -21
- package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
- package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
- package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
- package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
- package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
- package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
- package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
- package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
- package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
- package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
- package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
- package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
- package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
- package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
- package/src/components/cnpg/actions/actionModel.test.ts +111 -0
- package/src/components/cnpg/actions/actionModel.ts +127 -0
- package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
- package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
- package/src/components/cnpg/archivingRepair.test.ts +104 -0
- package/src/components/cnpg/archivingRepair.ts +145 -0
- package/src/components/cnpg/baseBackup.test.ts +36 -0
- package/src/components/cnpg/baseBackup.ts +36 -0
- package/src/components/cnpg/blocking.test.ts +59 -0
- package/src/components/cnpg/blocking.ts +131 -0
- package/src/components/cnpg/coverageText.test.ts +27 -0
- package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
- package/src/components/cnpg/creation/targetModel.test.ts +137 -0
- package/src/components/cnpg/creation/targetModel.ts +149 -0
- package/src/components/cnpg/fleetStatus.test.ts +46 -0
- package/src/components/cnpg/fleetStatus.ts +43 -0
- package/src/components/cnpg/formFields.ts +2 -0
- package/src/components/cnpg/grantText.test.tsx +11 -0
- package/src/components/cnpg/host.test.tsx +24 -0
- package/src/components/cnpg/host.tsx +101 -0
- package/src/components/cnpg/inspectModel.test.ts +120 -0
- package/src/components/cnpg/inspectModel.ts +140 -0
- package/src/components/cnpg/logicalSlots.test.ts +30 -0
- package/src/components/cnpg/logicalSlots.ts +29 -0
- package/src/components/cnpg/lsn.test.ts +40 -0
- package/src/components/cnpg/lsn.ts +43 -0
- package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
- package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
- package/src/components/cnpg/operations/model.test.ts +510 -0
- package/src/components/cnpg/operations/model.ts +499 -0
- package/src/components/cnpg/operations/presentation.test.ts +80 -0
- package/src/components/cnpg/operations/presentation.ts +84 -0
- package/src/components/cnpg/operations/store.ts +98 -0
- package/src/components/cnpg/operatorStatus.test.ts +134 -0
- package/src/components/cnpg/operatorStatus.ts +194 -0
- package/src/components/cnpg/paths.test.ts +54 -0
- package/src/components/cnpg/paths.ts +47 -4
- package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
- package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
- package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
- package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
- package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
- package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
- package/src/components/cnpg/protection/scheduleModel.ts +16 -0
- package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
- package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
- package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
- package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
- package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
- package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
- package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
- package/src/components/cnpg/recovery/restoreModel.ts +685 -0
- package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
- package/src/components/cnpg/refresh.test.ts +38 -0
- package/src/components/cnpg/refresh.ts +17 -0
- package/src/components/cnpg/refreshNotice.test.tsx +29 -0
- package/src/components/cnpg/routes.test.ts +34 -3
- package/src/components/cnpg/routes.ts +60 -48
- package/src/components/cnpg/runtimeAssessment.ts +198 -0
- package/src/components/cnpg/runtimeModel.test.ts +175 -0
- package/src/components/cnpg/runtimeModel.ts +196 -0
- package/src/components/cnpg/runtimeParts.test.tsx +17 -0
- package/src/components/cnpg/runtimeParts.tsx +79 -0
- package/src/components/cnpg/shared.test.tsx +59 -0
- package/src/components/cnpg/shared.tsx +100 -182
- package/src/components/cnpg/storageModel.test.ts +107 -0
- package/src/components/cnpg/storageModel.ts +101 -0
- package/src/components/cnpg/trendSamples.test.ts +148 -0
- package/src/components/cnpg/trendSamples.ts +222 -0
- package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
- package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
- package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
- package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
- package/src/components/cnpg/useCNPGNavigate.ts +21 -0
- package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
- package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
- package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
- package/src/components/cnpg/workspaceRoute.ts +23 -0
- package/src/components/cost/ApplicationCostTab.test.ts +7 -0
- package/src/components/cost/ApplicationCostTab.tsx +7 -7
- package/src/components/cost/CostView.test.ts +2 -1
- package/src/components/cost/CostView.tsx +0 -2
- package/src/components/cost/WorkloadCostTab.tsx +2 -4
- package/src/components/cost/errors.ts +3 -1
- package/src/components/cost/source.test.ts +10 -0
- package/src/components/cost/source.ts +5 -1
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/types.ts +11 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/dock/BottomDock.tsx +8 -3
- package/src/components/dock/TerminalTab.test.tsx +17 -0
- package/src/components/dock/TerminalTab.tsx +7 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +23 -8
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
- package/src/components/gitops/GitOpsView.tsx +23 -23
- package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
- package/src/components/helm/HelmCompareRoute.tsx +57 -26
- package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
- package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
- package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
- package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/helm/ValuesViewer.test.tsx +301 -0
- package/src/components/helm/ValuesViewer.tsx +169 -78
- package/src/components/home/ActivitySummary.tsx +2 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +32 -12
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +82 -0
- package/src/components/home/TopologyPreview.tsx +2 -2
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +143 -0
- package/src/components/issues/IssuesPane.test.ts +65 -1
- package/src/components/issues/IssuesPane.tsx +213 -26
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +74 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
- package/src/components/resource/PVCUsageBar.test.tsx +24 -0
- package/src/components/resource/PVCUsageBar.tsx +15 -6
- package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
- package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
- package/src/components/resources/CompositeRenderer.tsx +4 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +44 -15
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
- package/src/components/settings/SettingsDialog.tsx +49 -30
- package/src/components/timeline/TimelineList.tsx +22 -24
- package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
- package/src/components/timeline/TimelineLoadError.tsx +96 -0
- package/src/components/timeline/TimelineView.tsx +18 -45
- package/src/components/timeline/ViewModeToggle.tsx +20 -0
- package/src/components/timeline/useStickyError.test.tsx +47 -0
- package/src/components/timeline/useStickyError.ts +15 -0
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficView.tsx +12 -12
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
- package/src/components/ui/Markdown.test.tsx +65 -0
- package/src/components/ui/Markdown.tsx +144 -127
- package/src/components/ui/Omnibar.tsx +13 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/omnibar-match.test.ts +30 -0
- package/src/components/ui/omnibar-match.ts +18 -0
- package/src/components/whats-new/releaseNotes.ts +63 -1
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +63 -243
- package/src/components/workspace/layout.test.tsx +29 -0
- package/src/components/workspace/layout.tsx +259 -0
- package/src/components/workspace/table.ts +7 -0
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/contexts/CapabilitiesContext.tsx +1 -1
- package/src/integrations/resourceHost.test.tsx +55 -0
- package/src/integrations/resourceHost.ts +99 -0
- package/src/integrations/resourceHosts.test.tsx +142 -0
- package/src/integrations/resourceHosts.tsx +121 -0
- package/src/integrations/workspaceRoute.ts +20 -0
- package/src/integrations/workspaceRoutes.test.ts +40 -0
- package/src/integrations/workspaceRoutes.ts +22 -0
- package/src/integrations/workspaceScreens.tsx +14 -0
- package/src/utils/drawer-trail.ts +35 -0
- package/src/utils/kindFilterStore.test.ts +147 -0
- package/src/utils/kindFilterStore.ts +91 -0
- package/src/utils/navigation.test.ts +13 -1
- package/src/utils/navigation.ts +53 -2
- package/src/utils/page-links.ts +21 -0
- package/src/utils/tabStorage.ts +40 -0
- package/src/utils/viewMemory.test.ts +78 -0
- package/src/utils/viewMemory.ts +54 -0
- package/src/utils/wails-clipboard.ts +4 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { clsx } from 'clsx'
|
|
2
|
+
import { AlertTriangle, Bug, RefreshCw } from 'lucide-react'
|
|
3
|
+
import { timelineDatabaseError } from '../../api/client'
|
|
4
|
+
import { SEVERITY_TEXT } from '@skyhook-io/k8s-ui'
|
|
5
|
+
|
|
6
|
+
const SECONDARY_BUTTON =
|
|
7
|
+
'flex items-center gap-2 px-3 py-1.5 text-sm bg-theme-elevated border border-theme-border-light rounded-lg hover:bg-theme-hover transition-colors'
|
|
8
|
+
|
|
9
|
+
// TimelineLoadError is the full-screen state when the timeline has nothing to
|
|
10
|
+
// show. An unreachable PostgreSQL database gets its own copy: it says the
|
|
11
|
+
// database is the problem and where to look. The driver's error stays in
|
|
12
|
+
// Radar's logs and the diagnostics overlay.
|
|
13
|
+
export function TimelineLoadError({
|
|
14
|
+
error,
|
|
15
|
+
onRetry,
|
|
16
|
+
retrying = false,
|
|
17
|
+
onOpenDiagnostics,
|
|
18
|
+
className,
|
|
19
|
+
}: {
|
|
20
|
+
error?: Error | null
|
|
21
|
+
onRetry: () => void
|
|
22
|
+
/** A request is in flight: the error stays up, the button shows the attempt. */
|
|
23
|
+
retrying?: boolean
|
|
24
|
+
onOpenDiagnostics?: () => void
|
|
25
|
+
className?: string
|
|
26
|
+
}) {
|
|
27
|
+
const databaseError = timelineDatabaseError(error)
|
|
28
|
+
const detail = error?.message?.trim()
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className={clsx('flex flex-col items-center justify-center text-theme-text-tertiary gap-3 px-6', className)}>
|
|
32
|
+
<AlertTriangle className="w-10 h-10 text-amber-400/70" />
|
|
33
|
+
{databaseError !== null ? (
|
|
34
|
+
<>
|
|
35
|
+
<p className="text-base text-theme-text-secondary">Timeline history is unavailable</p>
|
|
36
|
+
<p className="max-w-md text-center text-sm">
|
|
37
|
+
Radar can't connect to its PostgreSQL database, so changes aren't being recorded. It keeps
|
|
38
|
+
retrying, and this page recovers on its own once the database is back.
|
|
39
|
+
</p>
|
|
40
|
+
<p className="max-w-md text-center text-xs">
|
|
41
|
+
Radar's logs have the details: search them for <code className="font-mono">[timeline]</code>.
|
|
42
|
+
</p>
|
|
43
|
+
</>
|
|
44
|
+
) : (
|
|
45
|
+
<>
|
|
46
|
+
<p className="text-base">Failed to load timeline data</p>
|
|
47
|
+
{detail && <p className="max-w-md text-center text-sm">{detail}</p>}
|
|
48
|
+
</>
|
|
49
|
+
)}
|
|
50
|
+
<div className="flex items-center gap-2">
|
|
51
|
+
<button type="button" onClick={onRetry} disabled={retrying} className={clsx(SECONDARY_BUTTON, 'disabled:opacity-60 disabled:cursor-default')}>
|
|
52
|
+
<RefreshCw className={clsx('w-3.5 h-3.5', retrying && 'animate-spin')} />
|
|
53
|
+
Try again
|
|
54
|
+
</button>
|
|
55
|
+
{databaseError !== null && onOpenDiagnostics && (
|
|
56
|
+
<button type="button" onClick={onOpenDiagnostics} className={SECONDARY_BUTTON}>
|
|
57
|
+
<Bug className="w-3.5 h-3.5" />
|
|
58
|
+
Open diagnostics
|
|
59
|
+
</button>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// TimelineStaleNote is the banner over data that is still on screen while its
|
|
67
|
+
// refresh fails. When the database is the cause it says so and where to look,
|
|
68
|
+
// since the data underneath otherwise reads as current.
|
|
69
|
+
export function TimelineStaleNote({
|
|
70
|
+
error,
|
|
71
|
+
subject,
|
|
72
|
+
onRetry,
|
|
73
|
+
}: {
|
|
74
|
+
error?: Error | null
|
|
75
|
+
/** What may be stale: the swimlane view or the list. */
|
|
76
|
+
subject: 'timeline' | 'list'
|
|
77
|
+
onRetry: () => void
|
|
78
|
+
}) {
|
|
79
|
+
const databaseDown = timelineDatabaseError(error) !== null
|
|
80
|
+
return (
|
|
81
|
+
<div className="flex items-center gap-1.5 border-b border-theme-border px-4 py-1.5 text-xs text-theme-text-tertiary">
|
|
82
|
+
<AlertTriangle className={`h-3.5 w-3.5 shrink-0 ${SEVERITY_TEXT.warning}`} />
|
|
83
|
+
{databaseDown ? (
|
|
84
|
+
<span>
|
|
85
|
+
Radar can't connect to its PostgreSQL database, so the {subject} may be stale. Search Radar's logs
|
|
86
|
+
for <code className="font-mono">[timeline]</code>.
|
|
87
|
+
</span>
|
|
88
|
+
) : (
|
|
89
|
+
<span>Live updates are failing, so the {subject} may be stale.</span>
|
|
90
|
+
)}
|
|
91
|
+
<button type="button" onClick={onRetry} className="underline hover:text-theme-text-primary">
|
|
92
|
+
Retry now
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useMemo, useRef, useCallback, useEffect } from 'react'
|
|
2
2
|
import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
3
3
|
import type { ReactNode } from 'react'
|
|
4
|
-
import { Network, AlertTriangle,
|
|
4
|
+
import { Network, AlertTriangle, Boxes, X } from 'lucide-react'
|
|
5
5
|
import {
|
|
6
6
|
clampLensToSelection,
|
|
7
7
|
deriveLiveSelection,
|
|
@@ -21,6 +21,9 @@ import {
|
|
|
21
21
|
useDebouncedValue,
|
|
22
22
|
} from '@skyhook-io/k8s-ui'
|
|
23
23
|
import { TimelineList } from './TimelineList'
|
|
24
|
+
import { TimelineLoadError, TimelineStaleNote } from './TimelineLoadError'
|
|
25
|
+
import { ViewModeToggle } from './ViewModeToggle'
|
|
26
|
+
import { useStickyError } from './useStickyError'
|
|
24
27
|
import type { ActivityFilterKey } from './TimelineList'
|
|
25
28
|
import { TimelineSwimlanes } from './TimelineSwimlanes'
|
|
26
29
|
import { RetainedTimelineScrubber, extendSelection, type ScrubberDomainInfo } from './RetainedTimelineScrubber'
|
|
@@ -275,6 +278,7 @@ interface TimelineViewProps {
|
|
|
275
278
|
requiresNamespaceFilter?: boolean
|
|
276
279
|
availableNamespaces?: { name: string }[]
|
|
277
280
|
onNamespaceSelect?: (ns: string) => void
|
|
281
|
+
onOpenDiagnostics?: () => void
|
|
278
282
|
}
|
|
279
283
|
|
|
280
284
|
export function resolveApplicationTimelineScope(searchParams: URLSearchParams, namespaces: string[]) {
|
|
@@ -293,7 +297,7 @@ export function resolveApplicationTimelineScope(searchParams: URLSearchParams, n
|
|
|
293
297
|
}
|
|
294
298
|
}
|
|
295
299
|
|
|
296
|
-
export function TimelineView({ namespaces, onResourceClick, initialViewMode, initialFilter, initialTimeRange, requiresNamespaceFilter, availableNamespaces, onNamespaceSelect }: TimelineViewProps) {
|
|
300
|
+
export function TimelineView({ namespaces, onResourceClick, initialViewMode, initialFilter, initialTimeRange, requiresNamespaceFilter, availableNamespaces, onNamespaceSelect, onOpenDiagnostics }: TimelineViewProps) {
|
|
297
301
|
// URL is the source of truth for every control below (deep-linkable +
|
|
298
302
|
// back/forward-restorable). Read on mount, written on user change.
|
|
299
303
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
@@ -683,7 +687,7 @@ export function TimelineView({ namespaces, onResourceClick, initialViewMode, ini
|
|
|
683
687
|
// Fetch all activity - zoom controls what's visible in the UI. This ring feeds
|
|
684
688
|
// the swimlanes and the local strip's histogram, so it also runs in list mode
|
|
685
689
|
// when that strip is shown; the list itself fetches its own 2000.
|
|
686
|
-
const { data: activity, isLoading, isError, error, refetch, truncated: ringTruncated } = timelineSource.useEvents({
|
|
690
|
+
const { data: activity, isLoading, isFetching, isError, error, refetch, truncated: ringTruncated } = timelineSource.useEvents({
|
|
687
691
|
namespaces: timelineNamespaces,
|
|
688
692
|
timeRange: 'all',
|
|
689
693
|
includeK8sEvents: true,
|
|
@@ -701,6 +705,7 @@ export function TimelineView({ namespaces, onResourceClick, initialViewMode, ini
|
|
|
701
705
|
fromMs: isRetained ? selection.fromMs : undefined,
|
|
702
706
|
toMs: isRetained ? selection.toMs : undefined,
|
|
703
707
|
})
|
|
708
|
+
const loadError = useStickyError(error, activity != null)
|
|
704
709
|
|
|
705
710
|
// Topology powers both swimlane hierarchy and application-scoped attribution.
|
|
706
711
|
const { data: rawTopology } = useTopology(timelineNamespaces, 'resources', {
|
|
@@ -869,13 +874,7 @@ export function TimelineView({ namespaces, onResourceClick, initialViewMode, ini
|
|
|
869
874
|
{/* Failing background polls with a loaded ring: keep the data, say
|
|
870
875
|
it's going stale. The full-screen error is reserved for no-data. */}
|
|
871
876
|
{isError && activity && (
|
|
872
|
-
<
|
|
873
|
-
<AlertTriangle className={`h-3.5 w-3.5 shrink-0 ${SEVERITY_TEXT.warning}`} />
|
|
874
|
-
Live updates are failing — the timeline may be stale.
|
|
875
|
-
<button type="button" onClick={() => refetch()} className="underline hover:text-theme-text-primary">
|
|
876
|
-
Retry now
|
|
877
|
-
</button>
|
|
878
|
-
</div>
|
|
877
|
+
<TimelineStaleNote error={error} subject="timeline" onRetry={() => refetch()} />
|
|
879
878
|
)}
|
|
880
879
|
{isRetained ? (
|
|
881
880
|
<RetainedTimelineScrubber
|
|
@@ -967,29 +966,23 @@ export function TimelineView({ namespaces, onResourceClick, initialViewMode, ini
|
|
|
967
966
|
// a load failure. With a loaded ring on screen, a failing background poll
|
|
968
967
|
// must NOT blank it (gate on data before error); the stale-data banner
|
|
969
968
|
// below carries the warning instead.
|
|
970
|
-
if (
|
|
969
|
+
if (loadError && !activity) {
|
|
971
970
|
// Surface the server's own message — a generic "failed to load" would
|
|
972
971
|
// swallow whatever the hub said. "Try again" is a full resync: the
|
|
973
972
|
// retained source drops its delta cursor and reloads the whole ring.
|
|
974
|
-
const detail = error?.message?.trim()
|
|
975
973
|
return wrap(
|
|
976
974
|
<div className="flex-1 flex flex-col">
|
|
977
975
|
<div className="flex items-center justify-between px-4 py-2 border-b border-theme-border">
|
|
978
976
|
<div />
|
|
979
977
|
<ViewModeToggle viewMode={viewMode} onViewModeChange={setViewMode} />
|
|
980
978
|
</div>
|
|
981
|
-
<
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
>
|
|
989
|
-
<RefreshCw className="w-3.5 h-3.5" />
|
|
990
|
-
Try again
|
|
991
|
-
</button>
|
|
992
|
-
</div>
|
|
979
|
+
<TimelineLoadError
|
|
980
|
+
className="flex-1"
|
|
981
|
+
error={loadError}
|
|
982
|
+
retrying={isFetching}
|
|
983
|
+
onRetry={() => refetch()}
|
|
984
|
+
onOpenDiagnostics={onOpenDiagnostics}
|
|
985
|
+
/>
|
|
993
986
|
</div>
|
|
994
987
|
)
|
|
995
988
|
}
|
|
@@ -1064,27 +1057,7 @@ export function TimelineView({ namespaces, onResourceClick, initialViewMode, ini
|
|
|
1064
1057
|
appScoped={Boolean(focusedAppKey)}
|
|
1065
1058
|
topology={stableTopology}
|
|
1066
1059
|
appScopeLoading={focusedAppLoading}
|
|
1060
|
+
onOpenDiagnostics={onOpenDiagnostics}
|
|
1067
1061
|
/>
|
|
1068
1062
|
)
|
|
1069
1063
|
}
|
|
1070
|
-
|
|
1071
|
-
function ViewModeToggle({ viewMode, onViewModeChange }: { viewMode: TimelineViewMode, onViewModeChange: (mode: TimelineViewMode) => void }) {
|
|
1072
|
-
return (
|
|
1073
|
-
<div className="flex items-center gap-1 bg-theme-base rounded-lg p-0.5 border border-theme-border">
|
|
1074
|
-
<button
|
|
1075
|
-
type="button"
|
|
1076
|
-
onClick={() => onViewModeChange('list')}
|
|
1077
|
-
className={`px-2 py-1 text-xs rounded-md transition-colors ${viewMode === 'list' ? 'bg-theme-surface text-theme-text-primary shadow-sm' : 'text-theme-text-secondary hover:text-theme-text-primary'}`}
|
|
1078
|
-
>
|
|
1079
|
-
List
|
|
1080
|
-
</button>
|
|
1081
|
-
<button
|
|
1082
|
-
type="button"
|
|
1083
|
-
onClick={() => onViewModeChange('swimlane')}
|
|
1084
|
-
className={`px-2 py-1 text-xs rounded-md transition-colors ${viewMode === 'swimlane' ? 'bg-theme-surface text-theme-text-primary shadow-sm' : 'text-theme-text-secondary hover:text-theme-text-primary'}`}
|
|
1085
|
-
>
|
|
1086
|
-
Swimlane
|
|
1087
|
-
</button>
|
|
1088
|
-
</div>
|
|
1089
|
-
)
|
|
1090
|
-
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function ViewModeToggle({ viewMode, onViewModeChange }: { viewMode: 'list' | 'swimlane', onViewModeChange: (mode: 'list' | 'swimlane') => void }) {
|
|
2
|
+
return (
|
|
3
|
+
<div className="flex items-center gap-1 bg-theme-base rounded-lg p-0.5 border border-theme-border">
|
|
4
|
+
<button
|
|
5
|
+
type="button"
|
|
6
|
+
onClick={() => onViewModeChange('list')}
|
|
7
|
+
className={`px-2 py-1 text-xs rounded-md transition-colors ${viewMode === 'list' ? 'bg-theme-surface text-theme-text-primary shadow-sm' : 'text-theme-text-secondary hover:text-theme-text-primary'}`}
|
|
8
|
+
>
|
|
9
|
+
List
|
|
10
|
+
</button>
|
|
11
|
+
<button
|
|
12
|
+
type="button"
|
|
13
|
+
onClick={() => onViewModeChange('swimlane')}
|
|
14
|
+
className={`px-2 py-1 text-xs rounded-md transition-colors ${viewMode === 'swimlane' ? 'bg-theme-surface text-theme-text-primary shadow-sm' : 'text-theme-text-secondary hover:text-theme-text-primary'}`}
|
|
15
|
+
>
|
|
16
|
+
Swimlane
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
5
|
+
import { useStickyError } from './useStickyError'
|
|
6
|
+
|
|
7
|
+
const seen: (Error | null)[] = []
|
|
8
|
+
function Harness({ error, hasData }: { error: Error | null; hasData: boolean }) {
|
|
9
|
+
seen.push(useStickyError(error, hasData))
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let root: Root
|
|
14
|
+
let container: HTMLDivElement
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
seen.length = 0
|
|
17
|
+
container = document.createElement('div')
|
|
18
|
+
root = createRoot(container)
|
|
19
|
+
})
|
|
20
|
+
afterEach(() => act(() => root.unmount()))
|
|
21
|
+
const render = (error: Error | null, hasData: boolean) => act(() => root.render(<Harness error={error} hasData={hasData} />))
|
|
22
|
+
const last = () => seen[seen.length - 1]
|
|
23
|
+
|
|
24
|
+
describe('useStickyError', () => {
|
|
25
|
+
it('keeps the error while a refetch with no data clears it', () => {
|
|
26
|
+
const down = new Error('database down')
|
|
27
|
+
render(down, false)
|
|
28
|
+
expect(last()).toBe(down)
|
|
29
|
+
render(null, false)
|
|
30
|
+
expect(last()).toBe(down)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('drops the error once data arrives', () => {
|
|
34
|
+
render(new Error('database down'), false)
|
|
35
|
+
render(null, true)
|
|
36
|
+
expect(last()).toBeNull()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// A page with data on screen whose poll starts failing: the hook must settle,
|
|
40
|
+
// not bounce between the error and null until React gives up.
|
|
41
|
+
it('settles when an error arrives while data is on screen', () => {
|
|
42
|
+
render(null, true)
|
|
43
|
+
render(new Error('database down'), true)
|
|
44
|
+
expect(last()).toBeNull()
|
|
45
|
+
expect(seen.length).toBeLessThan(10)
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
// React Query clears the error of a query that has never loaded each time it
|
|
4
|
+
// refetches, so a failure that persists across polls would flicker to a loader
|
|
5
|
+
// on every interval. This keeps the last error on screen until data arrives.
|
|
6
|
+
// Once data is loaded it returns null: a failing poll then belongs to the
|
|
7
|
+
// stale-data banner, not the full-screen error.
|
|
8
|
+
export function useStickyError(error: Error | null | undefined, hasData: boolean): Error | null {
|
|
9
|
+
const [shown, setShown] = useState<Error | null>(null)
|
|
10
|
+
const next = hasData ? null : (error ?? shown)
|
|
11
|
+
// Adjusting state during render: converges in one extra pass because `next`
|
|
12
|
+
// is a fixed point once stored.
|
|
13
|
+
if (next !== shown) setShown(next)
|
|
14
|
+
return next
|
|
15
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, type ComponentProps } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
+
import { TrafficFilterSidebar } from './TrafficFilterSidebar'
|
|
6
|
+
|
|
7
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
8
|
+
|
|
9
|
+
type Props = ComponentProps<typeof TrafficFilterSidebar>
|
|
10
|
+
|
|
11
|
+
const props = (overrides: Partial<Props>): Props => ({
|
|
12
|
+
hideSystem: true, setHideSystem: vi.fn(),
|
|
13
|
+
hideExternal: false, setHideExternal: vi.fn(),
|
|
14
|
+
minConnections: 0, setMinConnections: vi.fn(),
|
|
15
|
+
showNamespaceGroups: true, setShowNamespaceGroups: vi.fn(),
|
|
16
|
+
collapseInternet: true, setCollapseInternet: vi.fn(),
|
|
17
|
+
groupByWorkload: true, setGroupByWorkload: vi.fn(),
|
|
18
|
+
addonMode: 'show', setAddonMode: vi.fn(),
|
|
19
|
+
aggregateExternal: true, setAggregateExternal: vi.fn(),
|
|
20
|
+
detectServices: true, setDetectServices: vi.fn(),
|
|
21
|
+
timeRange: '5m', setTimeRange: vi.fn(),
|
|
22
|
+
l7Protocol: 'all', setL7Protocol: vi.fn(),
|
|
23
|
+
l7Methods: new Set(), onToggleL7Method: vi.fn(),
|
|
24
|
+
l7StatusRanges: new Set(), onToggleL7StatusRange: vi.fn(),
|
|
25
|
+
verdicts: new Set(), onToggleVerdict: vi.fn(),
|
|
26
|
+
dnsPattern: '', setDnsPattern: vi.fn(),
|
|
27
|
+
namespaces: [{ name: 'demo', nodeCount: 3 }],
|
|
28
|
+
hiddenNamespaces: new Set(), onToggleNamespace: vi.fn(),
|
|
29
|
+
...overrides,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
let container: HTMLDivElement
|
|
33
|
+
let root: Root
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
container = document.createElement('div')
|
|
37
|
+
document.body.appendChild(container)
|
|
38
|
+
root = createRoot(container)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
act(() => root.unmount())
|
|
43
|
+
container.remove()
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const button = (label: string) =>
|
|
47
|
+
Array.from(container.querySelectorAll('button')).find((b) => b.textContent === label)
|
|
48
|
+
|
|
49
|
+
describe('TrafficFilterSidebar verdict filter', () => {
|
|
50
|
+
it('offers the verdicts on L4-only traffic, where there is no L7 section', () => {
|
|
51
|
+
const onToggleVerdict = vi.fn()
|
|
52
|
+
act(() => root.render(
|
|
53
|
+
<TrafficFilterSidebar {...props({ showL7Filters: false, availableVerdicts: ['forwarded', 'dropped'], onToggleVerdict })} />,
|
|
54
|
+
))
|
|
55
|
+
|
|
56
|
+
expect(container.textContent).not.toContain('L7 Filters')
|
|
57
|
+
expect(button('forwarded')).toBeDefined()
|
|
58
|
+
expect(button('error')).toBeUndefined()
|
|
59
|
+
|
|
60
|
+
act(() => button('dropped')!.click())
|
|
61
|
+
expect(onToggleVerdict).toHaveBeenCalledWith('dropped')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('marks the selected verdict as pressed', () => {
|
|
65
|
+
act(() => root.render(
|
|
66
|
+
<TrafficFilterSidebar {...props({ availableVerdicts: ['forwarded', 'dropped'], verdicts: new Set(['dropped']) })} />,
|
|
67
|
+
))
|
|
68
|
+
expect(button('dropped')!.getAttribute('aria-pressed')).toBe('true')
|
|
69
|
+
expect(button('forwarded')!.getAttribute('aria-pressed')).toBe('false')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('shows no verdict control when there are no verdict choices', () => {
|
|
73
|
+
act(() => root.render(<TrafficFilterSidebar {...props({ showL7Filters: true, availableVerdicts: [] })} />))
|
|
74
|
+
expect(container.textContent).toContain('L7 Filters')
|
|
75
|
+
expect(container.textContent).not.toContain('Verdict')
|
|
76
|
+
})
|
|
77
|
+
})
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Info,
|
|
12
12
|
Puzzle,
|
|
13
13
|
Boxes,
|
|
14
|
+
ShieldAlert,
|
|
14
15
|
} from 'lucide-react'
|
|
15
16
|
import { clsx } from 'clsx'
|
|
16
17
|
import { SEVERITY_BADGE } from '@skyhook-io/k8s-ui/utils/badge-colors'
|
|
@@ -57,7 +58,7 @@ interface TrafficFilterSidebarProps {
|
|
|
57
58
|
timeRange: string
|
|
58
59
|
setTimeRange: (v: string) => void
|
|
59
60
|
|
|
60
|
-
// L7 filters
|
|
61
|
+
// L7 filters
|
|
61
62
|
/** Whether the flows carry any L7 detail at all. Not "is this Hubble": Beyla and
|
|
62
63
|
* Istio report L7 too, and gating on the source name hid these filters from them. */
|
|
63
64
|
showL7Filters?: boolean
|
|
@@ -77,8 +78,8 @@ interface TrafficFilterSidebarProps {
|
|
|
77
78
|
onToggleL7Method: (method: string) => void
|
|
78
79
|
l7StatusRanges: Set<string>
|
|
79
80
|
onToggleL7StatusRange: (range: string) => void
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
verdicts: Set<string>
|
|
82
|
+
onToggleVerdict: (verdict: string) => void
|
|
82
83
|
dnsPattern: string
|
|
83
84
|
setDnsPattern: (v: string) => void
|
|
84
85
|
|
|
@@ -178,8 +179,8 @@ export const TrafficFilterSidebar = memo(function TrafficFilterSidebar({
|
|
|
178
179
|
onToggleL7Method,
|
|
179
180
|
l7StatusRanges,
|
|
180
181
|
onToggleL7StatusRange,
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
verdicts,
|
|
183
|
+
onToggleVerdict,
|
|
183
184
|
dnsPattern,
|
|
184
185
|
setDnsPattern,
|
|
185
186
|
namespaces,
|
|
@@ -284,6 +285,42 @@ export const TrafficFilterSidebar = memo(function TrafficFilterSidebar({
|
|
|
284
285
|
))}
|
|
285
286
|
</div>
|
|
286
287
|
</div>
|
|
288
|
+
|
|
289
|
+
{/* Verdict. Shown whenever the flows say something other than forwarded,
|
|
290
|
+
whether or not they carry L7 detail: Hubble reports drops on plain
|
|
291
|
+
L4 flows. */}
|
|
292
|
+
{availableVerdicts.length > 0 && (
|
|
293
|
+
<div className="mt-2 pt-2 border-t border-theme-border/50">
|
|
294
|
+
<div className="flex items-center gap-2 mb-1.5">
|
|
295
|
+
<ShieldAlert className="w-3.5 h-3.5 text-theme-text-tertiary" />
|
|
296
|
+
<span className="text-xs text-theme-text-primary">Verdict</span>
|
|
297
|
+
<Tooltip content="What happened to the traffic, as the traffic source reports it. Pick one or more to show only those flows." position="right">
|
|
298
|
+
<Info className="w-3 h-3 text-theme-text-tertiary hover:text-theme-text-secondary cursor-help" />
|
|
299
|
+
</Tooltip>
|
|
300
|
+
</div>
|
|
301
|
+
<div className="flex flex-wrap gap-1">
|
|
302
|
+
{([
|
|
303
|
+
{ label: 'forwarded', active: SEVERITY_BADGE.success },
|
|
304
|
+
{ label: 'dropped', active: SEVERITY_BADGE.error },
|
|
305
|
+
{ label: 'error', active: SEVERITY_BADGE.warning },
|
|
306
|
+
] as const).filter(({ label }) => availableVerdicts.includes(label)).map(({ label, active }) => (
|
|
307
|
+
<button
|
|
308
|
+
key={label}
|
|
309
|
+
onClick={() => onToggleVerdict(label)}
|
|
310
|
+
aria-pressed={verdicts.has(label)}
|
|
311
|
+
className={clsx(
|
|
312
|
+
'px-1.5 py-0.5 rounded text-[10px] font-medium capitalize transition-colors',
|
|
313
|
+
verdicts.has(label)
|
|
314
|
+
? active
|
|
315
|
+
: 'bg-theme-elevated text-theme-text-tertiary hover:text-theme-text-secondary'
|
|
316
|
+
)}
|
|
317
|
+
>
|
|
318
|
+
{label}
|
|
319
|
+
</button>
|
|
320
|
+
))}
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
)}
|
|
287
324
|
</div>
|
|
288
325
|
|
|
289
326
|
{/* Display */}
|
|
@@ -439,32 +476,6 @@ export const TrafficFilterSidebar = memo(function TrafficFilterSidebar({
|
|
|
439
476
|
</div>
|
|
440
477
|
)}
|
|
441
478
|
|
|
442
|
-
{/* Verdict, limited to the verdicts the data actually contains. */}
|
|
443
|
-
{availableVerdicts.length > 0 && (
|
|
444
|
-
<div>
|
|
445
|
-
<div className="text-[10px] text-theme-text-tertiary mb-1">Verdict</div>
|
|
446
|
-
<div className="flex flex-wrap gap-1">
|
|
447
|
-
{([
|
|
448
|
-
{ label: 'forwarded', active: SEVERITY_BADGE.success },
|
|
449
|
-
{ label: 'dropped', active: SEVERITY_BADGE.error },
|
|
450
|
-
{ label: 'error', active: SEVERITY_BADGE.warning },
|
|
451
|
-
] as const).filter(({ label }) => availableVerdicts.includes(label)).map(({ label, active }) => (
|
|
452
|
-
<button
|
|
453
|
-
key={label}
|
|
454
|
-
onClick={() => onToggleL7Verdict(label)}
|
|
455
|
-
className={clsx(
|
|
456
|
-
'px-1.5 py-0.5 rounded text-[10px] font-medium capitalize transition-colors',
|
|
457
|
-
l7Verdicts.has(label)
|
|
458
|
-
? active
|
|
459
|
-
: 'bg-theme-elevated text-theme-text-tertiary hover:text-theme-text-secondary'
|
|
460
|
-
)}
|
|
461
|
-
>
|
|
462
|
-
{label}
|
|
463
|
-
</button>
|
|
464
|
-
))}
|
|
465
|
-
</div>
|
|
466
|
-
</div>
|
|
467
|
-
)}
|
|
468
479
|
</div>
|
|
469
480
|
)}
|
|
470
481
|
|
|
@@ -17,7 +17,7 @@ import { AlertBanner, EmptyState, PaneLoader, FreshnessControl } from '@skyhook-
|
|
|
17
17
|
import { useConnection } from '../../context/ConnectionContext'
|
|
18
18
|
import { Tooltip } from '../ui/Tooltip'
|
|
19
19
|
import { SEVERITY_TEXT } from '@skyhook-io/k8s-ui/utils/badge-colors'
|
|
20
|
-
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergedEdgePort, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, type TrafficFocus } from './trafficFilters'
|
|
20
|
+
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergedEdgePort, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus } from './trafficFilters'
|
|
21
21
|
|
|
22
22
|
// Consecutive 2s retries of an empty result that came with a transient warning.
|
|
23
23
|
const MAX_EMPTY_RETRIES = 5
|
|
@@ -449,7 +449,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
449
449
|
const [l7Protocol, setL7Protocol] = useState<string>('all')
|
|
450
450
|
const [l7Methods, setL7Methods] = useState<Set<string>>(new Set())
|
|
451
451
|
const [l7StatusRanges, setL7StatusRanges] = useState<Set<string>>(new Set())
|
|
452
|
-
const [
|
|
452
|
+
const [verdicts, setVerdicts] = useState<Set<string>>(new Set())
|
|
453
453
|
const [dnsPattern, setDnsPattern] = useState('')
|
|
454
454
|
const [isConnecting, setIsConnecting] = useState(false)
|
|
455
455
|
const [connectionError, setConnectionError] = useState<string | null>(null)
|
|
@@ -576,7 +576,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
576
576
|
// all, so offering 2xx or a DNS box would be a dead end.
|
|
577
577
|
const l7Capabilities = useMemo(() => {
|
|
578
578
|
const statuses = new Set<string>()
|
|
579
|
-
const
|
|
579
|
+
const seenVerdicts = new Set<string>()
|
|
580
580
|
let hasDNSQueries = false
|
|
581
581
|
const methods = new Set<string>()
|
|
582
582
|
for (const f of flowsData?.aggregated ?? []) {
|
|
@@ -586,7 +586,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
586
586
|
// An error rate is a 5xx signal even where no status distribution exists.
|
|
587
587
|
if ((f.errorCount ?? 0) > 0) statuses.add('5xx')
|
|
588
588
|
for (const [verdict, count] of Object.entries(f.verdictCounts ?? {})) {
|
|
589
|
-
if (count > 0)
|
|
589
|
+
if (count > 0) seenVerdicts.add(verdict)
|
|
590
590
|
}
|
|
591
591
|
if (f.topDNSQueries?.length) hasDNSQueries = true
|
|
592
592
|
for (const path of f.topHTTPPaths ?? []) {
|
|
@@ -595,7 +595,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
595
595
|
}
|
|
596
596
|
return {
|
|
597
597
|
availableStatusRanges: ['2xx', '3xx', '4xx', '5xx'].filter(b => statuses.has(b)),
|
|
598
|
-
availableVerdicts:
|
|
598
|
+
availableVerdicts: verdictChoices(seenVerdicts),
|
|
599
599
|
hasDNSQueries,
|
|
600
600
|
availableHTTPMethods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'].filter(m => methods.has(m)),
|
|
601
601
|
}
|
|
@@ -611,8 +611,8 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
611
611
|
() => keepAvailable(l7Methods, l7Capabilities.availableHTTPMethods),
|
|
612
612
|
[l7Methods, l7Capabilities.availableHTTPMethods])
|
|
613
613
|
const activeVerdicts = useMemo(
|
|
614
|
-
() => keepAvailable(
|
|
615
|
-
[
|
|
614
|
+
() => keepAvailable(verdicts, l7Capabilities.availableVerdicts),
|
|
615
|
+
[verdicts, l7Capabilities.availableVerdicts])
|
|
616
616
|
const activeDnsPattern = l7Capabilities.hasDNSQueries ? dnsPattern : ''
|
|
617
617
|
const activeMinConnections = effectiveThreshold(minConnections, minConnectionsUnit, volumeUnit(isRateBased))
|
|
618
618
|
|
|
@@ -777,8 +777,8 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
777
777
|
const toggleL7StatusRange = useCallback((range: string) => {
|
|
778
778
|
setL7StatusRanges(prev => { const next = new Set(prev); if (next.has(range)) next.delete(range); else next.add(range); return next })
|
|
779
779
|
}, [])
|
|
780
|
-
const
|
|
781
|
-
|
|
780
|
+
const toggleVerdict = useCallback((verdict: string) => {
|
|
781
|
+
setVerdicts(prev => { const next = new Set(prev); if (next.has(verdict)) next.delete(verdict); else next.add(verdict); return next })
|
|
782
782
|
}, [])
|
|
783
783
|
|
|
784
784
|
// Toggle namespace visibility
|
|
@@ -1287,7 +1287,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
1287
1287
|
setL7Protocol('all')
|
|
1288
1288
|
setL7Methods(new Set())
|
|
1289
1289
|
setL7StatusRanges(new Set())
|
|
1290
|
-
|
|
1290
|
+
setVerdicts(new Set())
|
|
1291
1291
|
setDnsPattern('')
|
|
1292
1292
|
}, [chooseMinConnections])
|
|
1293
1293
|
|
|
@@ -1430,8 +1430,8 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
1430
1430
|
onToggleL7Method={toggleL7Method}
|
|
1431
1431
|
l7StatusRanges={l7StatusRanges}
|
|
1432
1432
|
onToggleL7StatusRange={toggleL7StatusRange}
|
|
1433
|
-
|
|
1434
|
-
|
|
1433
|
+
verdicts={verdicts}
|
|
1434
|
+
onToggleVerdict={toggleVerdict}
|
|
1435
1435
|
dnsPattern={dnsPattern}
|
|
1436
1436
|
setDnsPattern={setDnsPattern}
|
|
1437
1437
|
namespaces={namespacesWithCounts}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest'
|
|
2
2
|
import type { AggregatedFlow, TrafficFlow } from '../../types'
|
|
3
|
-
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, selectedEdgeMatcher, type GraphFlow } from './trafficFilters'
|
|
3
|
+
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, selectedEdgeMatcher, verdictChoices, type GraphFlow } from './trafficFilters'
|
|
4
4
|
|
|
5
5
|
describe('matchesStatusRanges', () => {
|
|
6
6
|
it('does not filter when nothing is selected', () => {
|
|
@@ -678,3 +678,22 @@ describe('mergedEdgePort', () => {
|
|
|
678
678
|
expect(mergedEdgePort(0, 0)).toBe(0)
|
|
679
679
|
})
|
|
680
680
|
})
|
|
681
|
+
|
|
682
|
+
describe('verdictChoices', () => {
|
|
683
|
+
it('offers forwarded and dropped when both are present', () => {
|
|
684
|
+
expect(verdictChoices(['forwarded', 'dropped'])).toEqual(['forwarded', 'dropped'])
|
|
685
|
+
})
|
|
686
|
+
|
|
687
|
+
it('offers forwarded and error from a source that reports errors', () => {
|
|
688
|
+
expect(verdictChoices(['error', 'forwarded'])).toEqual(['forwarded', 'error'])
|
|
689
|
+
})
|
|
690
|
+
|
|
691
|
+
it('offers nothing when every flow is forwarded, since the filter would match all', () => {
|
|
692
|
+
expect(verdictChoices(['forwarded'])).toEqual([])
|
|
693
|
+
expect(verdictChoices([])).toEqual([])
|
|
694
|
+
})
|
|
695
|
+
|
|
696
|
+
it('offers Forwarded when another verdict without a chip is present, since it then excludes something', () => {
|
|
697
|
+
expect(verdictChoices(['forwarded', 'redirected'])).toEqual(['forwarded'])
|
|
698
|
+
})
|
|
699
|
+
})
|
|
@@ -695,3 +695,16 @@ export function connectionRows<T extends AggregatedFlow>(flows: T[]): T[] {
|
|
|
695
695
|
keyed.sort(byProblemsThenVolume)
|
|
696
696
|
return keyed.map(k => k.flow)
|
|
697
697
|
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* The verdict filter's choices, from the verdicts the flows contain. Caretta,
|
|
701
|
+
* Beyla and Istio report every flow forwarded unless they saw an error, so when
|
|
702
|
+
* forwarded is the only verdict present the filter would match everything and
|
|
703
|
+
* none is offered. Any other verdict, even one without a chip of its own (Hubble
|
|
704
|
+
* also reports redirected, audit and more), makes Forwarded a real choice.
|
|
705
|
+
*/
|
|
706
|
+
export function verdictChoices(seen: Iterable<string>): string[] {
|
|
707
|
+
const present = new Set(seen)
|
|
708
|
+
if (present.size === 1 && present.has('forwarded')) return []
|
|
709
|
+
return ['forwarded', 'dropped', 'error'].filter(v => present.has(v))
|
|
710
|
+
}
|