@oneuptime/common 7.0.2994 → 7.0.3018

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 (174) hide show
  1. package/Models/AnalyticsModels/ExceptionInstance.ts +488 -0
  2. package/Models/AnalyticsModels/Index.ts +2 -0
  3. package/Models/AnalyticsModels/Span.ts +2 -2
  4. package/Models/DatabaseModels/CopilotAction.ts +232 -38
  5. package/Models/DatabaseModels/CopilotActionTypePriority.ts +325 -0
  6. package/Models/DatabaseModels/Index.ts +6 -0
  7. package/Models/DatabaseModels/TelemetryException.ts +978 -0
  8. package/Server/API/CopilotActionAPI.ts +69 -7
  9. package/Server/API/StatusAPI.ts +61 -51
  10. package/Server/EnvironmentConfig.ts +3 -0
  11. package/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.ts +93 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts +60 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts +17 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1725291476867-MigrationName.ts +51 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1725357719072-MigrationName.ts +23 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1725360199561-MigrationName.ts +13 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1725379949648-MigrationName.ts +17 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +14 -0
  19. package/Server/Infrastructure/QueueWorker.ts +2 -2
  20. package/Server/Services/CopilotActionTypePriorityService.ts +66 -0
  21. package/Server/Services/DatabaseService.ts +4 -5
  22. package/Server/Services/ExceptionInstanceService.ts +11 -0
  23. package/Server/Services/Index.ts +7 -0
  24. package/Server/Services/StatusPageDomainService.ts +118 -59
  25. package/Server/Services/TelemetryExceptionService.ts +10 -0
  26. package/Server/Types/Database/Permissions/Index.ts +1 -1
  27. package/Server/Types/Database/UpdateByID.ts +1 -1
  28. package/Server/Types/Workflow/Components/Email.ts +32 -25
  29. package/Server/Utils/CodeRepository/CodeRepository.ts +10 -14
  30. package/Server/Utils/CodeRepository/CodeRepositoryFile.ts +0 -7
  31. package/Server/Utils/Greenlock/Greenlock.ts +331 -204
  32. package/Server/Utils/Logger.ts +8 -2
  33. package/Server/Utils/Telemetry.ts +109 -25
  34. package/Types/Code/CodeType.ts +1 -0
  35. package/Types/Copilot/CopilotActionProps/DirectoryActionProp.ts +3 -0
  36. package/Types/Copilot/CopilotActionProps/ExceptionActionProp.ts +4 -0
  37. package/Types/Copilot/CopilotActionProps/FileActionProp.ts +5 -0
  38. package/Types/Copilot/CopilotActionProps/FunctionActionProp.ts +5 -0
  39. package/Types/Copilot/CopilotActionProps/Index.ts +96 -0
  40. package/Types/Copilot/CopilotActionProps/SpanActionProp.ts +4 -0
  41. package/Types/Copilot/CopilotActionStatus.ts +109 -1
  42. package/Types/Copilot/CopilotActionType.ts +203 -1
  43. package/Types/Database/PartialEntity.ts +14 -1
  44. package/Types/Date.ts +9 -1
  45. package/Types/Icon/IconProp.ts +3 -0
  46. package/Types/Permission.ts +65 -0
  47. package/Types/Workflow/Components/Email.ts +4 -4
  48. package/UI/Components/ActionCard/ActionCard.tsx +66 -0
  49. package/UI/Components/Alerts/Alert.tsx +69 -60
  50. package/UI/Components/Card/Card.tsx +1 -0
  51. package/UI/Components/Detail/Detail.tsx +6 -1
  52. package/UI/Components/GanttChart/Row/Row.tsx +4 -2
  53. package/UI/Components/GanttChart/Row/RowLabel.tsx +7 -3
  54. package/UI/Components/Icon/Icon.tsx +24 -0
  55. package/UI/Components/LogsViewer/LogsViewer.tsx +1 -1
  56. package/UI/Components/Types/FieldType.ts +1 -0
  57. package/UI/Components/Workflow/WorkflowStatus.tsx +2 -2
  58. package/UI/Config.ts +2 -0
  59. package/UI/Utils/Telemetry.ts +7 -2
  60. package/Utils/Crypto.ts +11 -0
  61. package/build/dist/Models/AnalyticsModels/ExceptionInstance.js +445 -0
  62. package/build/dist/Models/AnalyticsModels/ExceptionInstance.js.map +1 -0
  63. package/build/dist/Models/AnalyticsModels/Index.js +2 -0
  64. package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
  65. package/build/dist/Models/AnalyticsModels/Span.js +2 -2
  66. package/build/dist/Models/DatabaseModels/CopilotAction.js +237 -40
  67. package/build/dist/Models/DatabaseModels/CopilotAction.js.map +1 -1
  68. package/build/dist/Models/DatabaseModels/CopilotActionTypePriority.js +343 -0
  69. package/build/dist/Models/DatabaseModels/CopilotActionTypePriority.js.map +1 -0
  70. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  71. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  72. package/build/dist/Models/DatabaseModels/TelemetryException.js +1010 -0
  73. package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -0
  74. package/build/dist/Server/API/CopilotActionAPI.js +56 -9
  75. package/build/dist/Server/API/CopilotActionAPI.js.map +1 -1
  76. package/build/dist/Server/API/StatusAPI.js +51 -44
  77. package/build/dist/Server/API/StatusAPI.js.map +1 -1
  78. package/build/dist/Server/EnvironmentConfig.js +1 -0
  79. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  80. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js +38 -0
  81. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js.map +1 -0
  82. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js +26 -0
  83. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js.map +1 -0
  84. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js +12 -0
  85. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js.map +1 -0
  86. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725291476867-MigrationName.js +24 -0
  87. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725291476867-MigrationName.js.map +1 -0
  88. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725357719072-MigrationName.js +14 -0
  89. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725357719072-MigrationName.js.map +1 -0
  90. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725360199561-MigrationName.js +12 -0
  91. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725360199561-MigrationName.js.map +1 -0
  92. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725379949648-MigrationName.js +12 -0
  93. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725379949648-MigrationName.js.map +1 -0
  94. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +14 -0
  95. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  96. package/build/dist/Server/Infrastructure/QueueWorker.js +2 -2
  97. package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
  98. package/build/dist/Server/Services/CopilotActionTypePriorityService.js +45 -0
  99. package/build/dist/Server/Services/CopilotActionTypePriorityService.js.map +1 -0
  100. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  101. package/build/dist/Server/Services/ExceptionInstanceService.js +9 -0
  102. package/build/dist/Server/Services/ExceptionInstanceService.js.map +1 -0
  103. package/build/dist/Server/Services/Index.js +6 -0
  104. package/build/dist/Server/Services/Index.js.map +1 -1
  105. package/build/dist/Server/Services/StatusPageDomainService.js +101 -53
  106. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  107. package/build/dist/Server/Services/TelemetryExceptionService.js +9 -0
  108. package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -0
  109. package/build/dist/Server/Types/Database/Permissions/Index.js.map +1 -1
  110. package/build/dist/Server/Types/Workflow/Components/Email.js +26 -27
  111. package/build/dist/Server/Types/Workflow/Components/Email.js.map +1 -1
  112. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js +5 -13
  113. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js.map +1 -1
  114. package/build/dist/Server/Utils/Greenlock/Greenlock.js +234 -157
  115. package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
  116. package/build/dist/Server/Utils/Logger.js +5 -1
  117. package/build/dist/Server/Utils/Logger.js.map +1 -1
  118. package/build/dist/Server/Utils/Telemetry.js +63 -22
  119. package/build/dist/Server/Utils/Telemetry.js.map +1 -1
  120. package/build/dist/Types/Code/CodeType.js +1 -0
  121. package/build/dist/Types/Code/CodeType.js.map +1 -1
  122. package/build/dist/Types/Copilot/CopilotActionProps/DirectoryActionProp.js +2 -0
  123. package/build/dist/Types/Copilot/CopilotActionProps/DirectoryActionProp.js.map +1 -0
  124. package/build/dist/Types/Copilot/CopilotActionProps/ExceptionActionProp.js +2 -0
  125. package/build/dist/Types/Copilot/CopilotActionProps/ExceptionActionProp.js.map +1 -0
  126. package/build/dist/Types/Copilot/CopilotActionProps/FileActionProp.js +2 -0
  127. package/build/dist/Types/Copilot/CopilotActionProps/FileActionProp.js.map +1 -0
  128. package/build/dist/Types/Copilot/CopilotActionProps/FunctionActionProp.js +2 -0
  129. package/build/dist/Types/Copilot/CopilotActionProps/FunctionActionProp.js.map +1 -0
  130. package/build/dist/Types/Copilot/CopilotActionProps/Index.js +64 -0
  131. package/build/dist/Types/Copilot/CopilotActionProps/Index.js.map +1 -0
  132. package/build/dist/Types/Copilot/CopilotActionProps/SpanActionProp.js +2 -0
  133. package/build/dist/Types/Copilot/CopilotActionProps/SpanActionProp.js.map +1 -0
  134. package/build/dist/Types/Copilot/CopilotActionStatus.js +89 -0
  135. package/build/dist/Types/Copilot/CopilotActionStatus.js.map +1 -1
  136. package/build/dist/Types/Copilot/CopilotActionType.js +165 -1
  137. package/build/dist/Types/Copilot/CopilotActionType.js.map +1 -1
  138. package/build/dist/Types/Database/PartialEntity.js +3 -0
  139. package/build/dist/Types/Database/PartialEntity.js.map +1 -1
  140. package/build/dist/Types/Date.js +7 -1
  141. package/build/dist/Types/Date.js.map +1 -1
  142. package/build/dist/Types/Icon/IconProp.js +3 -0
  143. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  144. package/build/dist/Types/Permission.js +57 -0
  145. package/build/dist/Types/Permission.js.map +1 -1
  146. package/build/dist/Types/Workflow/Components/Email.js +4 -4
  147. package/build/dist/Types/Workflow/Components/Email.js.map +1 -1
  148. package/build/dist/UI/Components/ActionCard/ActionCard.js +27 -0
  149. package/build/dist/UI/Components/ActionCard/ActionCard.js.map +1 -0
  150. package/build/dist/UI/Components/Alerts/Alert.js +36 -45
  151. package/build/dist/UI/Components/Alerts/Alert.js.map +1 -1
  152. package/build/dist/UI/Components/Card/Card.js +1 -1
  153. package/build/dist/UI/Components/Card/Card.js.map +1 -1
  154. package/build/dist/UI/Components/Detail/Detail.js +5 -1
  155. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  156. package/build/dist/UI/Components/GanttChart/Row/Row.js +2 -2
  157. package/build/dist/UI/Components/GanttChart/Row/Row.js.map +1 -1
  158. package/build/dist/UI/Components/GanttChart/Row/RowLabel.js +3 -3
  159. package/build/dist/UI/Components/GanttChart/Row/RowLabel.js.map +1 -1
  160. package/build/dist/UI/Components/Icon/Icon.js +9 -0
  161. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  162. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
  163. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  164. package/build/dist/UI/Components/Types/FieldType.js +1 -0
  165. package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
  166. package/build/dist/UI/Components/Workflow/WorkflowStatus.js +2 -2
  167. package/build/dist/UI/Components/Workflow/WorkflowStatus.js.map +1 -1
  168. package/build/dist/UI/Config.js +1 -0
  169. package/build/dist/UI/Config.js.map +1 -1
  170. package/build/dist/UI/Utils/Telemetry.js +6 -3
  171. package/build/dist/UI/Utils/Telemetry.js.map +1 -1
  172. package/build/dist/Utils/Crypto.js +10 -0
  173. package/build/dist/Utils/Crypto.js.map +1 -0
  174. package/package.json +11 -11
