@oneuptime/common 11.4.0 → 11.5.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/Models/DatabaseModels/AIRun.ts +50 -0
- package/Models/DatabaseModels/AlertSeverity.ts +6 -0
- package/Models/DatabaseModels/IncidentSeverity.ts +6 -0
- package/Models/DatabaseModels/Index.ts +16 -0
- package/Models/DatabaseModels/IoTDeviceCredential.ts +471 -0
- package/Models/DatabaseModels/LlmLog.ts +56 -0
- package/Models/DatabaseModels/LlmProvider.ts +33 -0
- package/Models/DatabaseModels/NetworkDevice.ts +1385 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +717 -0
- package/Models/DatabaseModels/NetworkDeviceLabelRule.ts +514 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerRule.ts +596 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerTeam.ts +487 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerUser.ts +486 -0
- package/Models/DatabaseModels/NetworkInterface.ts +563 -0
- package/Models/DatabaseModels/Project.ts +145 -0
- package/Models/DatabaseModels/TelemetryEntityRelationship.ts +54 -0
- package/Server/API/AIAgentTaskAPI.ts +10 -24
- package/Server/API/AIInvestigationAPI.ts +131 -63
- package/Server/API/AlertAPI.ts +5 -0
- package/Server/API/IncidentAPI.ts +10 -0
- package/Server/API/IncidentEpisodeAPI.ts +5 -0
- package/Server/API/LlmProviderAPI.ts +4 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +5 -0
- package/Server/API/TelemetryAPI.ts +4 -3
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.ts +15 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.ts +192 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.ts +37 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.ts +79 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +24 -0
- package/Server/Services/AIAgentTaskService.ts +62 -0
- package/Server/Services/AIRunService.ts +58 -0
- package/Server/Services/AIService.ts +101 -0
- package/Server/Services/AnalyticsDatabaseService.ts +27 -0
- package/Server/Services/IncidentService.ts +14 -41
- package/Server/Services/Index.ts +14 -0
- package/Server/Services/IoTDeviceCredentialService.ts +351 -0
- package/Server/Services/IoTDeviceService.ts +64 -21
- package/Server/Services/LlmLogService.ts +26 -0
- package/Server/Services/LlmProviderService.ts +3 -0
- package/Server/Services/LogAggregationService.ts +29 -11
- package/Server/Services/MetricService.ts +603 -13
- package/Server/Services/MonitorService.ts +4 -1
- package/Server/Services/NetworkDeviceDiscoveryScanService.ts +10 -0
- package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +204 -0
- package/Server/Services/NetworkDeviceLabelRuleService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +222 -0
- package/Server/Services/NetworkDeviceOwnerRuleService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerTeamService.ts +10 -0
- package/Server/Services/NetworkDeviceOwnerUserService.ts +10 -0
- package/Server/Services/NetworkDeviceService.ts +50 -0
- package/Server/Services/NetworkInterfaceService.ts +10 -0
- package/Server/Services/TelemetryEntityRelationshipService.ts +23 -0
- package/Server/Services/TelemetryEntityService.ts +72 -2
- package/Server/Utils/AI/Sentinel/AlertInvestigationRunner.ts +244 -12
- package/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.ts +92 -19
- package/Server/Utils/AI/Sentinel/InvestigationQueue.ts +493 -0
- package/Server/Utils/AI/Sentinel/README.md +10 -0
- package/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.ts +88 -68
- package/Server/Utils/AI/Toolbox/Index.ts +2 -1
- package/Server/Utils/AI/Toolbox/MetricTools.ts +391 -0
- package/Server/Utils/LLM/LLMService.ts +21 -0
- package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +44 -0
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +170 -2
- package/Server/Utils/Monitor/IoTDeviceAbsenceSeries.ts +101 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +1 -1
- package/Server/Utils/Monitor/MonitorIncident.ts +19 -3
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +195 -2
- package/Server/Utils/Monitor/MonitorResource.ts +77 -21
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +1 -1
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +201 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +215 -0
- package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +169 -0
- package/Tests/Server/Services/AIAgentTaskServiceClaim.test.ts +146 -0
- package/Tests/Server/Services/AIServiceDailyBudget.test.ts +173 -0
- package/Tests/Server/Services/IncidentInternalNoteAnnouncement.test.ts +97 -0
- package/Tests/Server/Services/IoTDeviceService.test.ts +54 -0
- package/Tests/Server/Services/LogAggregationService.test.ts +22 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +194 -0
- package/Tests/Server/Utils/AI/BaselineAnomalyTool.test.ts +253 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +44 -0
- package/Tests/Server/Utils/AI/SentinelAlertGating.test.ts +360 -0
- package/Tests/Server/Utils/AI/SentinelInvestigationQueue.test.ts +295 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +59 -0
- package/Tests/Server/Utils/Monitor/IoTDeviceAbsenceSeries.test.ts +113 -0
- package/Tests/Server/Utils/Monitor/PerSeriesRecoveryResolution.test.ts +198 -0
- package/Tests/Types/AI/AIAgentTaskStatus.test.ts +86 -0
- package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +127 -0
- package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.test.ts +152 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +1 -1
- package/Tests/Types/Trace/TraceRecordingRuleDefinition.test.ts +308 -0
- package/Tests/UI/Components/Dropdown.test.tsx +17 -0
- package/Tests/UI/Components/EntityDropdown.test.tsx +130 -0
- package/Tests/UI/Components/Modal.test.tsx +144 -2
- package/Tests/UI/Components/TelemetrySearchBar.test.tsx +90 -0
- package/Tests/UI/Utils/Theme.test.ts +161 -0
- package/Tests/Utils/Monitor/LatencyMatrixUtil.test.ts +111 -0
- package/Types/AI/AIRunStatus.ts +9 -0
- package/Types/BaseDatabase/AggregateBy.ts +12 -0
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.ts +24 -0
- package/Types/Dashboard/DashboardTemplates.ts +9 -1
- package/Types/LlmLogStatus.ts +1 -0
- package/Types/Monitor/CriteriaFilter.ts +9 -0
- package/Types/Monitor/HttpPhaseTimings.ts +16 -0
- package/Types/Monitor/IotAlertTemplates.ts +22 -3
- package/Types/Monitor/LatencyMatrix.ts +27 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +2 -2
- package/Types/Monitor/MonitorMetricType.ts +27 -0
- package/Types/Monitor/MonitorStep.ts +36 -11
- package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +55 -0
- package/Types/Monitor/MonitorStepSnmpMonitor.ts +8 -0
- package/Types/Monitor/MonitorType.ts +14 -9
- package/Types/Monitor/PingMonitor/PingMonitorResponse.ts +20 -0
- package/Types/Monitor/SnmpMonitor/LldpNeighbor.ts +12 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +116 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +29 -0
- package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +31 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +24 -0
- package/Types/Monitor/SnmpMonitor/SnmpTrap.ts +20 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +173 -0
- package/Types/Permission.ts +314 -0
- package/Types/Probe/ProbeMonitorResponse.ts +22 -0
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +8 -5
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +4 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +6 -3
- package/UI/Components/CodeBlock/CodeBlock.tsx +2 -1
- package/UI/Components/CodeEditor/CodeEditor.tsx +3 -0
- package/UI/Components/Divider/Divider.tsx +1 -1
- package/UI/Components/Dropdown/Dropdown.tsx +13 -4
- package/UI/Components/EntityDropdown/EntityDropdown.tsx +110 -2
- package/UI/Components/ErrorBoundary.tsx +2 -1
- package/UI/Components/EventItem/EventItem.tsx +2 -2
- package/UI/Components/GanttChart/Bar/Index.tsx +1 -1
- package/UI/Components/Graphs/UptimeBarTooltip.tsx +30 -23
- package/UI/Components/Header/Header.tsx +7 -0
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +2 -0
- package/UI/Components/Icon/Icon.tsx +8 -6
- package/UI/Components/Label/Label.tsx +2 -2
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +22 -10
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +9 -3
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +8 -8
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +44 -20
- package/UI/Components/Modal/ConfirmModal.tsx +1 -1
- package/UI/Components/Modal/Modal.tsx +213 -121
- package/UI/Components/Modal/ModalFooter.tsx +33 -22
- package/UI/Components/ModelTable/TableView.tsx +1 -1
- package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +20 -12
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +2 -2
- package/UI/Components/Pill/Pill.tsx +21 -13
- package/UI/Components/StatusBubble/StatusBubble.tsx +3 -3
- package/UI/Components/Tabs/Tabs.tsx +10 -1
- package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +7 -1
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +9 -3
- package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +62 -4
- package/UI/Components/Workflow/Component.tsx +53 -33
- package/UI/Components/Workflow/ComponentPortViewer.tsx +6 -6
- package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +8 -8
- package/UI/Components/Workflow/ComponentsModal.tsx +16 -9
- package/UI/Components/Workflow/Workflow.tsx +13 -11
- package/UI/Utils/Navigation.ts +10 -1
- package/UI/Utils/Theme.ts +140 -0
- package/Utils/Dashboard/Components/DashboardLogChartComponent.ts +99 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/Monitor/LatencyMatrixUtil.ts +162 -0
- package/Utils/Monitor/MonitorMetricType.ts +141 -3
- package/Utils/Monitor/NetworkTopologyUtil.ts +159 -0
- package/Utils/Telemetry/EntityRelationship.ts +11 -0
- package/build/dist/Models/DatabaseModels/AIRun.js +52 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertSeverity.js +6 -0
- package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js +6 -0
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +16 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js +493 -0
- package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js +58 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmProvider.js +33 -0
- package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +1426 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +738 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js +503 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js +502 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +589 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Project.js +147 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js +57 -0
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +8 -23
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +95 -55
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +5 -0
- package/build/dist/Server/API/AlertAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +10 -0
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +5 -0
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +5 -7
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +5 -0
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js +51 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js +101 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIAgentTaskService.js +59 -0
- package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +33 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +82 -9
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +19 -0
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +14 -25
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +14 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/IoTDeviceCredentialService.js +321 -0
- package/build/dist/Server/Services/IoTDeviceCredentialService.js.map +1 -0
- package/build/dist/Server/Services/IoTDeviceService.js +49 -15
- package/build/dist/Server/Services/IoTDeviceService.js.map +1 -1
- package/build/dist/Server/Services/LlmLogService.js +29 -0
- package/build/dist/Server/Services/LlmLogService.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +3 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/LogAggregationService.js +21 -7
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +449 -7
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +2 -1
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +166 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js +13 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +186 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceService.js +52 -0
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -0
- package/build/dist/Server/Services/NetworkInterfaceService.js +9 -0
- package/build/dist/Server/Services/NetworkInterfaceService.js.map +1 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +22 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryEntityService.js +64 -2
- package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js +189 -9
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js +84 -17
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js +428 -0
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js +63 -47
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +2 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +300 -0
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +16 -0
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +29 -0
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +130 -2
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js +81 -0
- package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +18 -7
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -10
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +155 -5
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +76 -30
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +147 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +167 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +93 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +9 -0
- package/build/dist/Types/AI/AIRunStatus.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +9 -1
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/LlmLogStatus.js +1 -0
- package/build/dist/Types/LlmLogStatus.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +9 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/HttpPhaseTimings.js +2 -0
- package/build/dist/Types/Monitor/HttpPhaseTimings.js.map +1 -0
- package/build/dist/Types/Monitor/IotAlertTemplates.js +7 -7
- package/build/dist/Types/Monitor/IotAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/LatencyMatrix.js +2 -0
- package/build/dist/Types/Monitor/LatencyMatrix.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +2 -2
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorMetricType.js +24 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +22 -9
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +36 -0
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js +3 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +14 -9
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +89 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +137 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -0
- package/build/dist/Types/Permission.js +280 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +7 -4
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +4 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +3 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/Divider/Divider.js +1 -1
- package/build/dist/UI/Components/Divider/Divider.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +10 -4
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js +76 -3
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js.map +1 -1
- package/build/dist/UI/Components/ErrorBoundary.js +2 -1
- package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
- package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
- package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
- package/build/dist/UI/Components/GanttChart/Bar/Index.js +1 -1
- package/build/dist/UI/Components/GanttChart/Bar/Index.js.map +1 -1
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +29 -23
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
- package/build/dist/UI/Components/Header/Header.js +1 -0
- package/build/dist/UI/Components/Header/Header.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +8 -6
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Label/Label.js +2 -2
- package/build/dist/UI/Components/Label/Label.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +20 -8
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +8 -2
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +8 -8
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +40 -20
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Modal/ConfirmModal.js +1 -1
- package/build/dist/UI/Components/Modal/ConfirmModal.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +109 -51
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js +13 -10
- package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +17 -12
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +2 -2
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/Pill/Pill.js +12 -13
- package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js +3 -3
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tabs.js +3 -1
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -2
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +36 -6
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Component.js +43 -33
- package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +6 -6
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +8 -8
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +15 -9
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Workflow.js +13 -11
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +11 -1
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/Theme.js +106 -0
- package/build/dist/UI/Utils/Theme.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js +89 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/Monitor/LatencyMatrixUtil.js +89 -0
- package/build/dist/Utils/Monitor/LatencyMatrixUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js +138 -4
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +112 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityRelationship.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,8 +36,9 @@ const getCategoryColors: (
|
|
|
36
36
|
): CategoryColorScheme => {
|
|
37
37
|
if (componentType === ComponentType.Trigger) {
|
|
38
38
|
return {
|
|
39
|
-
bg: "#
|
|
40
|
-
border:
|
|
39
|
+
bg: "color-mix(in srgb, #f59e0b 12%, var(--ou-surface-primary, #ffffff))",
|
|
40
|
+
border:
|
|
41
|
+
"color-mix(in srgb, #f59e0b 38%, var(--ou-border-default, #e5e7eb))",
|
|
41
42
|
headerBg: "linear-gradient(135deg, #f59e0b, #d97706)",
|
|
42
43
|
headerText: "#ffffff",
|
|
43
44
|
iconColor: "#ffffff",
|
|
@@ -52,8 +53,9 @@ const getCategoryColors: (
|
|
|
52
53
|
|
|
53
54
|
if (lowerCategory.includes("condition") || lowerCategory.includes("logic")) {
|
|
54
55
|
return {
|
|
55
|
-
bg: "#
|
|
56
|
-
border:
|
|
56
|
+
bg: "color-mix(in srgb, #a855f7 12%, var(--ou-surface-primary, #ffffff))",
|
|
57
|
+
border:
|
|
58
|
+
"color-mix(in srgb, #a855f7 38%, var(--ou-border-default, #e5e7eb))",
|
|
57
59
|
headerBg: "linear-gradient(135deg, #a855f7, #7c3aed)",
|
|
58
60
|
headerText: "#ffffff",
|
|
59
61
|
iconColor: "#ffffff",
|
|
@@ -66,8 +68,9 @@ const getCategoryColors: (
|
|
|
66
68
|
|
|
67
69
|
if (lowerCategory.includes("api") || lowerCategory.includes("webhook")) {
|
|
68
70
|
return {
|
|
69
|
-
bg: "#
|
|
70
|
-
border:
|
|
71
|
+
bg: "color-mix(in srgb, #3b82f6 12%, var(--ou-surface-primary, #ffffff))",
|
|
72
|
+
border:
|
|
73
|
+
"color-mix(in srgb, #3b82f6 38%, var(--ou-border-default, #e5e7eb))",
|
|
71
74
|
headerBg: "linear-gradient(135deg, #3b82f6, #2563eb)",
|
|
72
75
|
headerText: "#ffffff",
|
|
73
76
|
iconColor: "#ffffff",
|
|
@@ -87,8 +90,9 @@ const getCategoryColors: (
|
|
|
87
90
|
lowerCategory.includes("notification")
|
|
88
91
|
) {
|
|
89
92
|
return {
|
|
90
|
-
bg: "#
|
|
91
|
-
border:
|
|
93
|
+
bg: "color-mix(in srgb, #10b981 12%, var(--ou-surface-primary, #ffffff))",
|
|
94
|
+
border:
|
|
95
|
+
"color-mix(in srgb, #10b981 38%, var(--ou-border-default, #e5e7eb))",
|
|
92
96
|
headerBg: "linear-gradient(135deg, #10b981, #059669)",
|
|
93
97
|
headerText: "#ffffff",
|
|
94
98
|
iconColor: "#ffffff",
|
|
@@ -105,8 +109,9 @@ const getCategoryColors: (
|
|
|
105
109
|
lowerCategory.includes("custom")
|
|
106
110
|
) {
|
|
107
111
|
return {
|
|
108
|
-
bg: "#
|
|
109
|
-
border:
|
|
112
|
+
bg: "color-mix(in srgb, #ef4444 12%, var(--ou-surface-primary, #ffffff))",
|
|
113
|
+
border:
|
|
114
|
+
"color-mix(in srgb, #ef4444 38%, var(--ou-border-default, #e5e7eb))",
|
|
110
115
|
headerBg: "linear-gradient(135deg, #ef4444, #dc2626)",
|
|
111
116
|
headerText: "#ffffff",
|
|
112
117
|
iconColor: "#ffffff",
|
|
@@ -119,8 +124,9 @@ const getCategoryColors: (
|
|
|
119
124
|
|
|
120
125
|
if (lowerCategory.includes("json") || lowerCategory.includes("util")) {
|
|
121
126
|
return {
|
|
122
|
-
bg: "#
|
|
123
|
-
border:
|
|
127
|
+
bg: "color-mix(in srgb, #22c55e 12%, var(--ou-surface-primary, #ffffff))",
|
|
128
|
+
border:
|
|
129
|
+
"color-mix(in srgb, #22c55e 38%, var(--ou-border-default, #e5e7eb))",
|
|
124
130
|
headerBg: "linear-gradient(135deg, #22c55e, #16a34a)",
|
|
125
131
|
headerText: "#ffffff",
|
|
126
132
|
iconColor: "#ffffff",
|
|
@@ -137,8 +143,9 @@ const getCategoryColors: (
|
|
|
137
143
|
lowerCategory.includes("timer")
|
|
138
144
|
) {
|
|
139
145
|
return {
|
|
140
|
-
bg: "#
|
|
141
|
-
border:
|
|
146
|
+
bg: "color-mix(in srgb, #f97316 12%, var(--ou-surface-primary, #ffffff))",
|
|
147
|
+
border:
|
|
148
|
+
"color-mix(in srgb, #f97316 38%, var(--ou-border-default, #e5e7eb))",
|
|
142
149
|
headerBg: "linear-gradient(135deg, #f97316, #ea580c)",
|
|
143
150
|
headerText: "#ffffff",
|
|
144
151
|
iconColor: "#ffffff",
|
|
@@ -151,8 +158,8 @@ const getCategoryColors: (
|
|
|
151
158
|
|
|
152
159
|
// Default / database models
|
|
153
160
|
return {
|
|
154
|
-
bg: "#f8fafc",
|
|
155
|
-
border: "#e2e8f0",
|
|
161
|
+
bg: "var(--ou-surface-secondary, #f8fafc)",
|
|
162
|
+
border: "var(--ou-border-default, #e2e8f0)",
|
|
156
163
|
headerBg: "linear-gradient(135deg, #6366f1, #4f46e5)",
|
|
157
164
|
headerText: "#ffffff",
|
|
158
165
|
iconColor: "#ffffff",
|
|
@@ -223,8 +230,14 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
223
230
|
style={{
|
|
224
231
|
width: "16rem",
|
|
225
232
|
borderRadius: "12px",
|
|
226
|
-
border: `2px dashed ${
|
|
227
|
-
|
|
233
|
+
border: `2px dashed ${
|
|
234
|
+
isHovering
|
|
235
|
+
? "var(--ou-text-subtle, #94a3b8)"
|
|
236
|
+
: "var(--ou-border-strong, #cbd5e1)"
|
|
237
|
+
}`,
|
|
238
|
+
backgroundColor: isHovering
|
|
239
|
+
? "var(--ou-surface-secondary, #f8fafc)"
|
|
240
|
+
: "var(--ou-surface-primary, #ffffff)",
|
|
228
241
|
padding: "1.5rem",
|
|
229
242
|
display: "flex",
|
|
230
243
|
flexDirection: "column",
|
|
@@ -245,7 +258,9 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
245
258
|
width: "2.5rem",
|
|
246
259
|
height: "2.5rem",
|
|
247
260
|
borderRadius: "50%",
|
|
248
|
-
backgroundColor: isHovering
|
|
261
|
+
backgroundColor: isHovering
|
|
262
|
+
? "var(--ou-border-default, #e2e8f0)"
|
|
263
|
+
: "var(--ou-surface-tertiary, #f1f5f9)",
|
|
249
264
|
display: "flex",
|
|
250
265
|
alignItems: "center",
|
|
251
266
|
justifyContent: "center",
|
|
@@ -255,7 +270,9 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
255
270
|
<Icon
|
|
256
271
|
icon={IconProp.Add}
|
|
257
272
|
style={{
|
|
258
|
-
color: isHovering
|
|
273
|
+
color: isHovering
|
|
274
|
+
? "var(--ou-text-muted, #64748b)"
|
|
275
|
+
: "var(--ou-text-subtle, #94a3b8)",
|
|
259
276
|
width: "1.25rem",
|
|
260
277
|
height: "1.25rem",
|
|
261
278
|
transition: "all 0.2s ease",
|
|
@@ -264,7 +281,9 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
264
281
|
</div>
|
|
265
282
|
<p
|
|
266
283
|
style={{
|
|
267
|
-
color: isHovering
|
|
284
|
+
color: isHovering
|
|
285
|
+
? "var(--ou-text-muted, #64748b)"
|
|
286
|
+
: "var(--ou-text-subtle, #94a3b8)",
|
|
268
287
|
fontSize: "0.8125rem",
|
|
269
288
|
fontWeight: 500,
|
|
270
289
|
textAlign: "center",
|
|
@@ -302,13 +321,13 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
302
321
|
? colors.selectedBorder
|
|
303
322
|
: colors.border
|
|
304
323
|
}`,
|
|
305
|
-
backgroundColor: "#ffffff",
|
|
324
|
+
backgroundColor: "var(--ou-surface-primary, #ffffff)",
|
|
306
325
|
overflow: "visible",
|
|
307
326
|
boxShadow: props.selected
|
|
308
|
-
? colors.selectedShadow
|
|
327
|
+
? `var(--ou-card-shadow-selected, ${colors.selectedShadow})`
|
|
309
328
|
: isHovering
|
|
310
|
-
?
|
|
311
|
-
:
|
|
329
|
+
? "var(--ou-card-shadow-hover, 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -6px rgba(0, 0, 0, 0.05))"
|
|
330
|
+
: "var(--ou-card-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.05))",
|
|
312
331
|
transition: "all 0.2s ease",
|
|
313
332
|
transform: isHovering ? "translateY(-1px)" : "none",
|
|
314
333
|
position: "relative",
|
|
@@ -364,11 +383,12 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
364
383
|
width: "22px",
|
|
365
384
|
height: "22px",
|
|
366
385
|
borderRadius: "50%",
|
|
367
|
-
backgroundColor:
|
|
386
|
+
backgroundColor:
|
|
387
|
+
"color-mix(in srgb, #ef4444 15%, var(--ou-surface-primary, #ffffff))",
|
|
368
388
|
display: "flex",
|
|
369
389
|
alignItems: "center",
|
|
370
390
|
justifyContent: "center",
|
|
371
|
-
border: "1px solid
|
|
391
|
+
border: "1px solid rgb(248 113 113 / 45%)",
|
|
372
392
|
}}
|
|
373
393
|
>
|
|
374
394
|
<Icon
|
|
@@ -451,8 +471,8 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
451
471
|
style={{
|
|
452
472
|
display: "inline-flex",
|
|
453
473
|
alignItems: "center",
|
|
454
|
-
backgroundColor: "#ffffff",
|
|
455
|
-
border: "1px solid #e2e8f0",
|
|
474
|
+
backgroundColor: "var(--ou-surface-primary, #ffffff)",
|
|
475
|
+
border: "1px solid var(--ou-border-default, #e2e8f0)",
|
|
456
476
|
borderRadius: "6px",
|
|
457
477
|
padding: "0.125rem 0.5rem",
|
|
458
478
|
marginBottom: "0.5rem",
|
|
@@ -460,7 +480,7 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
460
480
|
>
|
|
461
481
|
<span
|
|
462
482
|
style={{
|
|
463
|
-
color: "#64748b",
|
|
483
|
+
color: "var(--ou-text-muted, #64748b)",
|
|
464
484
|
fontSize: "0.6875rem",
|
|
465
485
|
fontWeight: 500,
|
|
466
486
|
fontFamily:
|
|
@@ -475,7 +495,7 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
475
495
|
{/* Description */}
|
|
476
496
|
<p
|
|
477
497
|
style={{
|
|
478
|
-
color: "#64748b",
|
|
498
|
+
color: "var(--ou-text-muted, #64748b)",
|
|
479
499
|
fontSize: "0.75rem",
|
|
480
500
|
lineHeight: "1.125rem",
|
|
481
501
|
margin: 0,
|
|
@@ -504,7 +524,7 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
504
524
|
props.data.metadata.outPorts.length === 1
|
|
505
525
|
? "center"
|
|
506
526
|
: "space-between",
|
|
507
|
-
backgroundColor: "#ffffff",
|
|
527
|
+
backgroundColor: "var(--ou-surface-primary, #ffffff)",
|
|
508
528
|
borderRadius: "0 0 10px 10px",
|
|
509
529
|
}}
|
|
510
530
|
>
|
|
@@ -513,7 +533,7 @@ const Node: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
513
533
|
<Tooltip key={i} text={port.description || ""}>
|
|
514
534
|
<span
|
|
515
535
|
style={{
|
|
516
|
-
color: "#94a3b8",
|
|
536
|
+
color: "var(--ou-text-subtle, #94a3b8)",
|
|
517
537
|
fontSize: "0.6875rem",
|
|
518
538
|
fontWeight: 500,
|
|
519
539
|
}}
|
|
@@ -34,8 +34,8 @@ const ComponentPortViewer: FunctionComponent<ComponentProps> = (
|
|
|
34
34
|
gap: "0.625rem",
|
|
35
35
|
padding: "0.5rem 0.75rem",
|
|
36
36
|
borderRadius: "8px",
|
|
37
|
-
backgroundColor: "#f8fafc",
|
|
38
|
-
border: "1px solid #f1f5f9",
|
|
37
|
+
backgroundColor: "var(--ou-surface-secondary, #f8fafc)",
|
|
38
|
+
border: "1px solid var(--ou-border-subtle, #f1f5f9)",
|
|
39
39
|
marginBottom: "0.375rem",
|
|
40
40
|
}}
|
|
41
41
|
>
|
|
@@ -44,7 +44,7 @@ const ComponentPortViewer: FunctionComponent<ComponentProps> = (
|
|
|
44
44
|
width: "8px",
|
|
45
45
|
height: "8px",
|
|
46
46
|
borderRadius: "50%",
|
|
47
|
-
backgroundColor: "#94a3b8",
|
|
47
|
+
backgroundColor: "var(--ou-text-subtle, #94a3b8)",
|
|
48
48
|
flexShrink: 0,
|
|
49
49
|
}}
|
|
50
50
|
/>
|
|
@@ -53,7 +53,7 @@ const ComponentPortViewer: FunctionComponent<ComponentProps> = (
|
|
|
53
53
|
style={{
|
|
54
54
|
fontSize: "0.8125rem",
|
|
55
55
|
fontWeight: 500,
|
|
56
|
-
color: "#334155",
|
|
56
|
+
color: "var(--ou-text-secondary, #334155)",
|
|
57
57
|
margin: 0,
|
|
58
58
|
lineHeight: "1.25rem",
|
|
59
59
|
}}
|
|
@@ -61,7 +61,7 @@ const ComponentPortViewer: FunctionComponent<ComponentProps> = (
|
|
|
61
61
|
{port.title}
|
|
62
62
|
<span
|
|
63
63
|
style={{
|
|
64
|
-
color: "#94a3b8",
|
|
64
|
+
color: "var(--ou-text-subtle, #94a3b8)",
|
|
65
65
|
fontWeight: 400,
|
|
66
66
|
fontSize: "0.6875rem",
|
|
67
67
|
marginLeft: "0.375rem",
|
|
@@ -76,7 +76,7 @@ const ComponentPortViewer: FunctionComponent<ComponentProps> = (
|
|
|
76
76
|
<p
|
|
77
77
|
style={{
|
|
78
78
|
fontSize: "0.75rem",
|
|
79
|
-
color: "#94a3b8",
|
|
79
|
+
color: "var(--ou-text-subtle, #94a3b8)",
|
|
80
80
|
margin: 0,
|
|
81
81
|
lineHeight: "1rem",
|
|
82
82
|
}}
|
|
@@ -37,8 +37,8 @@ const ComponentReturnValueViewer: FunctionComponent<ComponentProps> = (
|
|
|
37
37
|
gap: "0.625rem",
|
|
38
38
|
padding: "0.5rem 0.75rem",
|
|
39
39
|
borderRadius: "8px",
|
|
40
|
-
backgroundColor: "#f8fafc",
|
|
41
|
-
border: "1px solid #f1f5f9",
|
|
40
|
+
backgroundColor: "var(--ou-surface-secondary, #f8fafc)",
|
|
41
|
+
border: "1px solid var(--ou-border-subtle, #f1f5f9)",
|
|
42
42
|
marginBottom: "0.375rem",
|
|
43
43
|
}}
|
|
44
44
|
>
|
|
@@ -47,7 +47,7 @@ const ComponentReturnValueViewer: FunctionComponent<ComponentProps> = (
|
|
|
47
47
|
style={{
|
|
48
48
|
fontSize: "0.8125rem",
|
|
49
49
|
fontWeight: 500,
|
|
50
|
-
color: "#334155",
|
|
50
|
+
color: "var(--ou-text-secondary, #334155)",
|
|
51
51
|
margin: 0,
|
|
52
52
|
lineHeight: "1.25rem",
|
|
53
53
|
}}
|
|
@@ -55,7 +55,7 @@ const ComponentReturnValueViewer: FunctionComponent<ComponentProps> = (
|
|
|
55
55
|
{returnValue.name}
|
|
56
56
|
<span
|
|
57
57
|
style={{
|
|
58
|
-
color: "#94a3b8",
|
|
58
|
+
color: "var(--ou-text-subtle, #94a3b8)",
|
|
59
59
|
fontWeight: 400,
|
|
60
60
|
fontSize: "0.6875rem",
|
|
61
61
|
marginLeft: "0.375rem",
|
|
@@ -70,7 +70,7 @@ const ComponentReturnValueViewer: FunctionComponent<ComponentProps> = (
|
|
|
70
70
|
<p
|
|
71
71
|
style={{
|
|
72
72
|
fontSize: "0.75rem",
|
|
73
|
-
color: "#94a3b8",
|
|
73
|
+
color: "var(--ou-text-subtle, #94a3b8)",
|
|
74
74
|
margin: 0,
|
|
75
75
|
lineHeight: "1rem",
|
|
76
76
|
}}
|
|
@@ -83,12 +83,12 @@ const ComponentReturnValueViewer: FunctionComponent<ComponentProps> = (
|
|
|
83
83
|
style={{
|
|
84
84
|
fontSize: "0.6875rem",
|
|
85
85
|
fontWeight: 500,
|
|
86
|
-
color: "#6366f1",
|
|
87
|
-
backgroundColor: "#eef2ff",
|
|
86
|
+
color: "var(--ou-link, #6366f1)",
|
|
87
|
+
backgroundColor: "var(--ou-accent-soft, #eef2ff)",
|
|
88
88
|
padding: "0.125rem 0.5rem",
|
|
89
89
|
borderRadius: "100px",
|
|
90
90
|
whiteSpace: "nowrap",
|
|
91
|
-
border: "1px solid #e0e7ff",
|
|
91
|
+
border: "1px solid var(--ou-accent-muted, #e0e7ff)",
|
|
92
92
|
}}
|
|
93
93
|
>
|
|
94
94
|
{returnValue.type}
|
|
@@ -404,7 +404,8 @@ const ComponentsModal: FunctionComponent<ComponentProps> = (
|
|
|
404
404
|
style={{
|
|
405
405
|
width: "28px",
|
|
406
406
|
height: "28px",
|
|
407
|
-
backgroundColor:
|
|
407
|
+
backgroundColor:
|
|
408
|
+
"var(--ou-surface-tertiary, #f1f5f9)",
|
|
408
409
|
}}
|
|
409
410
|
>
|
|
410
411
|
<Icon
|
|
@@ -443,16 +444,16 @@ const ComponentsModal: FunctionComponent<ComponentProps> = (
|
|
|
443
444
|
borderRadius: "10px",
|
|
444
445
|
border: isSelected
|
|
445
446
|
? "2px solid #6366f1"
|
|
446
|
-
: "1px solid #e2e8f0",
|
|
447
|
+
: "1px solid var(--ou-border-default, #e2e8f0)",
|
|
447
448
|
backgroundColor: isSelected
|
|
448
|
-
? "#eef2ff"
|
|
449
|
-
: "#ffffff",
|
|
449
|
+
? "var(--ou-accent-soft, #eef2ff)"
|
|
450
|
+
: "var(--ou-surface-primary, #ffffff)",
|
|
450
451
|
display: "flex",
|
|
451
452
|
alignItems: "flex-start",
|
|
452
453
|
gap: "0.75rem",
|
|
453
454
|
boxShadow: isSelected
|
|
454
455
|
? "0 0 0 3px rgba(99, 102, 241, 0.1)"
|
|
455
|
-
: "0 1px 2px 0 rgba(0, 0, 0, 0.03)",
|
|
456
|
+
: "var(--ou-card-shadow, 0 1px 2px 0 rgba(0, 0, 0, 0.03))",
|
|
456
457
|
}}
|
|
457
458
|
>
|
|
458
459
|
{/* Icon */}
|
|
@@ -463,7 +464,7 @@ const ComponentsModal: FunctionComponent<ComponentProps> = (
|
|
|
463
464
|
borderRadius: "8px",
|
|
464
465
|
backgroundColor: isSelected
|
|
465
466
|
? "#6366f1"
|
|
466
|
-
: "#f1f5f9",
|
|
467
|
+
: "var(--ou-surface-tertiary, #f1f5f9)",
|
|
467
468
|
display: "flex",
|
|
468
469
|
alignItems: "center",
|
|
469
470
|
justifyContent: "center",
|
|
@@ -474,7 +475,9 @@ const ComponentsModal: FunctionComponent<ComponentProps> = (
|
|
|
474
475
|
<Icon
|
|
475
476
|
icon={componentMetadata.iconProp}
|
|
476
477
|
style={{
|
|
477
|
-
color: isSelected
|
|
478
|
+
color: isSelected
|
|
479
|
+
? "#ffffff"
|
|
480
|
+
: "var(--ou-text-muted, #64748b)",
|
|
478
481
|
width: "1rem",
|
|
479
482
|
height: "1rem",
|
|
480
483
|
}}
|
|
@@ -488,7 +491,9 @@ const ComponentsModal: FunctionComponent<ComponentProps> = (
|
|
|
488
491
|
style={{
|
|
489
492
|
fontSize: "0.8125rem",
|
|
490
493
|
fontWeight: 600,
|
|
491
|
-
color: isSelected
|
|
494
|
+
color: isSelected
|
|
495
|
+
? "var(--ou-accent-text, #4338ca)"
|
|
496
|
+
: "var(--ou-text-primary, #1e293b)",
|
|
492
497
|
margin: 0,
|
|
493
498
|
lineHeight: "1.25rem",
|
|
494
499
|
}}
|
|
@@ -521,7 +526,9 @@ const ComponentsModal: FunctionComponent<ComponentProps> = (
|
|
|
521
526
|
<p
|
|
522
527
|
style={{
|
|
523
528
|
fontSize: "0.75rem",
|
|
524
|
-
color: isSelected
|
|
529
|
+
color: isSelected
|
|
530
|
+
? "var(--ou-link, #6366f1)"
|
|
531
|
+
: "var(--ou-text-subtle, #94a3b8)",
|
|
525
532
|
margin: 0,
|
|
526
533
|
marginTop: "2px",
|
|
527
534
|
lineHeight: "1rem",
|
|
@@ -71,8 +71,8 @@ const nodeTypes: NodeTypes = {
|
|
|
71
71
|
|
|
72
72
|
const edgeStyle: React.CSSProperties = {
|
|
73
73
|
strokeWidth: "2px",
|
|
74
|
-
stroke: "#94a3b8",
|
|
75
|
-
color: "#94a3b8",
|
|
74
|
+
stroke: "var(--ou-chart-tick, #94a3b8)",
|
|
75
|
+
color: "var(--ou-chart-tick, #94a3b8)",
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
const selectedEdgeStyle: React.CSSProperties = {
|
|
@@ -411,31 +411,33 @@ const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
411
411
|
minHeight: "600px",
|
|
412
412
|
borderRadius: "8px",
|
|
413
413
|
overflow: "hidden",
|
|
414
|
-
border: "1px solid #e2e8f0",
|
|
414
|
+
border: "1px solid var(--ou-border-default, #e2e8f0)",
|
|
415
415
|
}}
|
|
416
416
|
>
|
|
417
417
|
<style>
|
|
418
418
|
{`
|
|
419
419
|
.react-flow__minimap {
|
|
420
420
|
border-radius: 8px !important;
|
|
421
|
-
border: 1px solid #e2e8f0 !important;
|
|
421
|
+
border: 1px solid var(--ou-border-default, #e2e8f0) !important;
|
|
422
422
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07) !important;
|
|
423
423
|
overflow: hidden !important;
|
|
424
|
-
background: #ffffff !important;
|
|
424
|
+
background: var(--ou-surface-primary, #ffffff) !important;
|
|
425
425
|
}
|
|
426
426
|
.react-flow__controls {
|
|
427
427
|
border-radius: 8px !important;
|
|
428
|
-
border: 1px solid #e2e8f0 !important;
|
|
428
|
+
border: 1px solid var(--ou-border-default, #e2e8f0) !important;
|
|
429
429
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07) !important;
|
|
430
430
|
overflow: hidden !important;
|
|
431
431
|
}
|
|
432
432
|
.react-flow__controls-button {
|
|
433
|
-
border-bottom: 1px solid #f1f5f9 !important;
|
|
433
|
+
border-bottom: 1px solid var(--ou-border-subtle, #f1f5f9) !important;
|
|
434
|
+
background: var(--ou-surface-primary, #ffffff) !important;
|
|
435
|
+
color: var(--ou-text-secondary, #475569) !important;
|
|
434
436
|
width: 32px !important;
|
|
435
437
|
height: 32px !important;
|
|
436
438
|
}
|
|
437
439
|
.react-flow__controls-button:hover {
|
|
438
|
-
background: #f8fafc !important;
|
|
440
|
+
background: var(--ou-surface-secondary, #f8fafc) !important;
|
|
439
441
|
}
|
|
440
442
|
.react-flow__controls-button svg {
|
|
441
443
|
max-width: 14px !important;
|
|
@@ -507,9 +509,9 @@ const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
507
509
|
}
|
|
508
510
|
return "#6366f1";
|
|
509
511
|
}}
|
|
510
|
-
maskColor="rgba(241, 245, 249, 0.7)"
|
|
512
|
+
maskColor="var(--ou-flow-mask, rgba(241, 245, 249, 0.7))"
|
|
511
513
|
style={{
|
|
512
|
-
backgroundColor: "#ffffff",
|
|
514
|
+
backgroundColor: "var(--ou-surface-primary, #ffffff)",
|
|
513
515
|
}}
|
|
514
516
|
/>
|
|
515
517
|
<Controls />
|
|
@@ -517,7 +519,7 @@ const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
|
|
517
519
|
variant={BackgroundVariant.Dots}
|
|
518
520
|
gap={20}
|
|
519
521
|
size={1}
|
|
520
|
-
color="#cbd5e1"
|
|
522
|
+
color="var(--ou-chart-grid, #cbd5e1)"
|
|
521
523
|
/>
|
|
522
524
|
</ReactFlow>
|
|
523
525
|
|
package/UI/Utils/Navigation.ts
CHANGED
|
@@ -102,7 +102,16 @@ abstract class Navigation {
|
|
|
102
102
|
(queryString ? `?${queryString}` : "") +
|
|
103
103
|
window.location.hash;
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
try {
|
|
106
|
+
window.history.replaceState(window.history.state, "", newRelativeUrl);
|
|
107
|
+
} catch {
|
|
108
|
+
/*
|
|
109
|
+
* Safari throws SecurityError when replaceState is called >100
|
|
110
|
+
* times / 30s (e.g. fast typing into a URL-synced search box).
|
|
111
|
+
* React state stays authoritative; the URL re-syncs on the next
|
|
112
|
+
* successful write.
|
|
113
|
+
*/
|
|
114
|
+
}
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
public static getParamByName(
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export enum Theme {
|
|
4
|
+
Light = "light",
|
|
5
|
+
Dark = "dark",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const THEME_STORAGE_KEY: string = "oneuptime-dashboard-theme";
|
|
9
|
+
export const THEME_CHANGE_EVENT: string = "oneuptime:theme-change";
|
|
10
|
+
|
|
11
|
+
const LIGHT_THEME_COLOR: string = "#f9fafb";
|
|
12
|
+
const DARK_THEME_COLOR: string = "#0f172a";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Owns the dashboard theme at the document boundary. The saved preference is
|
|
16
|
+
* deliberately opt-in: a missing, invalid, or inaccessible value is light.
|
|
17
|
+
*/
|
|
18
|
+
export default class ThemeUtil {
|
|
19
|
+
private static hasStorageListener: boolean = false;
|
|
20
|
+
|
|
21
|
+
public static getStoredTheme(): Theme {
|
|
22
|
+
if (typeof window === "undefined") {
|
|
23
|
+
return Theme.Light;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
return window.localStorage.getItem(THEME_STORAGE_KEY) === Theme.Dark
|
|
28
|
+
? Theme.Dark
|
|
29
|
+
: Theme.Light;
|
|
30
|
+
} catch {
|
|
31
|
+
return Theme.Light;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static getAppliedTheme(): Theme {
|
|
36
|
+
if (typeof document === "undefined") {
|
|
37
|
+
return Theme.Light;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return document.documentElement.classList.contains(Theme.Dark)
|
|
41
|
+
? Theme.Dark
|
|
42
|
+
: Theme.Light;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static initialize(): void {
|
|
46
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ThemeUtil.applyTheme(ThemeUtil.getStoredTheme(), false);
|
|
51
|
+
|
|
52
|
+
if (ThemeUtil.hasStorageListener) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
window.addEventListener("storage", (event: StorageEvent): void => {
|
|
57
|
+
if (event.key !== THEME_STORAGE_KEY && event.key !== null) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ThemeUtil.applyTheme(
|
|
62
|
+
event.key === THEME_STORAGE_KEY && event.newValue === Theme.Dark
|
|
63
|
+
? Theme.Dark
|
|
64
|
+
: Theme.Light,
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
ThemeUtil.hasStorageListener = true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public static setTheme(theme: Theme): void {
|
|
71
|
+
if (typeof window !== "undefined") {
|
|
72
|
+
try {
|
|
73
|
+
window.localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
74
|
+
} catch {
|
|
75
|
+
// The visual theme still works when storage is unavailable.
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
ThemeUtil.applyTheme(theme);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public static toggleTheme(): Theme {
|
|
83
|
+
const theme: Theme =
|
|
84
|
+
ThemeUtil.getAppliedTheme() === Theme.Dark ? Theme.Light : Theme.Dark;
|
|
85
|
+
ThemeUtil.setTheme(theme);
|
|
86
|
+
return theme;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private static applyTheme(theme: Theme, notify: boolean = true): void {
|
|
90
|
+
if (typeof document === "undefined") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const isDark: boolean = theme === Theme.Dark;
|
|
95
|
+
const root: HTMLElement = document.documentElement;
|
|
96
|
+
root.classList.toggle(Theme.Dark, isDark);
|
|
97
|
+
root.dataset["theme"] = theme;
|
|
98
|
+
root.style.colorScheme = theme;
|
|
99
|
+
|
|
100
|
+
const themeColor: HTMLMetaElement | null = document.querySelector(
|
|
101
|
+
'meta[name="theme-color"]:not([media])',
|
|
102
|
+
);
|
|
103
|
+
themeColor?.setAttribute(
|
|
104
|
+
"content",
|
|
105
|
+
isDark ? DARK_THEME_COLOR : LIGHT_THEME_COLOR,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (notify && typeof window !== "undefined") {
|
|
109
|
+
window.dispatchEvent(
|
|
110
|
+
new CustomEvent(THEME_CHANGE_EVENT, {
|
|
111
|
+
detail: { theme },
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const subscribeToTheme: (onStoreChange: () => void) => () => void = (
|
|
119
|
+
onStoreChange: () => void,
|
|
120
|
+
): (() => void) => {
|
|
121
|
+
if (typeof window === "undefined") {
|
|
122
|
+
return (): void => {};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
window.addEventListener(THEME_CHANGE_EVENT, onStoreChange);
|
|
126
|
+
return (): void => {
|
|
127
|
+
window.removeEventListener(THEME_CHANGE_EVENT, onStoreChange);
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** Reactively reads the theme applied to the document root. */
|
|
132
|
+
export const useTheme: () => Theme = (): Theme => {
|
|
133
|
+
return React.useSyncExternalStore(
|
|
134
|
+
subscribeToTheme,
|
|
135
|
+
ThemeUtil.getAppliedTheme,
|
|
136
|
+
(): Theme => {
|
|
137
|
+
return Theme.Light;
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
};
|