@oneuptime/common 11.4.0 → 11.4.1

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.
Files changed (178) hide show
  1. package/Server/API/AIAgentTaskAPI.ts +10 -24
  2. package/Server/API/TelemetryAPI.ts +4 -3
  3. package/Server/Services/AIAgentTaskService.ts +62 -0
  4. package/Server/Services/AnalyticsDatabaseService.ts +27 -0
  5. package/Server/Services/LogAggregationService.ts +29 -11
  6. package/Server/Services/MetricService.ts +603 -13
  7. package/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.ts +1 -1
  8. package/Server/Utils/AI/Sentinel/README.md +10 -0
  9. package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +44 -0
  10. package/Server/Utils/Monitor/MonitorMetricUtil.ts +108 -2
  11. package/Tests/Server/Services/AIAgentTaskServiceClaim.test.ts +146 -0
  12. package/Tests/Server/Services/LogAggregationService.test.ts +22 -0
  13. package/Tests/Server/Services/MetricServiceAggregate.test.ts +194 -0
  14. package/Tests/Types/AI/AIAgentTaskStatus.test.ts +86 -0
  15. package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +127 -0
  16. package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.test.ts +152 -0
  17. package/Tests/Types/Trace/TraceRecordingRuleDefinition.test.ts +308 -0
  18. package/Tests/UI/Components/Dropdown.test.tsx +17 -0
  19. package/Tests/UI/Components/EntityDropdown.test.tsx +130 -0
  20. package/Tests/UI/Components/Modal.test.tsx +144 -2
  21. package/Tests/UI/Components/TelemetrySearchBar.test.tsx +90 -0
  22. package/Tests/UI/Utils/Theme.test.ts +161 -0
  23. package/Types/BaseDatabase/AggregateBy.ts +12 -0
  24. package/Types/Dashboard/DashboardComponentType.ts +1 -0
  25. package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
  26. package/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.ts +19 -0
  27. package/Types/Dashboard/DashboardTemplates.ts +9 -1
  28. package/Types/Monitor/CriteriaFilter.ts +4 -0
  29. package/Types/Monitor/HttpPhaseTimings.ts +16 -0
  30. package/Types/Monitor/MonitorMetricType.ts +17 -0
  31. package/Types/Monitor/PingMonitor/PingMonitorResponse.ts +20 -0
  32. package/Types/Probe/ProbeMonitorResponse.ts +14 -0
  33. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +8 -5
  34. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +4 -1
  35. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +6 -3
  36. package/UI/Components/CodeBlock/CodeBlock.tsx +2 -1
  37. package/UI/Components/CodeEditor/CodeEditor.tsx +3 -0
  38. package/UI/Components/Divider/Divider.tsx +1 -1
  39. package/UI/Components/Dropdown/Dropdown.tsx +13 -4
  40. package/UI/Components/EntityDropdown/EntityDropdown.tsx +110 -2
  41. package/UI/Components/ErrorBoundary.tsx +2 -1
  42. package/UI/Components/EventItem/EventItem.tsx +2 -2
  43. package/UI/Components/GanttChart/Bar/Index.tsx +1 -1
  44. package/UI/Components/Graphs/UptimeBarTooltip.tsx +30 -23
  45. package/UI/Components/Header/Header.tsx +7 -0
  46. package/UI/Components/Header/HeaderIconDropdownButton.tsx +2 -0
  47. package/UI/Components/Label/Label.tsx +2 -2
  48. package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +22 -10
  49. package/UI/Components/LogsViewer/components/LogsHistogram.tsx +9 -3
  50. package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +8 -8
  51. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +44 -20
  52. package/UI/Components/Modal/ConfirmModal.tsx +1 -1
  53. package/UI/Components/Modal/Modal.tsx +213 -121
  54. package/UI/Components/Modal/ModalFooter.tsx +33 -22
  55. package/UI/Components/ModelTable/TableView.tsx +1 -1
  56. package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +20 -12
  57. package/UI/Components/Pill/Pill.tsx +21 -13
  58. package/UI/Components/StatusBubble/StatusBubble.tsx +3 -3
  59. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +7 -1
  60. package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +9 -3
  61. package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +62 -4
  62. package/UI/Components/Workflow/Component.tsx +53 -33
  63. package/UI/Components/Workflow/ComponentPortViewer.tsx +6 -6
  64. package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +8 -8
  65. package/UI/Components/Workflow/ComponentsModal.tsx +16 -9
  66. package/UI/Components/Workflow/Workflow.tsx +13 -11
  67. package/UI/Utils/Theme.ts +140 -0
  68. package/Utils/Dashboard/Components/DashboardLogChartComponent.ts +104 -0
  69. package/Utils/Dashboard/Components/Index.ts +7 -0
  70. package/Utils/Monitor/MonitorMetricType.ts +70 -2
  71. package/build/dist/Server/API/AIAgentTaskAPI.js +8 -23
  72. package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
  73. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  74. package/build/dist/Server/Services/AIAgentTaskService.js +59 -0
  75. package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -1
  76. package/build/dist/Server/Services/AnalyticsDatabaseService.js +19 -0
  77. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  78. package/build/dist/Server/Services/LogAggregationService.js +21 -7
  79. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  80. package/build/dist/Server/Services/MetricService.js +449 -7
  81. package/build/dist/Server/Services/MetricService.js.map +1 -1
  82. package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js +1 -1
  83. package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +29 -0
  84. package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js.map +1 -1
  85. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +86 -2
  86. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  87. package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
  88. package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
  89. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
  90. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
  91. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js +2 -0
  92. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js.map +1 -0
  93. package/build/dist/Types/Dashboard/DashboardTemplates.js +9 -1
  94. package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
  95. package/build/dist/Types/Monitor/CriteriaFilter.js +4 -0
  96. package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
  97. package/build/dist/Types/Monitor/HttpPhaseTimings.js +2 -0
  98. package/build/dist/Types/Monitor/HttpPhaseTimings.js.map +1 -0
  99. package/build/dist/Types/Monitor/MonitorMetricType.js +15 -0
  100. package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
  101. package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js +2 -0
  102. package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js.map +1 -0
  103. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +7 -4
  104. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  105. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +4 -1
  106. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  107. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
  108. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  109. package/build/dist/UI/Components/CodeBlock/CodeBlock.js +1 -1
  110. package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
  111. package/build/dist/UI/Components/CodeEditor/CodeEditor.js +3 -1
  112. package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
  113. package/build/dist/UI/Components/Divider/Divider.js +1 -1
  114. package/build/dist/UI/Components/Divider/Divider.js.map +1 -1
  115. package/build/dist/UI/Components/Dropdown/Dropdown.js +10 -4
  116. package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
  117. package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js +76 -3
  118. package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js.map +1 -1
  119. package/build/dist/UI/Components/ErrorBoundary.js +2 -1
  120. package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
  121. package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
  122. package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
  123. package/build/dist/UI/Components/GanttChart/Bar/Index.js +1 -1
  124. package/build/dist/UI/Components/GanttChart/Bar/Index.js.map +1 -1
  125. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +29 -23
  126. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
  127. package/build/dist/UI/Components/Header/Header.js +1 -0
  128. package/build/dist/UI/Components/Header/Header.js.map +1 -1
  129. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -1
  130. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  131. package/build/dist/UI/Components/Label/Label.js +2 -2
  132. package/build/dist/UI/Components/Label/Label.js.map +1 -1
  133. package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +20 -8
  134. package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
  135. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +8 -2
  136. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
  137. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +8 -8
  138. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +40 -20
  139. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
  140. package/build/dist/UI/Components/Modal/ConfirmModal.js +1 -1
  141. package/build/dist/UI/Components/Modal/ConfirmModal.js.map +1 -1
  142. package/build/dist/UI/Components/Modal/Modal.js +109 -51
  143. package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
  144. package/build/dist/UI/Components/Modal/ModalFooter.js +13 -10
  145. package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
  146. package/build/dist/UI/Components/ModelTable/TableView.js +1 -1
  147. package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
  148. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +17 -12
  149. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
  150. package/build/dist/UI/Components/Pill/Pill.js +12 -13
  151. package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
  152. package/build/dist/UI/Components/StatusBubble/StatusBubble.js +3 -3
  153. package/build/dist/UI/Components/StatusBubble/StatusBubble.js.map +1 -1
  154. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +1 -1
  155. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  156. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -2
  157. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
  158. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +36 -6
  159. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
  160. package/build/dist/UI/Components/Workflow/Component.js +43 -33
  161. package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
  162. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +6 -6
  163. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
  164. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +8 -8
  165. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
  166. package/build/dist/UI/Components/Workflow/ComponentsModal.js +15 -9
  167. package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
  168. package/build/dist/UI/Components/Workflow/Workflow.js +13 -11
  169. package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
  170. package/build/dist/UI/Utils/Theme.js +106 -0
  171. package/build/dist/UI/Utils/Theme.js.map +1 -0
  172. package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js +92 -0
  173. package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js.map +1 -0
  174. package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
  175. package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
  176. package/build/dist/Utils/Monitor/MonitorMetricType.js +70 -3
  177. package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
  178. package/package.json +1 -1