@@ -1,10 +1,212 @@
1
1
  enum CopilotActionType {
2
2
  IMPROVE_COMMENTS = "Improve Comments",
3
- IMRPOVE_README = "Improve Readme",
3
+ ADD_COMMENTS = "Add Comments",
4
+
5
+ IMPROVE_README = "Improve Readme",
6
+ ADD_README = "Add Readme",
7
+
4
8
  FIX_GRAMMAR_AND_SPELLING = "Fix Grammar and Spelling",
5
9
  IMPROVE_VARIABLE_NAMES = "Improve Variable Names",
6
10
  REFACTOR_CODE = "Refactor Code",
11
+
7
12
  WRITE_UNIT_TESTS = "Write Unit Tests",
13
+ IMPROVE_UNIT_TESTS = "Improve Unit Tests",
14
+
15
+ IMPROVE_LOGS = "Improve Logs",
16
+ ADD_LOGS = "Add Logs",
17
+
18
+ IMPROVE_SPANS = "Improve Spans",
19
+ ADD_SPANS = "Add Spans",
20
+
21
+ IMPROVE_METRICS = "Improve Metrics",
22
+ ADD_METRICS = "Add Metrics",
23
+
24
+ FIX_EXCEPTIONS = "Fix Exceptions",
25
+ FIX_PERFORMANCE_ISSUES = "Fix Performance Issues",
26
+ FIX_BUGS = "Fix Bugs",
27
+
28
+ // SETUP_ACTIONS
29
+ SETUP_OPEN_TELEMETRY = "Setup OpenTelemetry",
30
+
31
+ // Setup Unit Test Framework
32
+ SETUP_UNIT_TEST_FRAMEWORK = "Setup Unit Test Framework",
33
+ }
34
+
35
+ export interface CopilotActionTypeData {
36
+ type: CopilotActionType;
37
+ description: string;
38
+ defaultPriority: number;
39
+ dependsOn: Array<CopilotActionType>;
40
+ }
41
+
42
+ export class CopilotActionTypeUtil {
43
+ public static getAllCopilotActionTypes(): Array<CopilotActionTypeData> {
44
+ return [
45
+ // Fix broken code.
46
+ {
47
+ type: CopilotActionType.FIX_EXCEPTIONS,
48
+ description: "Fix exceptions in your codebase",
49
+ defaultPriority: 1,
50
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
51
+ },
52
+ {
53
+ type: CopilotActionType.FIX_PERFORMANCE_ISSUES,
54
+ description: "Fix performance issues in your codebase",
55
+ defaultPriority: 1,
56
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
57
+ },
58
+ {
59
+ type: CopilotActionType.FIX_BUGS,
60
+ description: "Fix simple bugs and small issues in your codebase",
61
+ defaultPriority: 1,
62
+ dependsOn: [],
63
+ },
64
+
65
+ // Improve debugging.
66
+
67
+ // add logs, metircs and spans.
68
+
69
+ {
70
+ type: CopilotActionType.ADD_LOGS,
71
+ description: "Add OpenTelemetry logs in your codebase",
72
+ defaultPriority: 2,
73
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
74
+ },
75
+ {
76
+ type: CopilotActionType.ADD_SPANS,
77
+ description: "Add OpenTelemetry spans in your codebase",
78
+ defaultPriority: 2,
79
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
80
+ },
81
+ {
82
+ type: CopilotActionType.ADD_METRICS,
83
+ description: "Add OpenTelemetry metrics in your codebase",
84
+ defaultPriority: 2,
85
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
86
+ },
87
+ {
88
+ type: CopilotActionType.IMPROVE_LOGS,
89
+ description:
90
+ "Improve OpenTelemetry logs in your codebase where required to make debugging easier.",
91
+ defaultPriority: 2,
92
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
93
+ },
94
+ {
95
+ type: CopilotActionType.IMPROVE_SPANS,
96
+ description:
97
+ "Improve OpenTelemetry spans in your codebase where required to make debugging easier.",
98
+ defaultPriority: 2,
99
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
100
+ },
101
+ {
102
+ type: CopilotActionType.IMPROVE_METRICS,
103
+ description:
104
+ "Improve OpenTelemetry metrics in your codebase where required to make debugging easier.",
105
+ defaultPriority: 2,
106
+ dependsOn: [CopilotActionType.SETUP_OPEN_TELEMETRY],
107
+ },
108
+
109
+ // Improve code and test quality.
110
+ {
111
+ type: CopilotActionType.REFACTOR_CODE,
112
+ description: "Refactor code and make it into smaller units",
113
+ defaultPriority: 3,
114
+ dependsOn: [],
115
+ },
116
+ {
117
+ type: CopilotActionType.WRITE_UNIT_TESTS,
118
+ description: "Add unit tests",
119
+ defaultPriority: 3,
120
+ dependsOn: [CopilotActionType.SETUP_UNIT_TEST_FRAMEWORK],
121
+ },
122
+ {
123
+ type: CopilotActionType.IMPROVE_UNIT_TESTS,
124
+ description: "Improve unit tests",
125
+ defaultPriority: 3,
126
+ dependsOn: [CopilotActionType.SETUP_UNIT_TEST_FRAMEWORK],
127
+ },
128
+
129
+ // add comments.
130
+ {
131
+ type: CopilotActionType.IMPROVE_COMMENTS,
132
+ description: "Improve comments in your codebase",
133
+ defaultPriority: 4,
134
+ dependsOn: [],
135
+ },
136
+ {
137
+ type: CopilotActionType.ADD_COMMENTS,
138
+ description: "Add comments in your codebase",
139
+ defaultPriority: 4,
140
+ dependsOn: [],
141
+ },
142
+
143
+ // Add or improve README file.
144
+ {
145
+ type: CopilotActionType.ADD_README,
146
+ description: "Add a README file",
147
+ defaultPriority: 4,
148
+ dependsOn: [],
149
+ },
150
+ {
151
+ type: CopilotActionType.IMPROVE_README,
152
+ description: "Improve the README file",
153
+ defaultPriority: 4,
154
+ dependsOn: [],
155
+ },
156
+
157
+ // Fix grammar and spelling mistakes
158
+ {
159
+ type: CopilotActionType.FIX_GRAMMAR_AND_SPELLING,
160
+ description: "Fix grammar and spelling mistakes",
161
+ defaultPriority: 5,
162
+ dependsOn: [],
163
+ },
164
+ {
165
+ type: CopilotActionType.IMPROVE_VARIABLE_NAMES,
166
+ description: "Improve variable names and make it understandable",
167
+ defaultPriority: 5,
168
+ dependsOn: [],
169
+ },
170
+ ];
171
+ }
172
+
173
+ public static getSetupActionTypes(): Array<CopilotActionTypeData> {
174
+ return [
175
+ {
176
+ type: CopilotActionType.SETUP_OPEN_TELEMETRY,
177
+ description: "Setup OpenTelemetry in your codebase",
178
+ defaultPriority: 1,
179
+ dependsOn: [],
180
+ },
181
+ {
182
+ type: CopilotActionType.SETUP_UNIT_TEST_FRAMEWORK,
183
+ description: "Setup Unit Test Framework in your codebase",
184
+ defaultPriority: 1,
185
+ dependsOn: [],
186
+ },
187
+ ];
188
+ }
189
+
190
+ public static getCopilotActionType(
191
+ type: CopilotActionType,
192
+ ): CopilotActionTypeData {
193
+ return this.getAllCopilotActionTypes().find(
194
+ (copilotActionTypeData: CopilotActionTypeData) => {
195
+ return copilotActionTypeData.type === type;
196
+ },
197
+ ) as CopilotActionTypeData;
198
+ }
199
+
200
+ // get actions by priority.
201
+ public static getActionsByPriority(
202
+ priority: number,
203
+ ): Array<CopilotActionTypeData> {
204
+ return this.getAllCopilotActionTypes().filter(
205
+ (copilotActionTypeData: CopilotActionTypeData) => {
206
+ return copilotActionTypeData.defaultPriority === priority;
207
+ },
208
+ );
209
+ }
8
210
  }
