@oneuptime/common 14.0.8 → 14.0.9
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/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/KubernetesAiAgent.ts +364 -0
- package/Models/DatabaseModels/KubernetesCluster.ts +3 -3
- package/Models/DatabaseModels/Project.ts +55 -5
- package/Models/DatabaseModels/ProxmoxResource.ts +49 -1
- package/Models/DatabaseModels/RunnerJob.ts +75 -0
- package/Models/DatabaseModels/TeamComplianceSetting.ts +143 -2
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +17 -0
- package/Server/API/AIChatAPI.ts +6 -3
- package/Server/API/AIInvestigationAPI.ts +17 -10
- package/Server/API/AutoRemediationAPI.ts +207 -25
- package/Server/API/KubernetesClusterAiAccessAPI.ts +623 -21
- package/Server/API/MicrosoftTeamsAPI.ts +93 -14
- package/Server/API/ProxmoxResourceAPI.ts +244 -14
- package/Server/Infrastructure/GlobalCache.ts +32 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796000000000-AddTeamComplianceRuleScope.ts +99 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796100000000-AddKubernetesAiAgentAndAiDefaults.ts +137 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796200000000-AddProxmoxResourceNativePushColumns.ts +42 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Middleware/TelemetryIngest.ts +41 -18
- package/Server/Services/AIService.ts +70 -1
- package/Server/Services/AlertService.ts +352 -11
- package/Server/Services/AlertSeverityService.ts +65 -15
- package/Server/Services/AutoRemediationRuleService.ts +1 -1
- package/Server/Services/IncidentService.ts +280 -104
- package/Server/Services/IncidentSeverityService.ts +66 -15
- package/Server/Services/KubernetesAiAgentJobService.ts +185 -0
- package/Server/Services/KubernetesAiAgentService.ts +1634 -0
- package/Server/Services/KubernetesClusterAiAccessService.ts +1118 -451
- package/Server/Services/KubernetesClusterService.ts +129 -21
- package/Server/Services/ProjectService.ts +32 -0
- package/Server/Services/ProxmoxResourceService.ts +322 -5
- package/Server/Services/RunnerJobService.ts +241 -104
- package/Server/Services/RunnerService.ts +1 -1
- package/Server/Services/ScheduledMaintenanceService.ts +737 -1
- package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +414 -56
- package/Server/Services/TeamComplianceSettingService.ts +1125 -9
- package/Server/Utils/AI/ClusterAccess/ClusterAccessContext.ts +67 -9
- package/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.ts +39 -10
- package/Server/Utils/AI/ClusterAccess/KubectlJobRunner.ts +14 -3
- package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +37 -15
- package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +67 -24
- package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +48 -5
- package/Server/Utils/AI/SRE/IncidentPostmortemRunner.ts +40 -8
- package/Server/Utils/AI/SRE/InvestigationEligibility.ts +13 -2
- package/Server/Utils/AI/SRE/InvestigationGrader.ts +1 -1
- package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +6 -1
- package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +133 -7
- package/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.ts +58 -4
- package/Server/Utils/Telemetry/ProxmoxNativeNodeLiveness.ts +447 -0
- package/Server/Utils/Telemetry/ProxmoxNativePush.ts +903 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +87 -27
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +684 -47
- package/Tests/App/AdminDashboard/RowActionPlacementOverrides.test.tsx +278 -0
- package/Tests/App/Dashboard/AIChatChartWidgetZoom.test.tsx +738 -0
- package/Tests/App/Dashboard/AIFeaturesSettingsPointers.test.tsx +147 -0
- package/Tests/App/Dashboard/AIInsightsKubernetesClusterPage.test.tsx +1523 -0
- package/Tests/App/Dashboard/AdminUserNotificationMethodsPage.test.tsx +463 -3
- package/Tests/App/Dashboard/AffectedResourcesPickerDropdownPlacement.test.tsx +958 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerFocusLeave.test.tsx +595 -0
- package/Tests/App/Dashboard/AskAiAvailability.test.ts +20 -3
- package/Tests/App/Dashboard/AskAiDisabled.test.tsx +8 -3
- package/Tests/App/Dashboard/CephRateChartReload.test.tsx +1456 -0
- package/Tests/App/Dashboard/CephTimeRangeZoom.test.tsx +1229 -0
- package/Tests/App/Dashboard/ChartCardTimeRangeZoom.test.tsx +151 -0
- package/Tests/App/Dashboard/ChartCardZoomAffordances.test.tsx +257 -0
- package/Tests/App/Dashboard/ChartRefetchFrame.test.tsx +141 -0
- package/Tests/App/Dashboard/ChartZoomHarness.tsx +249 -0
- package/Tests/App/Dashboard/ChartZoomStandIn.tsx +131 -0
- package/Tests/App/Dashboard/CloudServerlessSlowLoads.test.tsx +628 -0
- package/Tests/App/Dashboard/CloudServerlessTimeRangeZoom.test.tsx +607 -0
- package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +91 -19
- package/Tests/App/Dashboard/CompanionMetricsTabZoom.test.tsx +632 -0
- package/Tests/App/Dashboard/ContainerChartZoomStandIn.tsx +195 -0
- package/Tests/App/Dashboard/ContainerHostOverviewSlowLoads.test.tsx +542 -0
- package/Tests/App/Dashboard/ContainerHostOverviewTimeRangeZoom.test.tsx +848 -0
- package/Tests/App/Dashboard/ContainerMetricsTimeRangeZoom.test.tsx +561 -0
- package/Tests/App/Dashboard/DashboardBoardWideZoomShell.test.tsx +1147 -0
- package/Tests/App/Dashboard/DashboardEditPermissions.test.tsx +3 -2
- package/Tests/App/Dashboard/DashboardHistogramWidgetDragCursor.test.tsx +399 -0
- package/Tests/App/Dashboard/DashboardHistogramWidgetZoom.test.tsx +985 -0
- package/Tests/App/Dashboard/DashboardHistogramWidgetZoomHint.test.tsx +803 -0
- package/Tests/App/Dashboard/DashboardLazyPages.test.tsx +1 -0
- package/Tests/App/Dashboard/DashboardSettingsPreviewZoom.test.tsx +679 -0
- package/Tests/App/Dashboard/DashboardSloAndDataSourceChartZoom.test.tsx +881 -0
- package/Tests/App/Dashboard/DashboardTraceStatusWidgets.test.tsx +878 -0
- package/Tests/App/Dashboard/DatabaseMetricChartModalTimeRangeZoom.test.tsx +442 -0
- package/Tests/App/Dashboard/DatabaseOverviewTimeRangeZoom.test.tsx +831 -0
- package/Tests/App/Dashboard/DatabaseServerComponents.test.tsx +43 -0
- package/Tests/App/Dashboard/DockerSwarmInsightsTimeRangeZoom.test.tsx +524 -0
- package/Tests/App/Dashboard/DockerSwarmRateChartRefresh.test.tsx +259 -0
- package/Tests/App/Dashboard/EdgeDetailPanelHistory.test.tsx +763 -0
- package/Tests/App/Dashboard/EdgeDetailPanelTimeRangeZoom.test.tsx +547 -0
- package/Tests/App/Dashboard/EdgeHistoryBucketsCases.tsx +565 -0
- package/Tests/App/Dashboard/EdgeHistoryBucketsKathmandu.test.tsx +73 -0
- package/Tests/App/Dashboard/EdgeHistoryBucketsKolkata.test.tsx +74 -0
- package/Tests/App/Dashboard/EdgeHistoryBucketsNewYork.test.tsx +72 -0
- package/Tests/App/Dashboard/EdgeHistoryBucketsUtc.test.tsx +72 -0
- package/Tests/App/Dashboard/EmbeddedMetricCardRefresh.test.tsx +310 -0
- package/Tests/App/Dashboard/EmbeddedMetricCardTimeRangeZoom.test.tsx +536 -0
- package/Tests/App/Dashboard/EscalationRuleReadiness.test.tsx +3 -1
- package/Tests/App/Dashboard/EscalationRuleRowActions.test.tsx +660 -0
- package/Tests/App/Dashboard/EventNotes.test.tsx +2 -2
- package/Tests/App/Dashboard/EventOverviewPages.test.tsx +587 -13
- package/Tests/App/Dashboard/EventOverviewSnapshotExplorerZoom.test.tsx +1139 -0
- package/Tests/App/Dashboard/EventOverviewSnapshotZoomAcrossTabs.test.tsx +1057 -0
- package/Tests/App/Dashboard/EventOverviewTelemetrySnapshotZoom.test.tsx +757 -0
- package/Tests/App/Dashboard/ExceptionOccurrenceTrendZoom.test.tsx +675 -0
- package/Tests/App/Dashboard/ExceptionOccurrencesZoomSurvivesViewSwitch.test.tsx +405 -0
- package/Tests/App/Dashboard/ExceptionSignalPages.test.tsx +67 -3
- package/Tests/App/Dashboard/ExceptionTablesSpanStatus.test.tsx +515 -0
- package/Tests/App/Dashboard/ExplorerOwnZoomRegression.test.tsx +739 -0
- package/Tests/App/Dashboard/FlowBandwidthAxisCases.tsx +461 -0
- package/Tests/App/Dashboard/FlowBandwidthAxisKathmandu.test.tsx +25 -0
- package/Tests/App/Dashboard/FlowBandwidthAxisKolkata.test.tsx +25 -0
- package/Tests/App/Dashboard/FlowBandwidthAxisNewYork.test.tsx +25 -0
- package/Tests/App/Dashboard/FlowBandwidthAxisUtc.test.tsx +24 -0
- package/Tests/App/Dashboard/FlowTopTalkersZoomRefetch.test.tsx +722 -0
- package/Tests/App/Dashboard/FlowViewportGuard.test.tsx +2526 -0
- package/Tests/App/Dashboard/HostPagesSlowLoads.test.tsx +872 -0
- package/Tests/App/Dashboard/HostPagesTimeRangeZoom.test.tsx +1208 -0
- package/Tests/App/Dashboard/IncidentRootCauseTimeRangeZoom.test.tsx +358 -0
- package/Tests/App/Dashboard/InfrastructureGraph.test.tsx +100 -9
- package/Tests/App/Dashboard/InfrastructureMetricsTabTimeRangeZoom.test.tsx +485 -0
- package/Tests/App/Dashboard/InvestigationDrawerCompanionZoom.test.tsx +655 -0
- package/Tests/App/Dashboard/InvestigationDrawerZoom.test.tsx +830 -0
- package/Tests/App/Dashboard/InvestigationNotStarted.test.tsx +338 -2
- package/Tests/App/Dashboard/InvoicesPayInvoice.test.tsx +454 -16
- package/Tests/App/Dashboard/KubernetesClusterAiAccessSettings.test.ts +799 -819
- package/Tests/App/Dashboard/KubernetesClusterAiAgentOverviewCard.test.tsx +367 -0
- package/Tests/App/Dashboard/KubernetesClusterAiAgentStatus.test.ts +1202 -0
- package/Tests/App/Dashboard/KubernetesClusterAiDocumentationMarkdown.test.ts +106 -0
- package/Tests/App/Dashboard/KubernetesClusterAiNavigation.test.tsx +354 -0
- package/Tests/App/Dashboard/KubernetesClusterAiPage.test.tsx +1884 -2054
- package/Tests/App/Dashboard/KubernetesClusterAiPageServerParity.test.ts +478 -179
- package/Tests/App/Dashboard/KubernetesClusterMetricTooltips.test.ts +50 -0
- package/Tests/App/Dashboard/KubernetesClusterOverviewTooltips.test.tsx +2 -1
- package/Tests/App/Dashboard/KubernetesClusterOverviewZoom.test.tsx +1217 -0
- package/Tests/App/Dashboard/KubernetesClusterPagesZoom.test.tsx +731 -0
- package/Tests/App/Dashboard/KubernetesCostsLoadRecovery.test.tsx +869 -0
- package/Tests/App/Dashboard/KubernetesCostsZoom.test.tsx +1214 -0
- package/Tests/App/Dashboard/KubernetesCostsZoomExactHours.test.tsx +692 -0
- package/Tests/App/Dashboard/KubernetesNetworkThroughputReload.test.tsx +902 -0
- package/Tests/App/Dashboard/KubernetesNetworkZoomBucketEdges.test.tsx +571 -0
- package/Tests/App/Dashboard/KubernetesOverviewZoomBucketEdges.test.tsx +697 -0
- package/Tests/App/Dashboard/KubernetesResourceMetricsTabZoom.test.tsx +633 -0
- package/Tests/App/Dashboard/LogsExplorerTimeRangeZoom.test.tsx +470 -0
- package/Tests/App/Dashboard/LogsInsightsTimeRangeZoom.test.tsx +948 -0
- package/Tests/App/Dashboard/LogsViewerPinnedWindowZoom.test.tsx +486 -0
- package/Tests/App/Dashboard/MetricChartsBucketInspectorDoubleClick.test.tsx +1001 -0
- package/Tests/App/Dashboard/MetricExplorerInvestigationAutoRefresh.test.tsx +514 -0
- package/Tests/App/Dashboard/MetricExplorerSavedViewZoomRoundTrip.test.tsx +581 -0
- package/Tests/App/Dashboard/MetricExplorerTimeRangeZoom.test.tsx +1162 -0
- package/Tests/App/Dashboard/MetricMonitorPreviewZoomLabel.test.ts +72 -0
- package/Tests/App/Dashboard/MetricRowSparklineTimeRangeZoom.test.tsx +204 -0
- package/Tests/App/Dashboard/MetricViewFirstResultLands.test.tsx +408 -0
- package/Tests/App/Dashboard/MetricViewOwnZoomResetPlacement.test.tsx +952 -0
- package/Tests/App/Dashboard/MetricViewTimeRange.test.ts +139 -0
- package/Tests/App/Dashboard/MetricViewTimeRangeZoom.test.tsx +556 -0
- package/Tests/App/Dashboard/MonitorMetricsChartWrappersZoom.test.tsx +552 -0
- package/Tests/App/Dashboard/MonitorMetricsTabsTimeRangeZoom.test.tsx +740 -0
- package/Tests/App/Dashboard/MonitorOverviewChartsTimeRangeZoom.test.tsx +735 -0
- package/Tests/App/Dashboard/MonitorStepPreviewsTimeRangeZoom.test.tsx +835 -0
- package/Tests/App/Dashboard/NetworkDeviceTimeRangeZoom.test.tsx +1115 -0
- package/Tests/App/Dashboard/OnCallPreventionGuards.test.tsx +186 -17
- package/Tests/App/Dashboard/OnCallRulesDeleteGuard.test.tsx +155 -46
- package/Tests/App/Dashboard/PasskeySettings.test.tsx +87 -2
- package/Tests/App/Dashboard/ProjectAISettingsPages.test.tsx +884 -0
- package/Tests/App/Dashboard/ProxmoxNodeRemove.test.tsx +621 -0
- package/Tests/App/Dashboard/ProxmoxOverviewSlowLoads.test.tsx +584 -0
- package/Tests/App/Dashboard/ProxmoxPagesTimeRangeZoom.test.tsx +823 -0
- package/Tests/App/Dashboard/ProxmoxRateChartReload.test.tsx +1253 -0
- package/Tests/App/Dashboard/PublicDashboardBoardWideZoom.test.tsx +605 -0
- package/Tests/App/Dashboard/RealRowsLineChart.tsx +250 -0
- package/Tests/App/Dashboard/RechartsHostsPlotCursor.test.tsx +513 -0
- package/Tests/App/Dashboard/RowActionPlacementOverrides.test.tsx +865 -0
- package/Tests/App/Dashboard/RumOverviewTimeRangeZoom.test.tsx +877 -0
- package/Tests/App/Dashboard/RunnerKubernetesAgentForm.test.tsx +20 -4
- package/Tests/App/Dashboard/RunnerSupersededByAiAgentNote.test.tsx +296 -0
- package/Tests/App/Dashboard/SecurityEventConnectionsTable.test.tsx +146 -36
- package/Tests/App/Dashboard/ServiceDatabaseSlowLoads.test.tsx +1166 -0
- package/Tests/App/Dashboard/ServiceMapGraph.test.tsx +1243 -104
- package/Tests/App/Dashboard/ServiceOverviewTimeRangeZoom.test.tsx +792 -0
- package/Tests/App/Dashboard/SloBudgetBurnDownZoom.test.tsx +771 -0
- package/Tests/App/Dashboard/SloBudgetBurnDownZoomAffordances.test.tsx +380 -0
- package/Tests/App/Dashboard/SloEventMetricsBarChartZoom.test.tsx +369 -0
- package/Tests/App/Dashboard/SloHistoryChartsTimeRangeZoom.test.tsx +694 -0
- package/Tests/App/Dashboard/SloHistoryChartsZoomAffordances.test.tsx +497 -0
- package/Tests/App/Dashboard/SloMetricsTimeRangeZoom.test.tsx +541 -0
- package/Tests/App/Dashboard/SlowLoadHarness.ts +123 -0
- package/Tests/App/Dashboard/SnapshotExplorerPrimaryZoom.test.tsx +1194 -0
- package/Tests/App/Dashboard/SnapshotViewerPinnedWindow.test.tsx +620 -0
- package/Tests/App/Dashboard/TelemetrySnapshotPanelTimeRangeZoom.test.tsx +765 -0
- package/Tests/App/Dashboard/TelemetrySnapshotZoom.test.tsx +516 -0
- package/Tests/App/Dashboard/TelemetrySnapshotZoomAcrossTabs.test.tsx +827 -0
- package/Tests/App/Dashboard/TimeRangeZoomPageHarness.tsx +463 -0
- package/Tests/App/Dashboard/TraceChartEditorStatusSplit.test.tsx +543 -0
- package/Tests/App/Dashboard/TraceStatusPresentation.test.tsx +967 -0
- package/Tests/App/Dashboard/TraceTimelineMinimapZoom.test.tsx +315 -0
- package/Tests/App/Dashboard/TracesAnalyticsStatusSplit.test.tsx +778 -0
- package/Tests/App/Dashboard/TracesAnalyticsViewZoom.test.tsx +349 -0
- package/Tests/App/Dashboard/TracesExplorerTimeRangeZoom.test.tsx +551 -0
- package/Tests/App/Dashboard/TracesStatusChartAndFacet.test.tsx +687 -0
- package/Tests/App/Dashboard/TracesViewerStaleResponses.test.tsx +458 -0
- package/Tests/App/Dashboard/UptimeStripsExcludedFromZoom.test.tsx +406 -0
- package/Tests/App/Dashboard/VMwareOverviewSlowLoads.test.tsx +535 -0
- package/Tests/App/Dashboard/VMwarePagesTimeRangeZoom.test.tsx +606 -0
- package/Tests/App/Dashboard/ValueWidgetSparklineStaleHover.test.tsx +1292 -0
- package/Tests/App/Dashboard/ValueWidgetSparklineZoom.test.tsx +765 -0
- package/Tests/App/StatusPage/StatusPageResourceExplorer.test.tsx +98 -0
- package/Tests/Models/DatabaseModels/KubernetesAiAgentModel.test.ts +295 -0
- package/Tests/Models/DatabaseModels/TeamComplianceSettingModel.test.ts +347 -0
- package/Tests/Server/API/AIChatRouteAuthorization.test.ts +58 -0
- package/Tests/Server/API/AIGenerationProjectAIToggle.test.ts +1 -1
- package/Tests/Server/API/AIInvestigationAPI.test.ts +123 -45
- package/Tests/Server/API/AutoRemediationApproveClusterRound.test.ts +1329 -0
- package/Tests/Server/API/AutoRemediationApproveKubectlRecheck.test.ts +25 -2
- package/Tests/Server/API/KubernetesClusterAiAccessAPI.test.ts +2 -0
- package/Tests/Server/API/KubernetesClusterAiAccessAPIAgent.test.ts +903 -0
- package/Tests/Server/API/MicrosoftTeamsChatsRefreshRoute.test.ts +667 -0
- package/Tests/Server/API/MicrosoftTeamsManifest.test.ts +294 -6
- package/Tests/Server/API/ProxmoxResourceAPIRemoveNode.test.ts +1932 -0
- package/Tests/Server/Infrastructure/GlobalCache.test.ts +195 -0
- package/Tests/Server/Infrastructure/Postgres/AddKubernetesAiAgentAndAiDefaultsMigration.test.ts +623 -0
- package/Tests/Server/Infrastructure/Postgres/AddKubernetesClusterAiAccessMigration.test.ts +87 -10
- package/Tests/Server/Infrastructure/Postgres/AddTeamComplianceRuleScopeMigration.test.ts +622 -0
- package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +61 -4
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +98 -2
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +105 -2
- package/Tests/Server/Services/AIServiceBalanceBlocker.test.ts +282 -0
- package/Tests/Server/Services/AlertMonitorClearWritesNull.test.ts +409 -0
- package/Tests/Server/Services/AlertMonitorEditFeed.test.ts +474 -0
- package/Tests/Server/Services/AlertMonitorEditGuard.test.ts +610 -0
- package/Tests/Server/Services/AutoRemediationClusterRuleEngine.test.ts +2 -0
- package/Tests/Server/Services/AutoRemediationRuleCommandRunners.test.ts +2 -1
- package/Tests/Server/Services/IncidentAffectedMonitorsEdit.test.ts +1360 -0
- package/Tests/Server/Services/IncidentAlertSloLinkSurvivesEdit.test.ts +3 -1
- package/Tests/Server/Services/IncidentSeverityDeletePausesComplianceRules.test.ts +488 -0
- package/Tests/Server/Services/KubernetesAiAgentJobService.test.ts +329 -0
- package/Tests/Server/Services/KubernetesAiAgentServiceHelpers.test.ts +618 -0
- package/Tests/Server/Services/KubernetesAiAgentServiceLifecycle.test.ts +1444 -0
- package/Tests/Server/Services/KubernetesAiAgentServiceRegister.test.ts +1666 -0
- package/Tests/Server/Services/KubernetesClusterAiAccessDeletedRunnerRemedy.test.ts +140 -111
- package/Tests/Server/Services/KubernetesClusterAiAccessGapNextSteps.test.ts +267 -105
- package/Tests/Server/Services/KubernetesClusterAiAccessLegacySuperseded.test.ts +440 -0
- package/Tests/Server/Services/KubernetesClusterAiAccessService.test.ts +567 -411
- package/Tests/Server/Services/KubernetesClusterAiAccessTarget.test.ts +1168 -0
- package/Tests/Server/Services/KubernetesClusterAiSettingsPermission.test.ts +410 -12
- package/Tests/Server/Services/KubernetesClusterServiceAiAccessFeed.test.ts +55 -0
- package/Tests/Server/Services/ProjectServiceNewProjectAiDefaults.test.ts +288 -0
- package/Tests/Server/Services/ProxmoxResourcePostgres.test.ts +5633 -0
- package/Tests/Server/Services/ProxmoxResourceService.test.ts +6458 -5
- package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +48 -15
- package/Tests/Server/Services/RunnerJobEnqueueKubectlAiAgent.test.ts +620 -0
- package/Tests/Server/Services/RunnerJobKubectlWriteScope.test.ts +170 -3
- package/Tests/Server/Services/RunnerJobTimeoutReason.test.ts +72 -0
- package/Tests/Server/Services/RunnerServiceAgentName.test.ts +6 -4
- package/Tests/Server/Services/ScheduledMaintenanceAttachmentEdit.test.ts +2113 -0
- package/Tests/Server/Services/ScheduledMaintenanceMonitorRelease.test.ts +972 -0
- package/Tests/Server/Services/TeamComplianceSettingPostgres.test.ts +2237 -0
- package/Tests/Server/Services/TeamComplianceSettingService.test.ts +3988 -138
- package/Tests/Server/Utils/AI/ClusterAccessContext.test.ts +107 -1
- package/Tests/Server/Utils/AI/IncidentPostmortemRunner.test.ts +351 -0
- package/Tests/Server/Utils/AI/InvestigationClusterAccessWiring.test.ts +2 -0
- package/Tests/Server/Utils/AI/InvestigationEligibility.test.ts +310 -0
- package/Tests/Server/Utils/AI/KubectlInvestigationToolkit.test.ts +70 -0
- package/Tests/Server/Utils/AI/KubectlJobRunnerFinishedJob.test.ts +58 -0
- package/Tests/Server/Utils/AI/RemediationCommandToolsKubectl.test.ts +2 -0
- package/Tests/Server/Utils/AI/RemediationCommandToolsKubectlOutcome.test.ts +2 -0
- package/Tests/Server/Utils/AI/RemediationCommandToolsLiveCluster.test.ts +2 -0
- package/Tests/Server/Utils/AI/RemediationCommandToolsRunnerScope.test.ts +125 -1
- package/Tests/Server/Utils/AI/RemediationExecutionRunner.test.ts +252 -3
- package/Tests/Server/Utils/AI/RemediationExecutionRunnerClusterMode.test.ts +2 -0
- package/Tests/Server/Utils/AI/RemediationExecutionRunnerProjectGates.test.ts +240 -0
- package/Tests/Server/Utils/AI/RemediationKubectlCopyParity.test.ts +2 -0
- package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutor.test.ts +2 -0
- package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorUnknownRun.test.ts +2 -0
- package/Tests/Server/Utils/AutoRemediation/CommandPlanVerification.test.ts +2 -0
- package/Tests/Server/Utils/Telemetry/HostAssetAttributesFromOtlp.test.ts +68 -0
- package/Tests/Server/Utils/Telemetry/InventoryMirrorPostgres.test.ts +370 -0
- package/Tests/Server/Utils/Telemetry/NetworkDeviceInventoryAttributes.test.ts +522 -0
- package/Tests/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.test.ts +155 -0
- package/Tests/Server/Utils/Telemetry/ProxmoxNativeNodeLiveness.test.ts +8631 -0
- package/Tests/Server/Utils/Telemetry/ProxmoxNativePush.test.ts +2852 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +367 -1
- package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +45 -3
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsChats.test.ts +25 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsGroupChatNames.test.ts +3119 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsGroupChatNamesPostgres.test.ts +1721 -0
- package/Tests/Types/Kubernetes/KubernetesAgentChartAiAccess.test.ts +581 -113
- package/Tests/Types/Kubernetes/KubernetesAiAgentAccessContract.test.ts +510 -0
- package/Tests/Types/Team/ComplianceRule.test.ts +1029 -0
- package/Tests/Types/Team/TeamComplianceStatus.test.ts +176 -0
- package/Tests/UI/Components/ActionButton/RowActions.test.tsx +641 -0
- package/Tests/UI/Components/ActionButton/RowActionsAccessibility.test.tsx +414 -0
- package/Tests/UI/Components/ActionButton/SplitActionButtons.test.ts +565 -0
- package/Tests/UI/Components/Charts/BarChartDragToSelect.test.tsx +386 -0
- package/Tests/UI/Components/Charts/ChartDoubleClickResetWithoutDblclick.test.tsx +1025 -0
- package/Tests/UI/Components/Charts/ChartGroupPageZoomHint.test.tsx +196 -0
- package/Tests/UI/Components/Charts/ChartPlaceholdersTakeDoubleClick.test.tsx +1861 -0
- package/Tests/UI/Components/Charts/ChartPlotClicksWhileResetArmed.test.tsx +382 -0
- package/Tests/UI/Components/Charts/ChartRangeSelection.test.tsx +704 -0
- package/Tests/UI/Components/Charts/ChartRangeSelectionDoubleClickReset.test.tsx +1481 -0
- package/Tests/UI/Components/Charts/ChartRangeSelectionRealRecharts.test.tsx +918 -0
- package/Tests/UI/Components/Charts/ChartRowBucketStart.test.ts +350 -0
- package/Tests/UI/Components/Charts/DoubleClickReset.test.tsx +996 -0
- package/Tests/UI/Components/Charts/HistogramDoubleClickResetRealRecharts.test.tsx +965 -0
- package/Tests/UI/Components/Charts/HistogramDriftThenRefetch.test.tsx +277 -0
- package/Tests/UI/Components/Charts/HistogramRangeSelectionDataChange.test.tsx +1757 -0
- package/Tests/UI/Components/Charts/HistogramRangeSelectionRealRecharts.test.tsx +560 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/ChartPageTimeRangeZoom.test.tsx +513 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomContext.test.tsx +845 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomHint.test.tsx +119 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomHintTailwind.test.tsx +274 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomUtil.test.ts +433 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/UseTimeRangeZoom.test.tsx +863 -0
- package/Tests/UI/Components/Charts/TimeRangeZoom/ZoomDocsPromises.test.tsx +1147 -0
- package/Tests/UI/Components/DisabledButtonTooltip.test.tsx +14 -3
- package/Tests/UI/Components/EntityDropdownEscape.test.tsx +454 -0
- package/Tests/UI/Components/EntityDropdownFocusLeave.test.tsx +420 -0
- package/Tests/UI/Components/Forms/FormFieldDropdownDisabled.test.tsx +233 -0
- package/Tests/UI/Components/Input.test.tsx +80 -1
- package/Tests/UI/Components/LogsAnalyticsViewZoom.test.tsx +947 -0
- package/Tests/UI/Components/LogsHistogramDragTooltip.test.tsx +17 -5
- package/Tests/UI/Components/LogsViewerAnalyticsZoom.test.tsx +501 -0
- package/Tests/UI/Components/LogsViewerHistogramZoom.test.tsx +1 -1
- package/Tests/UI/Components/ModelTable/BaseModelTableBulkDelete.test.tsx +6 -4
- package/Tests/UI/Components/ModelTable/BaseModelTablePermissionGating.test.tsx +60 -8
- package/Tests/UI/Components/ModelTable/BaseModelTableRowActions.test.tsx +476 -0
- package/Tests/UI/Components/ModelTable/ModelTableWrapContent.test.tsx +7 -5
- package/Tests/UI/Components/MoreMenuPortal.test.tsx +623 -0
- package/Tests/UI/Components/StatusPage/ResourceGridActions.test.tsx +538 -0
- package/Tests/UI/Components/StatusPage/ResourceGridSelection.test.tsx +14 -4
- package/Tests/UI/Components/TableCellWrapping.test.tsx +3 -3
- package/Tests/UI/Components/TableRowActions.test.tsx +472 -0
- package/Tests/UI/Components/TelemetryHistogramDragTooltip.test.tsx +1 -1
- package/Tests/UI/Components/TelemetryViewer/TelemetryViewerHistogramClickZoom.test.tsx +1 -1
- package/Tests/UI/Components/TelemetryViewer/TelemetryViewerZoomScope.test.tsx +470 -0
- package/Tests/UI/Components/TelemetryViewer/UseViewerTimeRangeZoom.test.tsx +571 -0
- package/Tests/UI/Components/TelemetryViewer/ViewerDoubleClickResetUnderDataChange.test.tsx +928 -0
- package/Tests/UI/Components/TelemetryViewer/ViewerFollowsEnclosingZoom.test.tsx +1569 -0
- package/Tests/UI/Components/Toggle.test.tsx +66 -0
- package/Tests/UI/MicrosoftTeams/MicrosoftTeamsChatsCardRefreshNames.test.tsx +1023 -0
- package/Tests/UI/Rum/ChunkLoader.test.ts +201 -0
- package/Tests/UI/Rum/FidelityNotices.test.ts +54 -0
- package/Tests/UI/Rum/ReplayCorrelationPanel.test.tsx +72 -0
- package/Tests/UI/Rum/ReplayFrameCapture.test.ts +1009 -9
- package/Tests/UI/Rum/ReplayRecordedAssets.test.ts +1069 -0
- package/Tests/UI/Rum/ReplayStage.test.tsx +913 -2
- package/Tests/UI/Rum/SessionReplayTable.test.tsx +443 -8
- package/Tests/UI/Rum/SessionReplayUsersTable.test.tsx +439 -9
- package/Tests/UI/Rum/UserFlowTablesRowActions.test.tsx +501 -0
- package/Tests/Utils/AiRemediation/KubectlPolicyChartRbacParity.test.ts +47 -19
- package/Tests/Utils/AiRemediation/KubectlWriteScopeCallerParity.test.ts +2 -0
- package/Tests/Utils/AiRemediation/KubernetesAiAgentPolicyCopyParity.test.ts +396 -0
- package/Tests/Utils/Dashboard/DashboardTimeRangeZoom.test.ts +104 -1
- package/Types/AI/AIRunType.ts +9 -4
- package/Types/AI/InvestigationNotStartedReason.ts +6 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.ts +14 -16
- package/Types/AutoRemediation/AiRemediationCommandPolicyVerdict.ts +28 -0
- package/Types/Dashboard/DashboardComponents/DashboardTraceChartComponent.ts +4 -2
- package/Types/Kubernetes/KubernetesClusterAiAccess.ts +263 -32
- package/Types/Kubernetes/KubernetesClusterAiAccessPermissions.ts +20 -16
- package/Types/Kubernetes/KubernetesClusterAiInsights.ts +81 -0
- package/Types/Monitor/ProxmoxAlertTemplates.ts +4 -4
- package/Types/Team/ComplianceNotificationChannel.ts +22 -0
- package/Types/Team/ComplianceRule.ts +434 -0
- package/Types/Team/ComplianceRuleType.ts +21 -0
- package/Types/Team/TeamComplianceStatus.ts +81 -0
- package/Types/Telemetry/TelemetryIngestSurface.ts +28 -0
- package/UI/Components/ActionButton/ActionButtonSchema.ts +21 -0
- package/UI/Components/ActionButton/RowActions.tsx +238 -0
- package/UI/Components/ActionButton/SplitActionButtons.ts +173 -0
- package/UI/Components/Charts/Area/AreaChart.tsx +32 -2
- package/UI/Components/Charts/Bar/BarChart.tsx +40 -3
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +37 -11
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +80 -243
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +122 -31
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +95 -244
- package/UI/Components/Charts/ChartLibrary/Utils/DoubleClick.ts +214 -0
- package/UI/Components/Charts/ChartLibrary/Utils/UseChartBucketsChange.ts +32 -0
- package/UI/Components/Charts/ChartLibrary/Utils/UseChartRangeSelection.ts +599 -0
- package/UI/Components/Charts/Line/LineChart.tsx +32 -2
- package/UI/Components/Charts/TimeRangeZoom/ResetTimeRangeZoomButton.tsx +70 -0
- package/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomContext.tsx +226 -0
- package/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomHint.tsx +73 -0
- package/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomUtil.ts +163 -0
- package/UI/Components/Charts/TimeRangeZoom/UseTimeRangeZoom.ts +215 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +20 -8
- package/UI/Components/Charts/Utils/XAxis.ts +75 -0
- package/UI/Components/Charts/Utils/useHistogramRangeSelection.ts +493 -59
- package/UI/Components/EntityDropdown/EntityDropdown.tsx +107 -11
- package/UI/Components/Forms/Fields/FormField.tsx +10 -0
- package/UI/Components/Input/Input.tsx +90 -57
- package/UI/Components/List/ListRow.tsx +8 -74
- package/UI/Components/LogsViewer/LogsViewer.tsx +40 -11
- package/UI/Components/LogsViewer/components/LogTimeRangePicker.tsx +22 -6
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +209 -6
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +127 -84
- package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +3 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +12 -1
- package/UI/Components/MoreMenu/MoreMenu.tsx +365 -30
- package/UI/Components/MoreMenu/MoreMenuItem.tsx +70 -17
- package/UI/Components/OrderedStatesList/Item.tsx +7 -72
- package/UI/Components/StatusPage/ResourceGrid.tsx +126 -77
- package/UI/Components/Table/TableBody.tsx +8 -2
- package/UI/Components/Table/TableRow.tsx +20 -140
- package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +41 -10
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +47 -9
- package/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.tsx +25 -6
- package/UI/Components/TelemetryViewer/types.ts +2 -0
- package/UI/Components/TelemetryViewer/useViewerTimeRangeZoom.ts +448 -0
- package/UI/Components/Toggle/Toggle.tsx +26 -0
- package/UI/Components/Tooltip/Tooltip.tsx +8 -1
- package/UI/Styles/Theme.css +14 -2
- package/Utils/AiRemediation/CommandPolicy.ts +1 -1
- package/Utils/AiRemediation/KubectlPolicy.ts +1 -1
- package/Utils/Dashboard/DashboardTimeRangeZoom.ts +46 -2
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/KubernetesAiAgent.js +385 -0
- package/build/dist/Models/DatabaseModels/KubernetesAiAgent.js.map +1 -0
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js +3 -3
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +56 -5
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxResource.js +51 -1
- package/build/dist/Models/DatabaseModels/ProxmoxResource.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RunnerJob.js +74 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js +134 -3
- package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +6 -1
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +17 -10
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AutoRemediationAPI.js +144 -24
- package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
- package/build/dist/Server/API/KubernetesClusterAiAccessAPI.js +436 -22
- package/build/dist/Server/API/KubernetesClusterAiAccessAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +69 -13
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/ProxmoxResourceAPI.js +187 -14
- package/build/dist/Server/API/ProxmoxResourceAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/GlobalCache.js +27 -0
- package/build/dist/Server/Infrastructure/GlobalCache.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796000000000-AddTeamComplianceRuleScope.js +50 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796000000000-AddTeamComplianceRuleScope.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796100000000-AddKubernetesAiAgentAndAiDefaults.js +84 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796100000000-AddKubernetesAiAgentAndAiDefaults.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796200000000-AddProxmoxResourceNativePushColumns.js +31 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796200000000-AddProxmoxResourceNativePushColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +34 -19
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +59 -1
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +248 -13
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/AlertSeverityService.js +51 -15
- package/build/dist/Server/Services/AlertSeverityService.js.map +1 -1
- package/build/dist/Server/Services/AutoRemediationRuleService.js +1 -1
- package/build/dist/Server/Services/AutoRemediationRuleService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +199 -72
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentSeverityService.js +51 -15
- package/build/dist/Server/Services/IncidentSeverityService.js.map +1 -1
- package/build/dist/Server/Services/KubernetesAiAgentJobService.js +158 -0
- package/build/dist/Server/Services/KubernetesAiAgentJobService.js.map +1 -0
- package/build/dist/Server/Services/KubernetesAiAgentService.js +1145 -0
- package/build/dist/Server/Services/KubernetesAiAgentService.js.map +1 -0
- package/build/dist/Server/Services/KubernetesClusterAiAccessService.js +842 -371
- package/build/dist/Server/Services/KubernetesClusterAiAccessService.js.map +1 -1
- package/build/dist/Server/Services/KubernetesClusterService.js +86 -17
- package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +22 -0
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ProxmoxResourceService.js +258 -3
- package/build/dist/Server/Services/ProxmoxResourceService.js.map +1 -1
- package/build/dist/Server/Services/RunnerJobService.js +178 -92
- package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
- package/build/dist/Server/Services/RunnerService.js +1 -1
- package/build/dist/Server/Services/RunnerService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +535 -3
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +316 -46
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/TeamComplianceSettingService.js +833 -7
- package/build/dist/Server/Services/TeamComplianceSettingService.js.map +1 -1
- package/build/dist/Server/Utils/AI/ClusterAccess/ClusterAccessContext.js +52 -9
- package/build/dist/Server/Utils/AI/ClusterAccess/ClusterAccessContext.js.map +1 -1
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js +13 -9
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js.map +1 -1
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js +7 -3
- package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +29 -15
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +56 -20
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +39 -5
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/IncidentPostmortemRunner.js +30 -3
- package/build/dist/Server/Utils/AI/SRE/IncidentPostmortemRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/InvestigationEligibility.js +13 -2
- package/build/dist/Server/Utils/AI/SRE/InvestigationEligibility.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/InvestigationGrader.js +1 -1
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +4 -2
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +111 -6
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js +40 -4
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ProxmoxNativeNodeLiveness.js +296 -0
- package/build/dist/Server/Utils/Telemetry/ProxmoxNativeNodeLiveness.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/ProxmoxNativePush.js +699 -0
- package/build/dist/Server/Utils/Telemetry/ProxmoxNativePush.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +77 -19
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +505 -42
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/AI/AIRunType.js +9 -4
- package/build/dist/Types/AI/AIRunType.js.map +1 -1
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +10 -16
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPolicyVerdict.js +28 -0
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPolicyVerdict.js.map +1 -0
- package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js +72 -16
- package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js.map +1 -1
- package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessPermissions.js +20 -16
- package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessPermissions.js.map +1 -1
- package/build/dist/Types/Kubernetes/KubernetesClusterAiInsights.js +17 -0
- package/build/dist/Types/Kubernetes/KubernetesClusterAiInsights.js.map +1 -0
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js +4 -4
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js.map +1 -1
- package/build/dist/Types/Team/ComplianceNotificationChannel.js +23 -0
- package/build/dist/Types/Team/ComplianceNotificationChannel.js.map +1 -0
- package/build/dist/Types/Team/ComplianceRule.js +304 -0
- package/build/dist/Types/Team/ComplianceRule.js.map +1 -0
- package/build/dist/Types/Team/ComplianceRuleType.js +21 -0
- package/build/dist/Types/Team/ComplianceRuleType.js.map +1 -1
- package/build/dist/Types/Team/TeamComplianceStatus.js +2 -0
- package/build/dist/Types/Team/TeamComplianceStatus.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +25 -0
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
- package/build/dist/UI/Components/ActionButton/ActionButtonSchema.js +20 -1
- package/build/dist/UI/Components/ActionButton/ActionButtonSchema.js.map +1 -1
- package/build/dist/UI/Components/ActionButton/RowActions.js +113 -0
- package/build/dist/UI/Components/ActionButton/RowActions.js.map +1 -0
- package/build/dist/UI/Components/ActionButton/SplitActionButtons.js +71 -0
- package/build/dist/UI/Components/ActionButton/SplitActionButtons.js.map +1 -0
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +16 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +16 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +27 -5
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +61 -194
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +84 -26
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +75 -196
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/DoubleClick.js +133 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/DoubleClick.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseChartBucketsChange.js +26 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseChartBucketsChange.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseChartRangeSelection.js +371 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseChartRangeSelection.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +16 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/TimeRangeZoom/ResetTimeRangeZoomButton.js +35 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/ResetTimeRangeZoomButton.js.map +1 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomContext.js +107 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomContext.js.map +1 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomHint.js +41 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomHint.js.map +1 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomUtil.js +117 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/TimeRangeZoomUtil.js.map +1 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/UseTimeRangeZoom.js +121 -0
- package/build/dist/UI/Components/Charts/TimeRangeZoom/UseTimeRangeZoom.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +15 -7
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +70 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/useHistogramRangeSelection.js +305 -38
- package/build/dist/UI/Components/Charts/Utils/useHistogramRangeSelection.js.map +1 -1
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js +89 -14
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +11 -2
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +69 -54
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/List/ListRow.js +4 -39
- package/build/dist/UI/Components/List/ListRow.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +31 -8
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js +10 -1
- package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +139 -21
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +30 -8
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +10 -0
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js +253 -14
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js +43 -13
- package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js.map +1 -1
- package/build/dist/UI/Components/OrderedStatesList/Item.js +2 -38
- package/build/dist/UI/Components/OrderedStatesList/Item.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceGrid.js +53 -15
- package/build/dist/UI/Components/StatusPage/ResourceGrid.js.map +1 -1
- package/build/dist/UI/Components/Table/TableBody.js +6 -2
- package/build/dist/UI/Components/Table/TableBody.js.map +1 -1
- package/build/dist/UI/Components/Table/TableRow.js +12 -75
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +32 -7
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +27 -9
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js +11 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/useViewerTimeRangeZoom.js +272 -0
- package/build/dist/UI/Components/TelemetryViewer/useViewerTimeRangeZoom.js.map +1 -0
- package/build/dist/UI/Components/Toggle/Toggle.js +14 -1
- package/build/dist/UI/Components/Toggle/Toggle.js.map +1 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js +1 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js.map +1 -1
- package/build/dist/Utils/AiRemediation/CommandPolicy.js +1 -1
- package/build/dist/Utils/AiRemediation/CommandPolicy.js.map +1 -1
- package/build/dist/Utils/AiRemediation/KubectlPolicy.js +1 -1
- package/build/dist/Utils/AiRemediation/KubectlPolicy.js.map +1 -1
- package/build/dist/Utils/Dashboard/DashboardTimeRangeZoom.js +27 -1
- package/build/dist/Utils/Dashboard/DashboardTimeRangeZoom.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
2
2
|
import { getHistogramSelectionWindow, } from "./HistogramSelection";
|
|
3
|
-
import { DOUBLE_CLICK_DISAMBIGUATION_MS } from "../ChartLibrary/Utils/DoubleClick";
|
|
3
|
+
import { DOUBLE_CLICK_DISAMBIGUATION_MS, useDoubleClickReset, } from "../ChartLibrary/Utils/DoubleClick";
|
|
4
|
+
import { CHART_PRESS_STILLNESS_PX, RANGE_SELECTION_THROTTLED_EVENTS, } from "../ChartLibrary/Utils/UseChartRangeSelection";
|
|
5
|
+
import OneUptimeDate from "../../../../Types/Date";
|
|
6
|
+
/*
|
|
7
|
+
* How far the pointer may wander from where it was pressed and still be a
|
|
8
|
+
* pointer that has not moved - the line, area and bar charts' own measure.
|
|
9
|
+
*/
|
|
10
|
+
export const HISTOGRAM_PRESS_STILLNESS_PX = CHART_PRESS_STILLNESS_PX;
|
|
11
|
+
const SELECTABLE_CHART_ROOT_PROPS = {
|
|
12
|
+
throttledEvents: RANGE_SELECTION_THROTTLED_EVENTS,
|
|
13
|
+
};
|
|
14
|
+
const INERT_CHART_ROOT_PROPS = {};
|
|
4
15
|
function toLabel(state) {
|
|
5
16
|
const label = state === null || state === void 0 ? void 0 : state.activeLabel;
|
|
6
17
|
if (label === undefined || label === null || label === "") {
|
|
@@ -8,6 +19,29 @@ function toLabel(state) {
|
|
|
8
19
|
}
|
|
9
20
|
return String(label);
|
|
10
21
|
}
|
|
22
|
+
function toAxisIndex(state) {
|
|
23
|
+
const index = state === null || state === void 0 ? void 0 : state.activeTooltipIndex;
|
|
24
|
+
if (index === undefined || index === null || index === "") {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return String(index);
|
|
28
|
+
}
|
|
29
|
+
/*
|
|
30
|
+
* Two bars' labels in time order. recharts draws a band's x1 from the left
|
|
31
|
+
* edge of its bar and x2 to the right edge of its own, so a band in drag
|
|
32
|
+
* order shaded neither end bar of a right-to-left drag (and nothing at all
|
|
33
|
+
* across two neighbours). Labels that are not dates keep their order.
|
|
34
|
+
*/
|
|
35
|
+
function inTimeOrder(first, second) {
|
|
36
|
+
const firstMs = OneUptimeDate.fromString(first).getTime();
|
|
37
|
+
const secondMs = OneUptimeDate.fromString(second).getTime();
|
|
38
|
+
if (Number.isFinite(firstMs) &&
|
|
39
|
+
Number.isFinite(secondMs) &&
|
|
40
|
+
secondMs < firstMs) {
|
|
41
|
+
return [second, first];
|
|
42
|
+
}
|
|
43
|
+
return [first, second];
|
|
44
|
+
}
|
|
11
45
|
/**
|
|
12
46
|
* Click-or-drag range selection on a time histogram.
|
|
13
47
|
*
|
|
@@ -19,18 +53,56 @@ function toLabel(state) {
|
|
|
19
53
|
* click waits DOUBLE_CLICK_DISAMBIGUATION_MS and a second press or the
|
|
20
54
|
* double-click cancels it. An unzoomed chart has no double-click gesture
|
|
21
55
|
* and zooms at once.
|
|
56
|
+
* - On a zoomed chart the second press of a double-click is the zoom-out
|
|
57
|
+
* and nothing else, and it zooms out even when the browser never sends
|
|
58
|
+
* the `dblclick` (see useDoubleClickReset). That is what happens when the
|
|
59
|
+
* chart's new bars land during the press, which, right after a zoom, is
|
|
60
|
+
* when readers double-click.
|
|
61
|
+
* - A press becomes a drag only once the POINTER leaves its bar, by more
|
|
62
|
+
* than HISTOGRAM_PRESS_STILLNESS_PX. New bars landing under a pointer that
|
|
63
|
+
* has not moved are not a drag. A press that stayed put is a click on the
|
|
64
|
+
* bar it pressed, even if a hand's drift ended it over the neighbour;
|
|
65
|
+
* only when the very spot it pressed shows another bar at the release
|
|
66
|
+
* (the same place on the axis, new data) does it zoom nowhere: the bar it
|
|
67
|
+
* pressed is no longer on the chart.
|
|
68
|
+
* - A click waiting to zoom in is dropped if the zoom ends first (Reset
|
|
69
|
+
* zoom, the picker, an empty state's double-click): it was a zoom into
|
|
70
|
+
* the window the reader has just left.
|
|
71
|
+
* - Only the main button selects: a right-click opens a context menu.
|
|
22
72
|
*
|
|
23
|
-
* The release is resolved against refs rather than render state
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
73
|
+
* The release is resolved against refs rather than render state, from the
|
|
74
|
+
* bar recharts hands the `mouseup` handler, falling back to the last move.
|
|
75
|
+
* That bar is the one under the pointer now only if the host spreads
|
|
76
|
+
* `chartRootProps` onto its chart root (see the field).
|
|
77
|
+
*
|
|
78
|
+
* A press renders nothing until the pointer leaves its bar. A render under
|
|
79
|
+
* a press can take away the node it landed on (a band repainted under the
|
|
80
|
+
* pointer, say), and a press whose node is gone by the release gets no
|
|
81
|
+
* click and no dblclick - the second click of a double-click lands on the
|
|
82
|
+
* band the first one painted.
|
|
29
83
|
*/
|
|
30
84
|
const useHistogramRangeSelection = (options) => {
|
|
31
85
|
const [selectionStart, setSelectionStart] = useState(null);
|
|
32
86
|
const [selectionEnd, setSelectionEnd] = useState(null);
|
|
33
87
|
const [isDragging, setIsDragging] = useState(false);
|
|
88
|
+
// Whether the pointer has left the pressed bar (a drag, not a click).
|
|
89
|
+
const hasLeftPressedBar = useRef(false);
|
|
90
|
+
// Where the press in progress went down, when recharts said.
|
|
91
|
+
const pressClientX = useRef(null);
|
|
92
|
+
// The place on the axis of the bar it went down on (see toAxisIndex).
|
|
93
|
+
const pressAxisIndex = useRef(null);
|
|
94
|
+
/*
|
|
95
|
+
* Where the pointer was, and the bar recharts named under it, at the
|
|
96
|
+
* press or at the last move since. recharts works out the bar under the
|
|
97
|
+
* pointer again only when the pointer moves, so a report at the same
|
|
98
|
+
* spot that names another bar means new data landed under the press -
|
|
99
|
+
* however much a hand had drifted before it.
|
|
100
|
+
*/
|
|
101
|
+
const lastReport = useRef({ clientX: null, label: null });
|
|
102
|
+
// Whether new data landed under the press in progress (see lastReport).
|
|
103
|
+
const barsChangedUnderPress = useRef(false);
|
|
104
|
+
// The page-wide mouseup listener of the press in progress, if any.
|
|
105
|
+
const releaseListener = useRef(null);
|
|
34
106
|
/*
|
|
35
107
|
* The ref stays the authority on whether a selection is in progress, so a
|
|
36
108
|
* release seen twice (the chart's handler *and* the page-wide listener
|
|
@@ -56,6 +128,12 @@ const useHistogramRangeSelection = (options) => {
|
|
|
56
128
|
setSelectionStart(null);
|
|
57
129
|
setSelectionEnd(null);
|
|
58
130
|
}, []);
|
|
131
|
+
const stopListeningForRelease = useCallback(() => {
|
|
132
|
+
if (releaseListener.current) {
|
|
133
|
+
window.removeEventListener("mouseup", releaseListener.current);
|
|
134
|
+
releaseListener.current = null;
|
|
135
|
+
}
|
|
136
|
+
}, []);
|
|
59
137
|
const cancelPendingClick = useCallback(() => {
|
|
60
138
|
if (pendingClick.current === null) {
|
|
61
139
|
return false;
|
|
@@ -67,39 +145,211 @@ const useHistogramRangeSelection = (options) => {
|
|
|
67
145
|
useEffect(() => {
|
|
68
146
|
return () => {
|
|
69
147
|
cancelPendingClick();
|
|
148
|
+
stopListeningForRelease();
|
|
70
149
|
};
|
|
71
|
-
}, [cancelPendingClick]);
|
|
72
|
-
|
|
150
|
+
}, [cancelPendingClick, stopListeningForRelease]);
|
|
151
|
+
/*
|
|
152
|
+
* The zoom-out, while the chart offers one: the click waiting to zoom in
|
|
153
|
+
* goes, and so does its band.
|
|
154
|
+
*/
|
|
155
|
+
const zoomOut = onZoomOut
|
|
156
|
+
? () => {
|
|
157
|
+
cancelPendingClick();
|
|
158
|
+
clearSelection();
|
|
159
|
+
onZoomOut();
|
|
160
|
+
}
|
|
161
|
+
: undefined;
|
|
162
|
+
const doubleClickReset = useDoubleClickReset(zoomOut);
|
|
163
|
+
/*
|
|
164
|
+
* A click waiting to zoom in was made on a zoomed chart. If the zoom ends
|
|
165
|
+
* by another way first - Reset zoom, the picker, an empty state's own
|
|
166
|
+
* double-click - it must not zoom back in a moment after the reader left.
|
|
167
|
+
* Its band goes too, and so does one a double-click's second press kept
|
|
168
|
+
* for a zoom-out that is no longer coming; a drag's band stays.
|
|
169
|
+
*/
|
|
170
|
+
const offersZoomOut = Boolean(onZoomOut);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (offersZoomOut) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
cancelPendingClick();
|
|
176
|
+
if (!isSelecting.current) {
|
|
177
|
+
clearSelection();
|
|
178
|
+
}
|
|
179
|
+
}, [offersZoomOut, cancelPendingClick, clearSelection]);
|
|
180
|
+
/*
|
|
181
|
+
* Whether the pointer has left the spot the press went down on. Without
|
|
182
|
+
* positions to go by (a caller that hands no event), it has: any change
|
|
183
|
+
* of bar counts, as it always did.
|
|
184
|
+
*/
|
|
185
|
+
const hasPointerMoved = useCallback((event) => {
|
|
186
|
+
const clientX = event === null || event === void 0 ? void 0 : event.clientX;
|
|
187
|
+
if (pressClientX.current === null || typeof clientX !== "number") {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return (Math.abs(clientX - pressClientX.current) > HISTOGRAM_PRESS_STILLNESS_PX);
|
|
191
|
+
}, []);
|
|
192
|
+
/*
|
|
193
|
+
* Takes in what recharts reports during the press (a move, the release):
|
|
194
|
+
* the bar it names at a spot it last named another bar at is new data.
|
|
195
|
+
* Without positions to go by, nothing is concluded.
|
|
196
|
+
*/
|
|
197
|
+
const noteReport = useCallback((label, event) => {
|
|
198
|
+
const clientX = event === null || event === void 0 ? void 0 : event.clientX;
|
|
199
|
+
if (typeof clientX !== "number") {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const previous = lastReport.current;
|
|
203
|
+
if (previous.clientX === clientX &&
|
|
204
|
+
previous.label !== null &&
|
|
205
|
+
label !== null &&
|
|
206
|
+
label !== previous.label) {
|
|
207
|
+
barsChangedUnderPress.current = true;
|
|
208
|
+
}
|
|
209
|
+
lastReport.current = { clientX: clientX, label: label };
|
|
210
|
+
}, []);
|
|
211
|
+
/*
|
|
212
|
+
* The page-wide release listener is added by a press and calls the
|
|
213
|
+
* newest onMouseUp, whatever the host re-rendered with meanwhile.
|
|
214
|
+
*/
|
|
215
|
+
const onMouseUpRef = useRef(() => { });
|
|
216
|
+
/*
|
|
217
|
+
* Readers routinely drag past the edge of a 120px-tall chart and let go
|
|
218
|
+
* outside it, where the chart's own mouseup never fires. Listen on the
|
|
219
|
+
* page until the press ends; a release over the chart reaches the
|
|
220
|
+
* chart's handler first, which removes this listener before the page
|
|
221
|
+
* hears it. The page's release carries no bar, but it does carry where
|
|
222
|
+
* the pointer is and the click count.
|
|
223
|
+
*/
|
|
224
|
+
const listenForReleaseOffChart = useCallback(() => {
|
|
225
|
+
stopListeningForRelease();
|
|
226
|
+
const finishPressOutsideChart = (event) => {
|
|
227
|
+
onMouseUpRef.current(null, event);
|
|
228
|
+
};
|
|
229
|
+
releaseListener.current = finishPressOutsideChart;
|
|
230
|
+
window.addEventListener("mouseup", finishPressOutsideChart);
|
|
231
|
+
}, [stopListeningForRelease]);
|
|
232
|
+
const onMouseDown = useCallback((state, event) => {
|
|
233
|
+
/*
|
|
234
|
+
* The second press of a double-click on a zoomed chart: the zoom-out,
|
|
235
|
+
* on its release, wherever that is (the page hears a release off the
|
|
236
|
+
* chart, as for a drag below). The first click must not zoom in; its
|
|
237
|
+
* band stays until the zoom-out clears it, because this press may
|
|
238
|
+
* have landed on it and a render now would take that node away.
|
|
239
|
+
*/
|
|
240
|
+
if (doubleClickReset.onPress(event)) {
|
|
241
|
+
cancelPendingClick();
|
|
242
|
+
isSelecting.current = false;
|
|
243
|
+
listenForReleaseOffChart();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
73
246
|
const label = toLabel(state);
|
|
74
247
|
if (!canSelect || !label) {
|
|
75
248
|
return;
|
|
76
249
|
}
|
|
77
|
-
//
|
|
250
|
+
// Only the main button selects: a right-click opens a context menu.
|
|
251
|
+
if (event && typeof event.button === "number" && event.button > 0) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
/*
|
|
255
|
+
* A second press before the first click zoomed replaces it. The
|
|
256
|
+
* band that click painted stays until this press ends: this may be
|
|
257
|
+
* the second click of a double-click, landing on that band.
|
|
258
|
+
*/
|
|
78
259
|
cancelPendingClick();
|
|
79
260
|
isSelecting.current = true;
|
|
261
|
+
hasLeftPressedBar.current = false;
|
|
80
262
|
startLabel.current = label;
|
|
81
263
|
endLabel.current = null;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
264
|
+
pressClientX.current =
|
|
265
|
+
typeof (event === null || event === void 0 ? void 0 : event.clientX) === "number" ? event.clientX : null;
|
|
266
|
+
pressAxisIndex.current = toAxisIndex(state);
|
|
267
|
+
lastReport.current = { clientX: pressClientX.current, label: label };
|
|
268
|
+
barsChangedUnderPress.current = false;
|
|
269
|
+
listenForReleaseOffChart();
|
|
270
|
+
}, [canSelect, cancelPendingClick, doubleClickReset, listenForReleaseOffChart]);
|
|
271
|
+
const onMouseMove = useCallback((state, event) => {
|
|
87
272
|
const label = toLabel(state);
|
|
88
|
-
|
|
273
|
+
const from = startLabel.current;
|
|
274
|
+
if (!isSelecting.current || !from) {
|
|
89
275
|
return;
|
|
90
276
|
}
|
|
277
|
+
noteReport(label, event);
|
|
278
|
+
if (!label) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!hasLeftPressedBar.current) {
|
|
282
|
+
// Still on the pressed bar: a click so far, so paint nothing.
|
|
283
|
+
if (label === from) {
|
|
284
|
+
endLabel.current = label;
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
/*
|
|
288
|
+
* Another bar under a pointer that has not really moved: new bars
|
|
289
|
+
* landed under the press, or a hand's drift crossed the edge of the
|
|
290
|
+
* bar it pressed. Not a drag.
|
|
291
|
+
*/
|
|
292
|
+
if (!hasPointerMoved(event)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
91
296
|
endLabel.current = label;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
297
|
+
hasLeftPressedBar.current = true;
|
|
298
|
+
const [first, last] = inTimeOrder(from, label);
|
|
299
|
+
setSelectionStart(first);
|
|
300
|
+
setSelectionEnd(last);
|
|
301
|
+
setIsDragging(true);
|
|
302
|
+
}, [hasPointerMoved, noteReport]);
|
|
303
|
+
const onMouseUp = useCallback((state, event) => {
|
|
95
304
|
var _a;
|
|
305
|
+
// The end of a double-click's second press: the zoom-out, nothing else.
|
|
306
|
+
if (doubleClickReset.onRelease(event)) {
|
|
307
|
+
stopListeningForRelease();
|
|
308
|
+
/*
|
|
309
|
+
* Ended by a later click's release, its own having never come: no
|
|
310
|
+
* zoom-out follows, so the band the first click painted, kept for
|
|
311
|
+
* one, goes now.
|
|
312
|
+
*/
|
|
313
|
+
if (!doubleClickReset.willReset()) {
|
|
314
|
+
clearSelection();
|
|
315
|
+
}
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
96
318
|
if (!isSelecting.current) {
|
|
97
319
|
return;
|
|
98
320
|
}
|
|
99
321
|
isSelecting.current = false;
|
|
322
|
+
stopListeningForRelease();
|
|
100
323
|
setIsDragging(false);
|
|
101
324
|
const from = startLabel.current;
|
|
102
|
-
const
|
|
325
|
+
const releaseLabel = toLabel(state);
|
|
326
|
+
let to = from;
|
|
327
|
+
noteReport(releaseLabel, event);
|
|
328
|
+
if (hasLeftPressedBar.current || hasPointerMoved(event)) {
|
|
329
|
+
// A drag, or a flick released before any of its moves came in.
|
|
330
|
+
to = releaseLabel || endLabel.current || from;
|
|
331
|
+
}
|
|
332
|
+
else if (releaseLabel !== null && releaseLabel !== from) {
|
|
333
|
+
/*
|
|
334
|
+
* The pointer stayed put, yet another bar is under it. When a bar
|
|
335
|
+
* changed under the pointer without it moving (see lastReport), or
|
|
336
|
+
* the spot on the axis it pressed now holds another bar, the
|
|
337
|
+
* chart's data changed during the press and the pressed bar is
|
|
338
|
+
* gone (recharts also clamps a stale spot onto the last bar of
|
|
339
|
+
* shorter data): not a drag the reader never made, nor a zoom into
|
|
340
|
+
* a bar that is no longer shown.
|
|
341
|
+
*/
|
|
342
|
+
const sameSpotOnAxis = pressAxisIndex.current !== null &&
|
|
343
|
+
toAxisIndex(state) === pressAxisIndex.current;
|
|
344
|
+
if (barsChangedUnderPress.current || sameSpotOnAxis) {
|
|
345
|
+
clearSelection();
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/*
|
|
350
|
+
* Otherwise a press that stayed put is a click on the bar it pressed,
|
|
351
|
+
* even when a hand's drift let it go over the next one.
|
|
352
|
+
*/
|
|
103
353
|
if (!from || !to) {
|
|
104
354
|
clearSelection();
|
|
105
355
|
return;
|
|
@@ -128,6 +378,7 @@ const useHistogramRangeSelection = (options) => {
|
|
|
128
378
|
* to open.
|
|
129
379
|
*/
|
|
130
380
|
endLabel.current = to;
|
|
381
|
+
setSelectionStart(from);
|
|
131
382
|
setSelectionEnd(to);
|
|
132
383
|
pendingClick.current = setTimeout(() => {
|
|
133
384
|
var _a;
|
|
@@ -135,31 +386,43 @@ const useHistogramRangeSelection = (options) => {
|
|
|
135
386
|
clearSelection();
|
|
136
387
|
(_a = onTimeRangeSelectRef.current) === null || _a === void 0 ? void 0 : _a.call(onTimeRangeSelectRef, selected.startTime, selected.endTime);
|
|
137
388
|
}, DOUBLE_CLICK_DISAMBIGUATION_MS);
|
|
138
|
-
}, [
|
|
389
|
+
}, [
|
|
390
|
+
bucketIntervalMs,
|
|
391
|
+
clearSelection,
|
|
392
|
+
doubleClickReset,
|
|
393
|
+
hasPointerMoved,
|
|
394
|
+
noteReport,
|
|
395
|
+
onZoomOut,
|
|
396
|
+
stopListeningForRelease,
|
|
397
|
+
]);
|
|
398
|
+
onMouseUpRef.current = onMouseUp;
|
|
139
399
|
const onDoubleClick = useCallback(() => {
|
|
400
|
+
// Neither click of a double-click zooms in, whatever else it does.
|
|
140
401
|
if (cancelPendingClick()) {
|
|
141
402
|
clearSelection();
|
|
142
403
|
}
|
|
143
|
-
|
|
144
|
-
}, [cancelPendingClick, clearSelection,
|
|
404
|
+
doubleClickReset.onDoubleClick();
|
|
405
|
+
}, [cancelPendingClick, clearSelection, doubleClickReset]);
|
|
145
406
|
/*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
407
|
+
* A press on a box standing in for the chart. It has no bars to select;
|
|
408
|
+
* only the second press of a double-click counts, and its release - on
|
|
409
|
+
* the chart that replaced the box by then, or anywhere on the page -
|
|
410
|
+
* zooms out as the chart's own would.
|
|
150
411
|
*/
|
|
151
|
-
|
|
152
|
-
if (!
|
|
153
|
-
return
|
|
412
|
+
const onPlaceholderMouseDown = useCallback((event) => {
|
|
413
|
+
if (!doubleClickReset.onPress(event)) {
|
|
414
|
+
return;
|
|
154
415
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
416
|
+
cancelPendingClick();
|
|
417
|
+
isSelecting.current = false;
|
|
418
|
+
listenForReleaseOffChart();
|
|
419
|
+
}, [cancelPendingClick, doubleClickReset, listenForReleaseOffChart]);
|
|
420
|
+
const placeholderProps = useMemo(() => {
|
|
421
|
+
return {
|
|
422
|
+
onMouseDown: onPlaceholderMouseDown,
|
|
423
|
+
onDoubleClick: onDoubleClick,
|
|
161
424
|
};
|
|
162
|
-
}, [
|
|
425
|
+
}, [onPlaceholderMouseDown, onDoubleClick]);
|
|
163
426
|
return {
|
|
164
427
|
selectionStart: selectionStart,
|
|
165
428
|
selectionEnd: selectionEnd,
|
|
@@ -168,10 +431,14 @@ const useHistogramRangeSelection = (options) => {
|
|
|
168
431
|
typeof bucketIntervalMs === "number" &&
|
|
169
432
|
Number.isFinite(bucketIntervalMs) &&
|
|
170
433
|
bucketIntervalMs > 0,
|
|
434
|
+
chartRootProps: canSelect
|
|
435
|
+
? SELECTABLE_CHART_ROOT_PROPS
|
|
436
|
+
: INERT_CHART_ROOT_PROPS,
|
|
171
437
|
onMouseDown: onMouseDown,
|
|
172
438
|
onMouseMove: onMouseMove,
|
|
173
439
|
onMouseUp: onMouseUp,
|
|
174
440
|
onDoubleClick: onDoubleClick,
|
|
441
|
+
placeholderProps: placeholderProps,
|
|
175
442
|
};
|
|
176
443
|
};
|
|
177
444
|
export default useHistogramRangeSelection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHistogramRangeSelection.js","sourceRoot":"","sources":["../../../../../../UI/Components/Charts/Utils/useHistogramRangeSelection.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAEL,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAsCnF,SAAS,OAAO,CAAC,KAAoC;IACnD,MAAM,KAAK,GAAgC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,CAAC;IAE9D,IAAI,KAAK,KAAK,SAAS,IAAI,KA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,eAAe,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"useHistogramRangeSelection.js","sourceRoot":"","sources":["../../../../../../UI/Components/Charts/Utils/useHistogramRangeSelection.ts"],"names":[],"mappings":"AAAA,OAAc,EACZ,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,8BAA8B,EAE9B,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,8CAA8C,CAAC;AACtD,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAcnD;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAW,wBAAwB,CAAC;AA0E7E,MAAM,2BAA2B,GAA4B;IAC3D,eAAe,EAAE,gCAAgC;CAClD,CAAC;AAEF,MAAM,sBAAsB,GAA4B,EAAE,CAAC;AAM3D,SAAS,OAAO,CAAC,KAAoC;IACnD,MAAM,KAAK,GAAgC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,CAAC;IAE9D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAQD,SAAS,WAAW,CAAC,KAAoC;IACvD,MAAM,KAAK,GAAuC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,kBAAkB,CAAC;IAE5E,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,S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rC,OAAO;QACT,CAAC;QAED,kBAAkB,EAAE,CAAC;QACrB,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,wBAAwB,EAAE,CAAC;IAC7B,CAAC,EACD,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CACjE,CAAC;IAEJ,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAA8B,EAAE;QACtC,OAAO;YACL,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,aAAa;SAC7B,CAAC;IACJ,CAAC,EAAE,CAAC,sBAAsB,EAAE,aAAa,CAAC,CAAC,CAAC;IAE9C,OAAO;QACL,cAAc,EAAE,cAAc;QAC9B,YAAY,EAAE,YAAY;QAC1B,UAAU,EAAE,UAAU;QACtB,cAAc,EACZ,SAAS;YACT,OAAO,gBAAgB,KAAK,QAAQ;YACpC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACjC,gBAAgB,GAAG,CAAC;QACtB,cAAc,EAAE,SAAS;YACvB,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,sBAAsB;QAC1B,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,WAAW;QACxB,SAAS,EAAE,SAAS;QACpB,aAAa,EAAE,aAAa;QAC5B,gBAAgB,EAAE,gBAAgB;KACnC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -301,6 +301,7 @@ const EntityDropdown = (props) => {
|
|
|
301
301
|
const containerRef = useRef(null);
|
|
302
302
|
const controlRef = useRef(null);
|
|
303
303
|
const inputRef = useRef(null);
|
|
304
|
+
const valueButtonRef = useRef(null);
|
|
304
305
|
const debounceRef = useRef(null);
|
|
305
306
|
const searchSeqRef = useRef(0);
|
|
306
307
|
const [menuPosition, setMenuPosition] = useState(null);
|
|
@@ -370,6 +371,55 @@ const EntityDropdown = (props) => {
|
|
|
370
371
|
document.removeEventListener("mousedown", handle);
|
|
371
372
|
};
|
|
372
373
|
}, []);
|
|
374
|
+
/*
|
|
375
|
+
* The keyboard's side of the click-outside above. Tabbing out of the
|
|
376
|
+
* dropdown - from the input, or on past the last option in the menu - onto
|
|
377
|
+
* the next field used to leave the menu open, and when that field opened a
|
|
378
|
+
* popup of its own (the next dropdown, the Affected Resources picker) the
|
|
379
|
+
* two stacked on top of each other. The menu is a DOM child of the
|
|
380
|
+
* container (laid out fixed, never portalled), so moving between the input,
|
|
381
|
+
* the chips, the menu's tabs and its options stays inside and keeps it open.
|
|
382
|
+
*
|
|
383
|
+
* Only a move onto another element closes it. With no element to go to
|
|
384
|
+
* (relatedTarget null, or the document itself) focus went nowhere in
|
|
385
|
+
* particular - the window lost focus, a press landed on something that
|
|
386
|
+
* takes no focus, the focused option unmounted - and presses are for the
|
|
387
|
+
* listener above to judge.
|
|
388
|
+
*/
|
|
389
|
+
const closeWhenFocusLeaves = (event) => {
|
|
390
|
+
const nextFocused = event.relatedTarget;
|
|
391
|
+
if (!(nextFocused instanceof Element) ||
|
|
392
|
+
event.currentTarget.contains(nextFocused)) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
setIsOpen(false);
|
|
396
|
+
setHighlightedIndex(-1);
|
|
397
|
+
};
|
|
398
|
+
/*
|
|
399
|
+
* A single-select showing its value swaps elements as the menu opens and
|
|
400
|
+
* closes: the value button while closed, the search input while open. Focus
|
|
401
|
+
* meant for the field across that swap has to wait for the element taking
|
|
402
|
+
* over, which is not mounted yet when the swap is asked for. Set by the
|
|
403
|
+
* value button, which hands focus to the search input as the menu opens,
|
|
404
|
+
* and by Escape, which hands it back to the value button as the menu
|
|
405
|
+
* closes (see closeMenuOnEscape). Without it focus went down with the
|
|
406
|
+
* element being replaced, to the page: typing did not search, focus could
|
|
407
|
+
* never leave the dropdown to close the menu (see closeWhenFocusLeaves),
|
|
408
|
+
* and a keyboard user was left outside the field they were working in.
|
|
409
|
+
*/
|
|
410
|
+
const focusFieldAfterSwapRef = useRef(false);
|
|
411
|
+
useLayoutEffect(() => {
|
|
412
|
+
var _a, _b;
|
|
413
|
+
if (!focusFieldAfterSwapRef.current) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
focusFieldAfterSwapRef.current = false;
|
|
417
|
+
if (isOpen) {
|
|
418
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
(_b = valueButtonRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
422
|
+
}, [isOpen]);
|
|
373
423
|
useEffect(() => {
|
|
374
424
|
return () => {
|
|
375
425
|
if (debounceRef.current !== null) {
|
|
@@ -916,7 +966,39 @@ const EntityDropdown = (props) => {
|
|
|
916
966
|
*/
|
|
917
967
|
const placeholderText = props.placeholder || "Select...";
|
|
918
968
|
const showSingleSelectedText = !isMulti && !isOpen && selectedOptions.length > 0;
|
|
919
|
-
|
|
969
|
+
/*
|
|
970
|
+
* Escape while the menu is open closes just the menu, wherever focus is in
|
|
971
|
+
* the dropdown: the search input, or - reached with Tab - an option, one of
|
|
972
|
+
* the menu's tabs or footer buttons, a chip or the Clear button. It is
|
|
973
|
+
* claimed, so Modal's document listener never hears it: that listener
|
|
974
|
+
* closes the whole form and throws away its unsaved edits, which is what
|
|
975
|
+
* Escape on a Tab-reached option used to do while Escape in the input only
|
|
976
|
+
* closed the menu. With the menu already closed Escape is left alone, so
|
|
977
|
+
* the next press still closes the modal.
|
|
978
|
+
*
|
|
979
|
+
* Focus goes back to the field rather than down with the menu's buttons.
|
|
980
|
+
*/
|
|
981
|
+
const closeMenuOnEscape = (event) => {
|
|
982
|
+
var _a;
|
|
983
|
+
if (event.key !== "Escape" || !isOpen) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
event.preventDefault();
|
|
987
|
+
if (!isMulti && selectedOptions.length > 0) {
|
|
988
|
+
/*
|
|
989
|
+
* Closing swaps the search input for the value button, so focus waits
|
|
990
|
+
* for the button to mount (see focusFieldAfterSwapRef).
|
|
991
|
+
*/
|
|
992
|
+
focusFieldAfterSwapRef.current = true;
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
// Focusing the input asks to open the menu; closing it after wins.
|
|
996
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
997
|
+
}
|
|
998
|
+
setIsOpen(false);
|
|
999
|
+
setHighlightedIndex(-1);
|
|
1000
|
+
};
|
|
1001
|
+
return (React.createElement("div", { ref: containerRef, id: props.id, className: props.className || "relative mt-2 mb-1 w-full", onBlur: closeWhenFocusLeaves, onKeyDown: closeMenuOnEscape },
|
|
920
1002
|
isMulti && selectedOptions.length > 0 && (React.createElement("div", { className: "mb-2 flex flex-wrap gap-1.5" }, selectedOptions.map((opt) => {
|
|
921
1003
|
const key = valueKey(opt.value);
|
|
922
1004
|
const colorStr = optionColorString(opt);
|
|
@@ -930,13 +1012,12 @@ const EntityDropdown = (props) => {
|
|
|
930
1012
|
React.createElement("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }))))));
|
|
931
1013
|
}))),
|
|
932
1014
|
React.createElement("div", { ref: controlRef, className: "relative" },
|
|
933
|
-
showSingleSelectedText && (React.createElement("button", { type: "button", disabled: props.disabled, "aria-labelledby": props.ariaLabelledby, onClick: () => {
|
|
934
|
-
var _a;
|
|
1015
|
+
showSingleSelectedText && (React.createElement("button", { ref: valueButtonRef, type: "button", disabled: props.disabled, "aria-labelledby": props.ariaLabelledby, onClick: () => {
|
|
935
1016
|
if (props.disabled) {
|
|
936
1017
|
return;
|
|
937
1018
|
}
|
|
1019
|
+
focusFieldAfterSwapRef.current = true;
|
|
938
1020
|
setIsOpen(true);
|
|
939
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
940
1021
|
}, onFocus: () => {
|
|
941
1022
|
var _a;
|
|
942
1023
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
@@ -1030,16 +1111,10 @@ const EntityDropdown = (props) => {
|
|
|
1030
1111
|
}
|
|
1031
1112
|
return;
|
|
1032
1113
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
*/
|
|
1038
|
-
event.preventDefault();
|
|
1039
|
-
setIsOpen(false);
|
|
1040
|
-
setHighlightedIndex(-1);
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1114
|
+
/*
|
|
1115
|
+
* Escape bubbles to the container, which closes the menu for
|
|
1116
|
+
* every control in the dropdown alike (closeMenuOnEscape).
|
|
1117
|
+
*/
|
|
1043
1118
|
if (event.key === "Backspace" &&
|
|
1044
1119
|
searchQuery === "" &&
|
|
1045
1120
|
isMulti &&
|