@@ -19,6 +19,7 @@ export interface ComponentProps {
19
19
  onClick?: (() => void) | undefined;
20
20
  name: string;
21
21
  showDropdown: boolean;
22
+ isPressed?: boolean | undefined;
22
23
  }
23
24
 
24
25
  const HeaderIconDropdownButton: FunctionComponent<ComponentProps> = (
@@ -53,6 +54,7 @@ const HeaderIconDropdownButton: FunctionComponent<ComponentProps> = (
53
54
  id={hasDropdown ? "user-menu-button" : undefined}
54
55
  aria-expanded={hasDropdown ? isDropdownVisible : undefined}
55
56
  aria-haspopup={hasDropdown ? "true" : undefined}
57
+ aria-pressed={props.isPressed}
56
58
  onClick={() => {
57
59
  props.onClick?.();
58
60
  setIsComponentVisible(!isDropdownVisible);
@@ -1,7 +1,7 @@
1
1
  import React, { CSSProperties, FunctionComponent, ReactElement } from "react";
2
2
  import LabelModel from "../../../Models/DatabaseModels/Label";
3
3
  import Pill, { ComponentProps as PillProps, PillSize } from "../Pill/Pill";
4
- import { Black } from "../../../Types/BrandColors";
4
+ import { Gray500 } from "../../../Types/BrandColors";
5
5
  import Color from "../../../Types/Color";
6
6
  import IconProp from "../../../Types/Icon/IconProp";
7
7
 
@@ -19,7 +19,7 @@ const LabelElement: FunctionComponent<ComponentProps> = (
19
19
 
20
20
  const resolveColor: Color = (() => {
21
21
  if (!label.color) {
22
- return Black;
22
+ return Gray500;
23
23
  }
24
24
 
25
25
  if (typeof label.color === "string") {
@@ -654,21 +654,27 @@ const LogsAnalyticsView: FunctionComponent<LogsAnalyticsViewProps> = (
654
654
  </defs>
655
655
  <CartesianGrid
656
656
  strokeDasharray="none"
657
- stroke="#f1f5f9"
657
+ stroke="var(--ou-chart-grid, #f1f5f9)"
658
658
  vertical={false}
659
659
  />
660
660
  <XAxis
661
661
  dataKey="time"
662
662
  tickFormatter={formatTickTime}
663
- tick={{ fontSize: 11, fill: "#94a3b8" }}
664
- axisLine={{ stroke: "#e2e8f0" }}
663
+ tick={{
664
+ fontSize: 11,
665
+ fill: "var(--ou-chart-tick, #94a3b8)",
666
+ }}
667
+ axisLine={{ stroke: "var(--ou-chart-grid, #e2e8f0)" }}
665
668
  tickLine={false}
666
669
  minTickGap={50}
667
670
  interval="preserveStartEnd"
668
671
  dy={8}
669
672
  />
670
673
  <YAxis
671
- tick={{ fontSize: 11, fill: "#94a3b8" }}
674
+ tick={{
675
+ fontSize: 11,
676
+ fill: "var(--ou-chart-tick, #94a3b8)",
677
+ }}
672
678
  axisLine={false}
673
679
  tickLine={false}
674
680
  width={52}
@@ -678,7 +684,7 @@ const LogsAnalyticsView: FunctionComponent<LogsAnalyticsViewProps> = (
678
684
  <Tooltip
679
685
  content={<AnalyticsTooltip />}
680
686
  cursor={{
681
- stroke: "#c7d2fe",
687
+ stroke: "var(--ou-accent-muted, #c7d2fe)",
682
688
  strokeWidth: 1,
683
689
  strokeDasharray: "4 4",
684
690
  }}
@@ -692,7 +698,7 @@ const LogsAnalyticsView: FunctionComponent<LogsAnalyticsViewProps> = (
692
698
  activeDot={{
693
699
  r: 4,
694
700
  fill: CHART_COLORS[0]!,
695
- stroke: "#fff",
701
+ stroke: "var(--ou-chart-marker-ring, #ffffff)",
696
702
  strokeWidth: 2,
697
703
  }}
698
704
  isAnimationActive={false}
@@ -707,21 +713,27 @@ const LogsAnalyticsView: FunctionComponent<LogsAnalyticsViewProps> = (
707
713
  >
708
714
  <CartesianGrid
709
715
  strokeDasharray="none"
710
- stroke="#f1f5f9"
716
+ stroke="var(--ou-chart-grid, #f1f5f9)"
711
717
  vertical={false}
712
718
  />
713
719
  <XAxis
714
720
  dataKey="time"
715
721
  tickFormatter={formatTickTime}
716
- tick={{ fontSize: 11, fill: "#94a3b8" }}
717
- axisLine={{ stroke: "#e2e8f0" }}
722
+ tick={{
723
+ fontSize: 11,
724
+ fill: "var(--ou-chart-tick, #94a3b8)",
725
+ }}
726
+ axisLine={{ stroke: "var(--ou-chart-grid, #e2e8f0)" }}
718
727
  tickLine={false}
719
728
  minTickGap={50}
720
729
  interval="preserveStartEnd"
721
730
  dy={8}
722
731
  />
723
732
  <YAxis
724
- tick={{ fontSize: 11, fill: "#94a3b8" }}
733
+ tick={{
734
+ fontSize: 11,
735
+ fill: "var(--ou-chart-tick, #94a3b8)",
736
+ }}
725
737
  axisLine={false}
726
738
  tickLine={false}
727
739
  width={52}
@@ -216,15 +216,21 @@ const LogsHistogram: FunctionComponent<LogsHistogramProps> = (
216
216
  <XAxis
217
217
  dataKey="time"
218
218
  tickFormatter={formatTickTime}
219
- tick={{ fontSize: 10, fill: "#9ca3af" }}
220
- axisLine={{ stroke: "#e5e7eb" }}
219
+ tick={{
220
+ fontSize: 10,
221
+ fill: "var(--ou-chart-tick, #9ca3af)",
222
+ }}
223
+ axisLine={{ stroke: "var(--ou-chart-grid, #e5e7eb)" }}
221
224
  tickLine={false}
222
225
  minTickGap={40}
223
226
  dy={4}
224
227
  interval="preserveStartEnd"
225
228
  />
226
229
  <YAxis
227
- tick={{ fontSize: 10, fill: "#9ca3af" }}
230
+ tick={{
231
+ fontSize: 10,
232
+ fill: "var(--ou-chart-tick, #9ca3af)",
233
+ }}
228
234
  axisLine={false}
229
235
  tickLine={false}
230
236
  width={48}
@@ -901,17 +901,17 @@ const MarkdownEditor: FunctionComponent<ComponentProps> = (
901
901
  .oneuptime-wysiwyg ol { list-style-type: decimal; }
902
902
  .oneuptime-wysiwyg ul.task-list, .oneuptime-wysiwyg ul.task-list li { list-style: none; margin-left: 0; }
903
903
  .oneuptime-wysiwyg ul.task-list li { padding-left: 0; }
904
- .oneuptime-wysiwyg blockquote { border-left: 3px solid #d1d5db; padding-left: 0.75rem; color: #4b5563; margin: 0.5rem 0; }
905
- .oneuptime-wysiwyg pre { background: #f3f4f6; border-radius: 0.375rem; padding: 0.75rem; overflow-x: auto; margin: 0.5rem 0; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85rem; }
906
- .oneuptime-wysiwyg code { background: #f3f4f6; padding: 0 0.25rem; border-radius: 0.25rem; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85em; }
904
+ .oneuptime-wysiwyg blockquote { border-left: 3px solid var(--ou-border-strong, #d1d5db); padding-left: 0.75rem; color: var(--ou-text-secondary, #4b5563); margin: 0.5rem 0; }
905
+ .oneuptime-wysiwyg pre { background: var(--ou-surface-tertiary, #f3f4f6); border-radius: 0.375rem; padding: 0.75rem; overflow-x: auto; margin: 0.5rem 0; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85rem; }
906
+ .oneuptime-wysiwyg code { background: var(--ou-surface-tertiary, #f3f4f6); padding: 0 0.25rem; border-radius: 0.25rem; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85em; }
907
907
  .oneuptime-wysiwyg pre code { background: transparent; padding: 0; }
908
- .oneuptime-wysiwyg a { color: #4f46e5; text-decoration: underline; }
909
- .oneuptime-wysiwyg hr { margin: 1rem 0; border: 0; border-top: 1px solid #e5e7eb; }
908
+ .oneuptime-wysiwyg a { color: var(--ou-link, #4f46e5); text-decoration: underline; }
909
+ .oneuptime-wysiwyg hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--ou-border-default, #e5e7eb); }
910
910
  .oneuptime-wysiwyg table { border-collapse: collapse; margin: 0.5rem 0; }
911
- .oneuptime-wysiwyg th, .oneuptime-wysiwyg td { border: 1px solid #e5e7eb; padding: 0.25rem 0.5rem; }
912
- .oneuptime-wysiwyg th { background: #f9fafb; font-weight: 600; }
911
+ .oneuptime-wysiwyg th, .oneuptime-wysiwyg td { border: 1px solid var(--ou-border-default, #e5e7eb); padding: 0.25rem 0.5rem; }
912
+ .oneuptime-wysiwyg th { background: var(--ou-surface-secondary, #f9fafb); font-weight: 600; }
913
913
  .oneuptime-wysiwyg img { max-width: 100%; height: auto; }
914
- .oneuptime-wysiwyg:empty::before { content: attr(data-placeholder); color: #9ca3af; pointer-events: none; }
914
+ .oneuptime-wysiwyg:empty::before { content: attr(data-placeholder); color: var(--ou-text-subtle, #9ca3af); pointer-events: none; }
915
915
  `}</style>
916
916
 
917
917
  {/* Toolbar */}
@@ -70,6 +70,7 @@ SyntaxHighlighter.registerLanguage("http", http);
70
70
  import mermaid from "mermaid";
71
71
  import DOMPurify from "dompurify";
72
72
  import OneUptimeDate from "../../../Types/Date";
73
+ import { Theme, useTheme } from "../../Utils/Theme";
73
74
 
74
75
  /*
75
76
  * ISO 8601 timestamps produced by OneUptimeDate.toString() — the
@@ -80,22 +81,37 @@ import OneUptimeDate from "../../../Types/Date";
80
81
  const ISO_8601_REGEX: RegExp =
81
82
  /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/;
82
83
 
83
- // Initialize mermaid
84
- mermaid.initialize({
85
- startOnLoad: false,
86
- theme: "default",
87
- securityLevel: "strict",
88
- fontFamily: "inherit",
89
- themeVariables: {
90
- background: "#ffffff",
91
- primaryColor: "#e0f2fe",
92
- primaryTextColor: "#1e293b",
93
- primaryBorderColor: "#0ea5e9",
94
- lineColor: "#64748b",
95
- secondaryColor: "#f1f5f9",
96
- tertiaryColor: "#ffffff",
97
- },
98
- });
84
+ const initializeMermaid: (theme: Theme) => void = (theme: Theme): void => {
85
+ const isDark: boolean = theme === Theme.Dark;
86
+
87
+ mermaid.initialize({
88
+ startOnLoad: false,
89
+ theme: isDark ? "dark" : "default",
90
+ securityLevel: "strict",
91
+ fontFamily: "inherit",
92
+ themeVariables: isDark
93
+ ? {
94
+ background: "#111827",
95
+ primaryColor: "#1e3a5f",
96
+ primaryTextColor: "#f8fafc",
97
+ primaryBorderColor: "#38bdf8",
98
+ lineColor: "#94a3b8",
99
+ secondaryColor: "#1e293b",
100
+ tertiaryColor: "#0f172a",
101
+ }
102
+ : {
103
+ background: "#ffffff",
104
+ primaryColor: "#e0f2fe",
105
+ primaryTextColor: "#1e293b",
106
+ primaryBorderColor: "#0ea5e9",
107
+ lineColor: "#64748b",
108
+ secondaryColor: "#f1f5f9",
109
+ tertiaryColor: "#ffffff",
110
+ },
111
+ });
112
+ };
113
+
114
+ initializeMermaid(Theme.Light);
99
115
 
100
116
  // Mermaid diagram component
101
117
  const MermaidDiagram: FunctionComponent<{ chart: string }> = ({
@@ -105,22 +121,26 @@ const MermaidDiagram: FunctionComponent<{ chart: string }> = ({
105
121
  }) => {
106
122
  const containerRef: React.RefObject<HTMLDivElement> =
107
123
  useRef<HTMLDivElement>(null);
124
+ const theme: Theme = useTheme();
108
125
 
109
126
  useEffect(() => {
127
+ let isCancelled: boolean = false;
128
+
110
129
  const renderDiagram: () => Promise<void> = async (): Promise<void> => {
111
130
  if (containerRef.current) {
112
131
  containerRef.current.innerHTML = "";
113
132
  try {
133
+ initializeMermaid(theme);
114
134
  const id: string = `mermaid-${Math.random().toString(36).substr(2, 9)}`;
115
135
  const { svg } = await mermaid.render(id, chart);
116
- if (containerRef.current) {
136
+ if (containerRef.current && !isCancelled) {
117
137
  containerRef.current.innerHTML = DOMPurify.sanitize(svg, {
118
138
  USE_PROFILES: { svg: true, svgFilters: true },
119
139
  ADD_TAGS: ["foreignObject"],
120
140
  });
121
141
  }
122
142
  } catch (error) {
123
- if (containerRef.current) {
143
+ if (containerRef.current && !isCancelled) {
124
144
  const errorMessage: string = String(error);
125
145
  const errorEl: HTMLPreElement = document.createElement("pre");
126
146
  errorEl.className = "text-red-500";
@@ -131,8 +151,12 @@ const MermaidDiagram: FunctionComponent<{ chart: string }> = ({
131
151
  }
132
152
  }
133
153
  };
134
- renderDiagram();
135
- }, [chart]);
154
+ void renderDiagram();
155
+
156
+ return (): void => {
157
+ isCancelled = true;
158
+ };
159
+ }, [chart, theme]);
136
160
 
137
161
  return (
138
162
  <div
@@ -48,7 +48,7 @@ const ConfirmModal: FunctionComponent<ComponentProps> = (
48
48
  >
49
49
  <div
50
50
  data-testid="confirm-modal-description"
51
- className="text-gray-500 mt-5 text-sm whitespace-pre-wrap break-words max-h-96 overflow-y-auto pr-1"
51
+ className="max-h-96 overflow-y-auto whitespace-pre-wrap break-words pr-1 text-sm leading-6 text-gray-600"
52
52
  >
53
53
  {translatedDescription}
54
54
  </div>