9
211
 
10
212
  export default CopilotActionType;
@@ -1,3 +1,16 @@
1
- import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
1
+ /**
2
+ * Make all properties in T optional. Deep version.
3
+ */
4
+
5
+ type QueryDeepPartialEntity<T> = {
6
+ [P in keyof T]?:
7
+ | (T[P] extends Array<infer U>
8
+ ? Array<QueryDeepPartialEntity<U>>
9
+ : T[P] extends ReadonlyArray<infer U>
10
+ ? ReadonlyArray<QueryDeepPartialEntity<U>>
11
+ : QueryDeepPartialEntity<T[P]>)
12
+ | (() => string)
13
+ | null;
14
+ };
2
15
 
3
16
  export default QueryDeepPartialEntity;
package/Types/Date.ts CHANGED
@@ -9,10 +9,18 @@ import Timezone from "./Timezone";
9
9
  export const Moment: typeof moment = moment;
10
10
 
11
11
  export default class OneUptimeDate {
12
- public getNanoSecondsFromSeconds(seconds: number): number {
12
+ public static convertMinutesToMilliseconds(minutes: number): number {
13
+ return minutes * 60 * 1000;
14
+ }
15
+
16
+ public static getNanoSecondsFromSeconds(seconds: number): number {
13
17
  return seconds * 1000 * 1000 * 1000;
14
18
  }
15
19
 
20
+ public static now(): Date {
21
+ return this.getCurrentDate();
22
+ }
23
+
16
24
  public static getDateFromYYYYMMDD(
17
25
  year: string,
18
26
  month: string,
@@ -1,5 +1,6 @@
1
1
  enum IconProp {
2
2
  Equals = "Equals",
3
+ Archive = "Archive",
3
4
  File = "File",
4
5
  Automation = "Automation",
5
6
  Workflow = "Workflow",
@@ -15,6 +16,8 @@ enum IconProp {
15
16
  CursorArrowRays = "CursorArrowRays",
16
17
  ArrowUpDown = "ArrowUpDown",
17
18
  Cube = "Cube",
19
+ Unarchive = "Unarchive",
20
+ CPUChip = "CPUChip",
18
21
  Swatch = "Swatch",
19
22
  Squares = "Squares",
20
23
  RectangleStack = "RectangleStack",
@@ -53,6 +53,12 @@ enum Permission {
53
53
  EditTelemetryServiceLog = "EditTelemetryServiceLog",
54
54
  ReadTelemetryServiceLog = "ReadTelemetryServiceLog",
55
55
 
56
+ // Exceptions
57
+ CreateTelemetryException = "CreateTelemetryException",
58
+ DeleteTelemetryException = "DeleteTelemetryException",
59
+ EditTelemetryException = "EditTelemetryException",
60
+ ReadTelemetryException = "ReadTelemetryException",
61
+
56
62
  // Spans
57
63
  CreateTelemetryServiceTraces = "CreateTelemetryServiceTraces",
58
64
  DeleteTelemetryServiceTraces = "DeleteTelemetryServiceTraces",
@@ -493,6 +499,9 @@ enum Permission {
493
499
  ReadCopilotCodeRepository = "ReadCopilotCodeRepository",
494
500
 
495
501
  ReadCopilotAction = "ReadCopilotAction",
502
+ CreateCopilotAction = "CreateCopilotAction",
503
+ DeleteCopilotAction = "DeleteCopilotAction",
504
+ EditCopilotAction = "EditCopilotAction",
496
505
 
497
506
  ReadCopilotPullRequest = "ReadCopilotPullRequest",
498
507
 
@@ -2445,6 +2454,39 @@ export class PermissionHelper {
2445
2454
  isAccessControlPermission: false,
2446
2455
  },
2447
2456
 
2457
+ {
2458
+ permission: Permission.CreateTelemetryException,
2459
+ title: "Create Telemetry Service Exception",
2460
+ description:
2461
+ "This permission can create Telemetry Service Exception this project.",
2462
+ isAssignableToTenant: true,
2463
+ isAccessControlPermission: false,
2464
+ },
2465
+ {
2466
+ permission: Permission.DeleteTelemetryException,
2467
+ title: "Delete Telemetry Service Exception",
2468
+ description:
2469
+ "This permission can delete Telemetry Service Exception of this project.",
2470
+ isAssignableToTenant: true,
2471
+ isAccessControlPermission: false,
2472
+ },
2473
+ {
2474
+ permission: Permission.EditTelemetryException,
2475
+ title: "Edit Telemetry Service Exception",
2476
+ description:
2477
+ "This permission can edit Telemetry Service Exception of this project.",
2478
+ isAssignableToTenant: true,
2479
+ isAccessControlPermission: false,
2480
+ },
2481
+ {
2482
+ permission: Permission.ReadTelemetryException,
2483
+ title: "Read Telemetry Service Exception",
2484
+ description:
2485
+ "This permission can read Telemetry Service Exception of this project.",
2486
+ isAssignableToTenant: true,
2487
+ isAccessControlPermission: false,
2488
+ },
2489
+
2448
2490
  {
2449
2491
  permission: Permission.CreateCopilotCodeRepository,
2450
2492
  title: "Create Code Repository",
@@ -2517,6 +2559,29 @@ export class PermissionHelper {
2517
2559
  isAssignableToTenant: true,
2518
2560
  isAccessControlPermission: false,
2519
2561
  },
2562
+ {
2563
+ permission: Permission.EditCopilotAction,
2564
+ title: "Edit Copilot Event",
2565
+ description: "This permission can edit Copilot Event of this project.",
2566
+ isAssignableToTenant: true,
2567
+ isAccessControlPermission: false,
2568
+ },
2569
+ {
2570
+ permission: Permission.DeleteCopilotAction,
2571
+ title: "Delete Copilot Event",
2572
+ description:
2573
+ "This permission can delete Copilot Event of this project.",
2574
+ isAssignableToTenant: true,
2575
+ isAccessControlPermission: false,
2576
+ },
2577
+ {
2578
+ permission: Permission.CreateCopilotAction,
2579
+ title: "Create Copilot Event",
2580
+ description:
2581
+ "This permission can create Copilot Event of this project.",
2582
+ isAssignableToTenant: true,
2583
+ isAccessControlPermission: false,
2584
+ },
2520
2585
 
2521
2586
  {
2522
2587
  permission: Permission.CreateProbeOwnerTeam,
@@ -33,14 +33,14 @@ const components: Array<ComponentMetadata> = [
33
33
  {
34
34
  type: ComponentInputType.Text,
35
35
  name: "Subject",
36
- description: "Email to send to",
36
+ description: "Subject of the email",
37
37
  required: false,
38
38
  id: "subject",
39
39
  },
40
40
  {
41
41
  type: ComponentInputType.HTML,
42
42
  name: "Email Body",
43
- description: "Email to send to",
43
+ description: "Body of the email",
44
44
  required: false,
45
45
  id: "email-body",
46
46
  },
@@ -55,14 +55,14 @@ const components: Array<ComponentMetadata> = [
55
55
  type: ComponentInputType.Text,
56
56
  name: "SMTP Username",
57
57
  description: "SMTP Username to send emails from",
58
- required: true,
58
+ required: false,
59
59
  id: "smtp-username",
60
60
  },
61
61
  {
62
62
  type: ComponentInputType.Password,
63
63
  name: "SMTP Password",
64
64
  description: "SMTP Password to send emails from",
65
- required: true,
65
+ required: false,
66
66
  id: "smtp-password",
67
67
  },
68
68
  {
@@ -0,0 +1,66 @@
1
+ import { ButtonStyleType } from "../Button/Button";
2
+ import Card from "../Card/Card";
3
+ import ConfirmModal from "../Modal/ConfirmModal";
4
+ import IconProp from "Common/Types/Icon/IconProp";
5
+ import React, { ReactElement, useState } from "react";
6
+
7
+ export interface ConfirmAction {
8
+ actionName: string;
9
+ actionIcon: IconProp;
10
+ onConfirmAction: () => void;
11
+ actionButtonStyle?: ButtonStyleType;
12
+ isLoading?: boolean;
13
+ }
14
+
15
+ export interface ComponentProps {
16
+ title: string;
17
+ description: string;
18
+ actions: Array<ConfirmAction>;
19
+ }
20
+
21
+ const ActionCard: (props: ComponentProps) => ReactElement = (
22
+ props: ComponentProps,
23
+ ): ReactElement => {
24
+ const [currentAction, setCurrentAction] = useState<ConfirmAction | undefined>(
25
+ undefined,
26
+ );
27
+
28
+ return (
29
+ <>
30
+ <Card
31
+ title={props.title}
32
+ description={props.description}
33
+ buttons={props.actions.map((action: ConfirmAction) => {
34
+ return {
35
+ title: action.actionName,
36
+ buttonStyle: action.actionButtonStyle || ButtonStyleType.NORMAL,
37
+ onClick: () => {
38
+ setCurrentAction(action);
39
+ },
40
+ icon: action.actionIcon,
41
+ isLoading: action.isLoading,
42
+ };
43
+ })}
44
+ />
45
+
46
+ {currentAction ? (
47
+ <ConfirmModal
48
+ description={`Are you sure you want to ${currentAction.actionName}?`}
49
+ title={`Confirm ${currentAction.actionName}`}
50
+ onSubmit={() => {
51
+ currentAction.onConfirmAction();
52
+ setCurrentAction(undefined);
53
+ }}
54
+ submitButtonText={`Confirm`}
55
+ onClose={() => {
56
+ setCurrentAction(undefined);
57
+ }}
58
+ />
59
+ ) : (
60
+ <></>
61
+ )}
62
+ </>
63
+ );
64
+ };
65
+
66
+ export default ActionCard;
@@ -16,13 +16,13 @@ export enum AlertSize {
16
16
  }
17
17
 
18
18
  export interface ComponentProps {
19
- strongTitle?: undefined | string;
20
- title?: undefined | string;
21
- onClose?: undefined | (() => void);
22
- type?: undefined | AlertType;
23
- onClick?: (() => void) | undefined;
19
+ strongTitle?: string;
20
+ title?: string;
21
+ onClose?: () => void;
22
+ type?: AlertType;
23
+ onClick?: () => void;
24
24
  doNotShowIcon?: boolean | undefined;
25
- dataTestId?: string;
25
+ dataTestId?: string | undefined;
26
26
  textClassName?: string | undefined;
27
27
  className?: string | undefined;
28
28
  color?: Color | undefined;
@@ -33,93 +33,102 @@ export interface ComponentProps {
33
33
  const Alert: FunctionComponent<ComponentProps> = (
34
34
  props: ComponentProps,
35
35
  ): ReactElement => {
36
- let type: AlertType = AlertType.INFO;
36
+ const type: AlertType = props.type || AlertType.INFO;
37
37
 
38
- if (props.type) {
39
- type = props.type;
40
- }
38
+ const typeClassNames: {
39
+ [key in AlertType]: {
40
+ text: string;
41
+ bg: string;
42
+ hover: string;
43
+ };
44
+ } = {
45
+ [AlertType.DANGER]: {
46
+ text: "text-red-200",
47
+ bg: "bg-red-700",
48
+ hover: "hover:bg-red-600",
49
+ },
50
+ [AlertType.INFO]: {
51
+ text: "text-gray-200",
52
+ bg: "bg-gray-700",
53
+ hover: "hover:bg-gray-600",
54
+ },
55
+ [AlertType.WARNING]: {
56
+ text: "text-yellow-200",
57
+ bg: "bg-gray-700",
58
+ hover: "hover:bg-yellow-600",
59
+ },
60
+ [AlertType.SUCCESS]: {
61
+ text: "text-green-200",
62
+ bg: "bg-gray-700",
63
+ hover: "hover:bg-green-600",
64
+ },
65
+ };
41
66
 
42
- let className: string = "text-gray";
43
- let bgClassName: string = "bg-gray";
44
-
45
- if (AlertType.DANGER === type) {
46
- className = "text-red";
47
- bgClassName = "bg-red";
48
- } else if (AlertType.INFO === type) {
49
- className = "text-gray";
50
- bgClassName = "bg-gray";
51
- } else if (AlertType.WARNING === type) {
52
- className = "text-yellow";
53
- bgClassName = "bg-gray";
54
- } else if (AlertType.SUCCESS === type) {
55
- className = "text-green";
56
- bgClassName = "bg-gray";
57
- }
67
+ const {
68
+ text: textClassName,
69
+ bg: bgClassName,
70
+ hover: hoverClassName,
71
+ } = typeClassNames[type];
58
72
 
59
73
  return (
60
74
  <div
61
75
  id={props.id}
62
- className={`rounded-md ${bgClassName}-700 p-4`}
76
+ className={`alert rounded-md ${bgClassName} p-4 ${props.className}`}
63
77
  data-testid={props.dataTestId}
64
- onClick={() => {
65
- props.onClick && props.onClick();
66
- }}
78
+ onClick={props.onClick}
67
79
  role="alert"
68
- style={
69
- props.color
70
- ? {
71
- backgroundColor: props.color?.toString(),
72
- }
73
- : {}
74
- }
80
+ style={props.color ? { backgroundColor: props.color.toString() } : {}}
75
81
  >
76
- <div className="flex ">
82
+ <div className="alert-content flex">
77
83
  {!props.doNotShowIcon && (
78
- <div className="flex-shrink-0">
79
- {AlertType.DANGER === type && (
80
- <Icon icon={IconProp.Alert} className="h-5 w-5 text-red-200" />
84
+ <div className="alert-icon flex-shrink-0">
85
+ {type === AlertType.DANGER && (
86
+ <Icon
87
+ icon={IconProp.Alert}
88
+ className={`h-5 w-5 ${textClassName}`}
89
+ />
81
90
  )}
82
- {AlertType.WARNING === type && (
83
- <Icon icon={IconProp.Alert} className="h-5 w-5 text-yellow-200" />
91
+ {type === AlertType.WARNING && (
92
+ <Icon
93
+ icon={IconProp.Alert}
94
+ className={`h-5 w-5 ${textClassName}`}
95
+ />
84
96
  )}
85
- {AlertType.SUCCESS === type && (
97
+ {type === AlertType.SUCCESS && (
86
98
  <Icon
87
99
  icon={IconProp.CheckCircle}
88
- className="h-5 w-5 text-green-400"
100
+ className={`h-5 w-5 ${textClassName}`}
89
101
  />
90
102
  )}
91
- {AlertType.INFO === type && (
92
- <Icon icon={IconProp.Info} className="h-5 w-5 text-gray-200" />
103
+ {type === AlertType.INFO && (
104
+ <Icon
105
+ icon={IconProp.Info}
106
+ className={`h-5 w-5 ${textClassName}`}
107
+ />
93
108
  )}
94
109
  </div>
95
110
  )}
96
111
  <div
97
- className={`ml-3 mr-3 flex-1 md:flex md:justify-between ${props.className}`}
112
+ className={`alert-text ml-3 mr-3 flex-1 md:flex md:justify-between ${props.textClassName}`}
98
113
  >
99
114
  <div
100
- className={
101
- props.textClassName ||
102
- `text-sm flex justify-between ${className}-200`
103
- }
115
+ className={`alert-message text-sm flex justify-between ${textClassName}`}
104
116
  >
105
117
  <div>
106
118
  <span className="font-medium">
107
119
  {props.strongTitle}{" "}
108
- {props.title && props.strongTitle ? "-" : ""}{" "}
120
+ {props.title && props.strongTitle ? "- " : ""}
109
121
  </span>
110
122
  {props.title}
111
123
  </div>
112
124
  {props.textOnRight && <div>{props.textOnRight}</div>}
113
125
  </div>
114
-
115
126
  {props.onClose && (
116
- <p className="mt-3 text-sm md:mt-0 md:ml-6">
127
+ <p className="alert-close mt-3 text-sm md:mt-0 md:ml-6">
117
128
  <button
118
- onClick={() => {
119
- props.onClose && props.onClose();
120
- }}
121
- role={"alert-close-button"}
122
- className={`whitespace-nowrap font-medium ${className}-200 hover:${className}-50`}
129
+ onClick={props.onClose}
130
+ role="alert-close-button"
131
+ className={`whitespace-nowrap font-medium ${textClassName} hover:${hoverClassName}`}
123
132
  >
124
133
  Close
125
134
  <span aria-hidden="true"> &rarr;</span>
@@ -83,6 +83,7 @@ const Card: FunctionComponent<ComponentProps> = (
83
83
  icon={button.icon}
84
84
  shortcutKey={button.shortcutKey}
85
85
  dataTestId="card-button"
86
+ isLoading={button.isLoading}
86
87
  />
87
88
  </div>
88
89
  );
@@ -283,7 +283,8 @@ const Detail: DetailFunction = <T extends GenericObject>(
283
283
  (field.fieldType === FieldType.HTML ||
284
284
  field.fieldType === FieldType.CSS ||
285
285
  field.fieldType === FieldType.JSON ||
286
- field.fieldType === FieldType.JavaScript)
286
+ field.fieldType === FieldType.JavaScript ||
287
+ field.fieldType === FieldType.Code)
287
288
  ) {
288
289
  let codeType: CodeType = CodeType.HTML;
289
290
 
@@ -315,6 +316,10 @@ const Detail: DetailFunction = <T extends GenericObject>(
315
316
  codeType = CodeType.JavaScript;
316
317
  }
317
318
 
319
+ if (field.fieldType === FieldType.Code) {
320
+ codeType = CodeType.Text;
321
+ }
322
+
318
323
  data = (
319
324
  <CodeEditor
320
325
  type={codeType}
@@ -50,8 +50,10 @@ const Row: FunctionComponent<ComponentProps> = (
50
50
  <div
51
51
  className={`flex w-full border-b-2 border-gray-200 border-l-2 border-l-gray-400 border-r-2 border-r-gray-400`}
52
52
  >
53
- <div className="flex w-1/4 border-r-2 border-gray-300">
54
- <div className={`pl-${paddingCount} pt-2 pb-2 pr-2 flex`}>
53
+ <div className="flex w-1/4 border-r-2 border-gray-300 overflow-hidden">
54
+ <div
55
+ className={`pl-${paddingCount} pt-2 pb-2 pr-2 flex overflow-hidden`}
56
+ >
55
57
  <div className="w-5 h-5 ml-3 mt-1">
56
58
  {hasChildRows && (
57
59
  <Icon