@oneuptime/common 9.5.7 → 9.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/Models/DatabaseModels/Alert.ts +8 -9
  2. package/Models/DatabaseModels/Incident.ts +5 -5
  3. package/Models/DatabaseModels/IncidentTemplate.ts +4 -3
  4. package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +1 -1
  5. package/Models/DatabaseModels/UserOnCallLog.ts +1 -1
  6. package/Models/DatabaseModels/UserPush.ts +2 -1
  7. package/Server/API/UserPushAPI.ts +51 -4
  8. package/Server/Infrastructure/Postgres/SchemaMigrations/1770833704656-MigrationName.ts +156 -0
  9. package/Server/Infrastructure/Postgres/SchemaMigrations/1770834237090-MigrationName.ts +119 -0
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  11. package/Server/Middleware/UserAuthorization.ts +14 -9
  12. package/Server/Services/AlertEpisodeFeedService.ts +50 -0
  13. package/Server/Services/AlertEpisodeInternalNoteService.ts +162 -0
  14. package/Server/Services/AlertEpisodeMemberService.ts +7 -0
  15. package/Server/Services/AlertEpisodeOwnerTeamService.ts +186 -0
  16. package/Server/Services/AlertEpisodeOwnerUserService.ts +180 -0
  17. package/Server/Services/AlertEpisodeService.ts +68 -0
  18. package/Server/Services/AlertEpisodeStateTimelineService.ts +5 -0
  19. package/Server/Services/AlertService.ts +3 -0
  20. package/Server/Services/IncidentEpisodeFeedService.ts +50 -0
  21. package/Server/Services/IncidentEpisodeInternalNoteService.ts +163 -0
  22. package/Server/Services/IncidentEpisodeMemberService.ts +7 -0
  23. package/Server/Services/IncidentEpisodeOwnerTeamService.ts +189 -0
  24. package/Server/Services/IncidentEpisodeOwnerUserService.ts +183 -0
  25. package/Server/Services/IncidentEpisodePublicNoteService.ts +8 -0
  26. package/Server/Services/IncidentEpisodeService.ts +91 -12
  27. package/Server/Services/IncidentEpisodeStateTimelineService.ts +5 -0
  28. package/Server/Services/IncidentService.ts +5 -0
  29. package/Server/Services/PushNotificationService.ts +129 -27
  30. package/Server/Services/UserNotificationRuleService.ts +13 -3
  31. package/Server/Services/UserPushService.ts +2 -1
  32. package/Server/Services/WorkspaceNotificationRuleService.ts +20 -0
  33. package/Server/Utils/PushNotificationUtil.ts +56 -0
  34. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +1 -1
  35. package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +7 -6
  36. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +1 -1
  37. package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +7 -6
  38. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +17 -0
  39. package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +27 -12
  40. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +17 -0
  41. package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +86 -28
  42. package/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.ts +6 -6
  43. package/Server/Utils/Workspace/Slack/Slack.ts +49 -0
  44. package/Server/Utils/Workspace/WorkspaceMessages/Alert.ts +2 -1
  45. package/Server/Utils/Workspace/WorkspaceMessages/AlertEpisode.ts +3 -1
  46. package/Server/Utils/Workspace/WorkspaceMessages/Incident.ts +2 -1
  47. package/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.ts +3 -1
  48. package/Types/Permission.ts +641 -0
  49. package/Types/PushNotification/PushDeviceType.ts +7 -0
  50. package/Types/PushNotification/PushNotificationRequest.ts +3 -1
  51. package/UI/Components/Detail/Detail.tsx +13 -4
  52. package/UI/Components/Detail/Field.ts +2 -2
  53. package/UI/Components/Dropdown/Dropdown.tsx +38 -7
  54. package/UI/Components/Forms/BasicForm.tsx +35 -5
  55. package/UI/Components/Forms/Fields/PermissionPicker.tsx +261 -0
  56. package/UI/Components/Forms/Types/Field.ts +5 -3
  57. package/UI/Components/ModelDelete/ModelDelete.tsx +4 -1
  58. package/UI/Components/ModelDetail/CardModelDetail.tsx +4 -0
  59. package/UI/Components/ModelDetail/ModelDetail.tsx +4 -1
  60. package/UI/Components/Page/ModelPage.tsx +4 -1
  61. package/UI/Utils/Permission.ts +29 -6
  62. package/build/dist/Models/DatabaseModels/Alert.js +8 -8
  63. package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
  64. package/build/dist/Models/DatabaseModels/Incident.js +5 -5
  65. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  66. package/build/dist/Models/DatabaseModels/IncidentTemplate.js +3 -3
  67. package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
  68. package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +1 -1
  69. package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
  70. package/build/dist/Models/DatabaseModels/UserOnCallLog.js +1 -1
  71. package/build/dist/Models/DatabaseModels/UserOnCallLog.js.map +1 -1
  72. package/build/dist/Models/DatabaseModels/UserPush.js +2 -1
  73. package/build/dist/Models/DatabaseModels/UserPush.js.map +1 -1
  74. package/build/dist/Server/API/UserPushAPI.js +34 -3
  75. package/build/dist/Server/API/UserPushAPI.js.map +1 -1
  76. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770833704656-MigrationName.js +63 -0
  77. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770833704656-MigrationName.js.map +1 -0
  78. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770834237090-MigrationName.js +46 -0
  79. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770834237090-MigrationName.js.map +1 -0
  80. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  81. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  82. package/build/dist/Server/Middleware/UserAuthorization.js +10 -4
  83. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  84. package/build/dist/Server/Services/AlertEpisodeFeedService.js +33 -0
  85. package/build/dist/Server/Services/AlertEpisodeFeedService.js.map +1 -1
  86. package/build/dist/Server/Services/AlertEpisodeInternalNoteService.js +132 -0
  87. package/build/dist/Server/Services/AlertEpisodeInternalNoteService.js.map +1 -1
  88. package/build/dist/Server/Services/AlertEpisodeMemberService.js +7 -0
  89. package/build/dist/Server/Services/AlertEpisodeMemberService.js.map +1 -1
  90. package/build/dist/Server/Services/AlertEpisodeOwnerTeamService.js +163 -0
  91. package/build/dist/Server/Services/AlertEpisodeOwnerTeamService.js.map +1 -1
  92. package/build/dist/Server/Services/AlertEpisodeOwnerUserService.js +156 -0
  93. package/build/dist/Server/Services/AlertEpisodeOwnerUserService.js.map +1 -1
  94. package/build/dist/Server/Services/AlertEpisodeService.js +53 -0
  95. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  96. package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +4 -0
  97. package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -1
  98. package/build/dist/Server/Services/AlertService.js +3 -5
  99. package/build/dist/Server/Services/AlertService.js.map +1 -1
  100. package/build/dist/Server/Services/IncidentEpisodeFeedService.js +33 -0
  101. package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -1
  102. package/build/dist/Server/Services/IncidentEpisodeInternalNoteService.js +132 -0
  103. package/build/dist/Server/Services/IncidentEpisodeInternalNoteService.js.map +1 -1
  104. package/build/dist/Server/Services/IncidentEpisodeMemberService.js +7 -0
  105. package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -1
  106. package/build/dist/Server/Services/IncidentEpisodeOwnerTeamService.js +163 -0
  107. package/build/dist/Server/Services/IncidentEpisodeOwnerTeamService.js.map +1 -1
  108. package/build/dist/Server/Services/IncidentEpisodeOwnerUserService.js +156 -0
  109. package/build/dist/Server/Services/IncidentEpisodeOwnerUserService.js.map +1 -1
  110. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js +8 -0
  111. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js.map +1 -1
  112. package/build/dist/Server/Services/IncidentEpisodeService.js +72 -10
  113. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  114. package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +4 -0
  115. package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
  116. package/build/dist/Server/Services/IncidentService.js +5 -5
  117. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  118. package/build/dist/Server/Services/PushNotificationService.js +77 -21
  119. package/build/dist/Server/Services/PushNotificationService.js.map +1 -1
  120. package/build/dist/Server/Services/UserNotificationRuleService.js +12 -9
  121. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  122. package/build/dist/Server/Services/UserPushService.js +2 -1
  123. package/build/dist/Server/Services/UserPushService.js.map +1 -1
  124. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +16 -0
  125. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  126. package/build/dist/Server/Utils/PushNotificationUtil.js +32 -8
  127. package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
  128. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +1 -1
  129. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  130. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +7 -6
  131. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
  132. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +1 -1
  133. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  134. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +7 -6
  135. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
  136. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +16 -0
  137. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  138. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +25 -9
  139. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
  140. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +16 -0
  141. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  142. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +71 -25
  143. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
  144. package/build/dist/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.js +6 -6
  145. package/build/dist/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.js.map +1 -1
  146. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +40 -0
  147. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  148. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js +1 -1
  149. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js.map +1 -1
  150. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/AlertEpisode.js +1 -1
  151. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/AlertEpisode.js.map +1 -1
  152. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Incident.js +1 -1
  153. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Incident.js.map +1 -1
  154. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.js +1 -1
  155. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.js.map +1 -1
  156. package/build/dist/Types/Permission.js +637 -0
  157. package/build/dist/Types/Permission.js.map +1 -1
  158. package/build/dist/Types/PushNotification/PushDeviceType.js +8 -0
  159. package/build/dist/Types/PushNotification/PushDeviceType.js.map +1 -0
  160. package/build/dist/UI/Components/Detail/Detail.js +7 -1
  161. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  162. package/build/dist/UI/Components/Dropdown/Dropdown.js +17 -2
  163. package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
  164. package/build/dist/UI/Components/Forms/BasicForm.js +17 -3
  165. package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
  166. package/build/dist/UI/Components/Forms/Fields/PermissionPicker.js +129 -0
  167. package/build/dist/UI/Components/Forms/Fields/PermissionPicker.js.map +1 -0
  168. package/build/dist/UI/Components/ModelDelete/ModelDelete.js +2 -1
  169. package/build/dist/UI/Components/ModelDelete/ModelDelete.js.map +1 -1
  170. package/build/dist/UI/Components/ModelDetail/CardModelDetail.js +2 -2
  171. package/build/dist/UI/Components/ModelDetail/CardModelDetail.js.map +1 -1
  172. package/build/dist/UI/Components/ModelDetail/ModelDetail.js +2 -1
  173. package/build/dist/UI/Components/ModelDetail/ModelDetail.js.map +1 -1
  174. package/build/dist/UI/Components/Page/ModelPage.js +2 -1
  175. package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
  176. package/build/dist/UI/Utils/Permission.js +17 -4
  177. package/build/dist/UI/Utils/Permission.js.map +1 -1
  178. package/package.json +2 -1
@@ -21,6 +21,8 @@ export default class PushNotificationUtil {
21
21
  incidentViewLink: string;
22
22
  incidentNumber?: number;
23
23
  incidentNumberWithPrefix?: string;
24
+ incidentId?: string;
25
+ projectId?: string;
24
26
  }): PushNotificationMessage {
25
27
  const {
26
28
  incidentTitle,
@@ -28,6 +30,8 @@ export default class PushNotificationUtil {
28
30
  incidentViewLink,
29
31
  incidentNumber,
30
32
  incidentNumberWithPrefix,
33
+ incidentId,
34
+ projectId,
31
35
  } = params;
32
36
  const displayNumber: string =
33
37
  incidentNumberWithPrefix || (incidentNumber ? `#${incidentNumber}` : "");
@@ -43,6 +47,9 @@ export default class PushNotificationUtil {
43
47
  requireInteraction: true,
44
48
  data: {
45
49
  type: "incident-created",
50
+ entityType: "incident",
51
+ entityId: incidentId,
52
+ projectId: projectId,
46
53
  incidentTitle: incidentTitle,
47
54
  projectName: projectName,
48
55
  url: incidentViewLink,
@@ -58,6 +65,8 @@ export default class PushNotificationUtil {
58
65
  incidentViewLink: string;
59
66
  incidentNumber?: number;
60
67
  incidentNumberWithPrefix?: string;
68
+ incidentId?: string;
69
+ projectId?: string;
61
70
  }): PushNotificationMessage {
62
71
  const {
63
72
  incidentTitle,
@@ -67,6 +76,8 @@ export default class PushNotificationUtil {
67
76
  incidentViewLink,
68
77
  incidentNumber,
69
78
  incidentNumberWithPrefix,
79
+ incidentId,
80
+ projectId,
70
81
  } = params;
71
82
  const displayNumber: string =
72
83
  incidentNumberWithPrefix || (incidentNumber ? `#${incidentNumber}` : "");
@@ -85,6 +96,9 @@ export default class PushNotificationUtil {
85
96
  requireInteraction: true,
86
97
  data: {
87
98
  type: "incident-state-changed",
99
+ entityType: "incident",
100
+ entityId: incidentId,
101
+ projectId: projectId,
88
102
  incidentTitle: incidentTitle,
89
103
  projectName: projectName,
90
104
  newState: newState,
@@ -101,6 +115,8 @@ export default class PushNotificationUtil {
101
115
  incidentViewLink: string;
102
116
  incidentNumber?: number;
103
117
  incidentNumberWithPrefix?: string;
118
+ incidentId?: string;
119
+ projectId?: string;
104
120
  }): PushNotificationMessage {
105
121
  const {
106
122
  incidentTitle,
@@ -109,6 +125,8 @@ export default class PushNotificationUtil {
109
125
  incidentViewLink,
110
126
  incidentNumber,
111
127
  incidentNumberWithPrefix,
128
+ incidentId,
129
+ projectId,
112
130
  } = params;
113
131
  const noteType: string = isPrivateNote ? "Private" : "Public";
114
132
  const displayNumber: string =
@@ -125,6 +143,9 @@ export default class PushNotificationUtil {
125
143
  requireInteraction: true,
126
144
  data: {
127
145
  type: "incident-note-posted",
146
+ entityType: "incident",
147
+ entityId: incidentId,
148
+ projectId: projectId,
128
149
  incidentTitle: incidentTitle,
129
150
  projectName: projectName,
130
151
  isPrivateNote: isPrivateNote,
@@ -139,6 +160,8 @@ export default class PushNotificationUtil {
139
160
  alertViewLink: string;
140
161
  alertNumber?: number;
141
162
  alertNumberWithPrefix?: string;
163
+ alertId?: string;
164
+ projectId?: string;
142
165
  }): PushNotificationMessage {
143
166
  const {
144
167
  alertTitle,
@@ -146,6 +169,8 @@ export default class PushNotificationUtil {
146
169
  alertViewLink,
147
170
  alertNumber,
148
171
  alertNumberWithPrefix,
172
+ alertId,
173
+ projectId,
149
174
  } = params;
150
175
  const displayNumber: string =
151
176
  alertNumberWithPrefix || (alertNumber ? `#${alertNumber}` : "");
@@ -161,6 +186,9 @@ export default class PushNotificationUtil {
161
186
  requireInteraction: true,
162
187
  data: {
163
188
  type: "alert-created",
189
+ entityType: "alert",
190
+ entityId: alertId,
191
+ projectId: projectId,
164
192
  alertTitle: alertTitle,
165
193
  projectName: projectName,
166
194
  url: alertViewLink,
@@ -174,6 +202,8 @@ export default class PushNotificationUtil {
174
202
  alertEpisodeViewLink: string;
175
203
  episodeNumber?: number;
176
204
  episodeNumberWithPrefix?: string;
205
+ alertEpisodeId?: string;
206
+ projectId?: string;
177
207
  }): PushNotificationMessage {
178
208
  const {
179
209
  alertEpisodeTitle,
@@ -181,6 +211,8 @@ export default class PushNotificationUtil {
181
211
  alertEpisodeViewLink,
182
212
  episodeNumber,
183
213
  episodeNumberWithPrefix,
214
+ alertEpisodeId,
215
+ projectId,
184
216
  } = params;
185
217
  const displayNumber: string =
186
218
  episodeNumberWithPrefix || (episodeNumber ? `#${episodeNumber}` : "");
@@ -196,6 +228,9 @@ export default class PushNotificationUtil {
196
228
  requireInteraction: true,
197
229
  data: {
198
230
  type: "alert-episode-created",
231
+ entityType: "alert-episode",
232
+ entityId: alertEpisodeId,
233
+ projectId: projectId,
199
234
  alertEpisodeTitle: alertEpisodeTitle,
200
235
  projectName: projectName,
201
236
  url: alertEpisodeViewLink,
@@ -209,6 +244,8 @@ export default class PushNotificationUtil {
209
244
  incidentEpisodeViewLink: string;
210
245
  episodeNumber?: number;
211
246
  episodeNumberWithPrefix?: string;
247
+ incidentEpisodeId?: string;
248
+ projectId?: string;
212
249
  }): PushNotificationMessage {
213
250
  const {
214
251
  incidentEpisodeTitle,
@@ -216,6 +253,8 @@ export default class PushNotificationUtil {
216
253
  incidentEpisodeViewLink,
217
254
  episodeNumber,
218
255
  episodeNumberWithPrefix,
256
+ incidentEpisodeId,
257
+ projectId,
219
258
  } = params;
220
259
  const displayNumber: string =
221
260
  episodeNumberWithPrefix || (episodeNumber ? `#${episodeNumber}` : "");
@@ -231,6 +270,9 @@ export default class PushNotificationUtil {
231
270
  requireInteraction: true,
232
271
  data: {
233
272
  type: "incident-episode-created",
273
+ entityType: "incident-episode",
274
+ entityId: incidentEpisodeId,
275
+ projectId: projectId,
234
276
  incidentEpisodeTitle: incidentEpisodeTitle,
235
277
  projectName: projectName,
236
278
  url: incidentEpisodeViewLink,
@@ -244,6 +286,8 @@ export default class PushNotificationUtil {
244
286
  newStatus: string;
245
287
  previousStatus?: string;
246
288
  monitorViewLink: string;
289
+ monitorId?: string;
290
+ projectId?: string;
247
291
  }): PushNotificationMessage {
248
292
  const {
249
293
  monitorName,
@@ -251,6 +295,8 @@ export default class PushNotificationUtil {
251
295
  newStatus,
252
296
  previousStatus,
253
297
  monitorViewLink,
298
+ monitorId,
299
+ projectId,
254
300
  } = params;
255
301
  const statusChangeText: string = previousStatus
256
302
  ? `Monitor status changed from ${previousStatus} to ${newStatus}`
@@ -264,6 +310,9 @@ export default class PushNotificationUtil {
264
310
  requireInteraction: true,
265
311
  data: {
266
312
  type: "monitor-status-changed",
313
+ entityType: "monitor",
314
+ entityId: monitorId,
315
+ projectId: projectId,
267
316
  monitorName: monitorName,
268
317
  projectName: projectName,
269
318
  newStatus: newStatus,
@@ -280,6 +329,8 @@ export default class PushNotificationUtil {
280
329
  viewLink: string;
281
330
  scheduledMaintenanceNumber?: number;
282
331
  scheduledMaintenanceNumberWithPrefix?: string;
332
+ scheduledMaintenanceId?: string;
333
+ projectId?: string;
283
334
  }): PushNotificationMessage {
284
335
  const {
285
336
  title,
@@ -288,6 +339,8 @@ export default class PushNotificationUtil {
288
339
  viewLink,
289
340
  scheduledMaintenanceNumber,
290
341
  scheduledMaintenanceNumberWithPrefix,
342
+ scheduledMaintenanceId,
343
+ projectId,
291
344
  } = params;
292
345
  const displayNumber: string =
293
346
  scheduledMaintenanceNumberWithPrefix ||
@@ -304,6 +357,9 @@ export default class PushNotificationUtil {
304
357
  requireInteraction: false,
305
358
  data: {
306
359
  type: "scheduled-maintenance",
360
+ entityType: "scheduled-maintenance",
361
+ entityId: scheduledMaintenanceId,
362
+ projectId: projectId,
307
363
  title: title,
308
364
  projectName: projectName,
309
365
  state: state,
@@ -361,7 +361,7 @@ export default class MicrosoftTeamsAlertActions {
361
361
  await this.buildExecuteAlertOnCallPolicyCard(actionValue, projectId);
362
362
  if (!card) {
363
363
  await turnContext.sendActivity(
364
- "No on-call policies found in the project",
364
+ "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
365
365
  );
366
366
  return;
367
367
  }
@@ -391,7 +391,7 @@ export default class MicrosoftTeamsAlertEpisodeActions {
391
391
  );
392
392
  if (!card) {
393
393
  await turnContext.sendActivity(
394
- "No on-call policies found in the project",
394
+ "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
395
395
  );
396
396
  return;
397
397
  }
@@ -495,11 +495,12 @@ export default class MicrosoftTeamsAlertEpisodeActions {
495
495
  // Update the state
496
496
  const episodeId: ObjectID = new ObjectID(actionValue);
497
497
 
498
- await AlertEpisodeService.updateOneById({
499
- id: episodeId,
500
- data: {
501
- currentAlertStateId: new ObjectID(alertStateId.toString()),
502
- },
498
+ await AlertEpisodeService.changeEpisodeState({
499
+ projectId: projectId,
500
+ episodeId: episodeId,
501
+ alertStateId: new ObjectID(alertStateId.toString()),
502
+ notifyOwners: true,
503
+ rootCause: "State changed via Microsoft Teams.",
503
504
  props: {
504
505
  isRoot: true,
505
506
  },
@@ -424,7 +424,7 @@ export default class MicrosoftTeamsIncidentActions {
424
424
  );
425
425
  if (!card) {
426
426
  await turnContext.sendActivity(
427
- "No on-call policies found in the project",
427
+ "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
428
428
  );
429
429
  return;
430
430
  }
@@ -403,7 +403,7 @@ export default class MicrosoftTeamsIncidentEpisodeActions {
403
403
  );
404
404
  if (!card) {
405
405
  await turnContext.sendActivity(
406
- "No on-call policies found in the project",
406
+ "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
407
407
  );
408
408
  return;
409
409
  }
@@ -505,11 +505,12 @@ export default class MicrosoftTeamsIncidentEpisodeActions {
505
505
  // Update the state
506
506
  const episodeId: ObjectID = new ObjectID(actionValue);
507
507
 
508
- await IncidentEpisodeService.updateOneById({
509
- id: episodeId,
510
- data: {
511
- currentIncidentStateId: new ObjectID(incidentStateId.toString()),
512
- },
508
+ await IncidentEpisodeService.changeEpisodeState({
509
+ projectId: projectId,
510
+ episodeId: episodeId,
511
+ incidentStateId: new ObjectID(incidentStateId.toString()),
512
+ notifyOwners: true,
513
+ rootCause: "State changed via Microsoft Teams.",
513
514
  props: {
514
515
  isRoot: true,
515
516
  },
@@ -322,6 +322,23 @@ export default class SlackAlertActions {
322
322
  return option.label !== "" || option.value !== "";
323
323
  });
324
324
 
325
+ if (dropdownOption.length === 0) {
326
+ if (data.slackRequest.slackChannelId) {
327
+ await SlackUtil.sendEphemeralMessageToChannel({
328
+ messageBlocks: [
329
+ {
330
+ _type: "WorkspacePayloadMarkdown",
331
+ text: "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
332
+ } as WorkspacePayloadMarkdown,
333
+ ],
334
+ authToken: data.slackRequest.projectAuthToken!,
335
+ channelId: data.slackRequest.slackChannelId,
336
+ userId: data.slackRequest.slackUserId!,
337
+ });
338
+ }
339
+ return;
340
+ }
341
+
325
342
  const onCallPolicyDropdown: WorkspaceDropdownBlock = {
326
343
  _type: "WorkspaceDropdownBlock",
327
344
  label: "On Call Policy",
@@ -21,7 +21,7 @@ import UserNotificationEventType from "../../../../../Types/UserNotification/Use
21
21
  import AlertState from "../../../../../Models/DatabaseModels/AlertState";
22
22
  import AlertStateService from "../../../../Services/AlertStateService";
23
23
  import logger from "../../../Logger";
24
- import AccessTokenService from "../../../../Services/AccessTokenService";
24
+
25
25
  import CaptureSpan from "../../../Telemetry/CaptureSpan";
26
26
  import WorkspaceNotificationLogService from "../../../../Services/WorkspaceNotificationLogService";
27
27
  import WorkspaceUserAuthTokenService from "../../../../Services/WorkspaceUserAuthTokenService";
@@ -305,6 +305,23 @@ export default class SlackAlertEpisodeActions {
305
305
  return option.label !== "" || option.value !== "";
306
306
  });
307
307
 
308
+ if (dropdownOption.length === 0) {
309
+ if (data.slackRequest.slackChannelId) {
310
+ await SlackUtil.sendEphemeralMessageToChannel({
311
+ messageBlocks: [
312
+ {
313
+ _type: "WorkspacePayloadMarkdown",
314
+ text: "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
315
+ } as WorkspacePayloadMarkdown,
316
+ ],
317
+ authToken: data.slackRequest.projectAuthToken!,
318
+ channelId: data.slackRequest.slackChannelId,
319
+ userId: data.slackRequest.slackUserId!,
320
+ });
321
+ }
322
+ return;
323
+ }
324
+
308
325
  const onCallPolicyDropdown: WorkspaceDropdownBlock = {
309
326
  _type: "WorkspaceDropdownBlock",
310
327
  label: "On Call Policy",
@@ -438,18 +455,16 @@ export default class SlackAlertEpisodeActions {
438
455
 
439
456
  const stateId: ObjectID = new ObjectID(stateString);
440
457
 
441
- await AlertEpisodeService.updateOneById({
442
- id: episodeId,
443
- data: {
444
- currentAlertStateId: stateId,
458
+ await AlertEpisodeService.changeEpisodeState({
459
+ projectId: data.slackRequest.projectId!,
460
+ episodeId: episodeId,
461
+ alertStateId: stateId,
462
+ notifyOwners: true,
463
+ rootCause: "State changed via Slack.",
464
+ props: {
465
+ isRoot: true,
466
+ userId: data.slackRequest.userId!,
445
467
  },
446
- props:
447
- await AccessTokenService.getDatabaseCommonInteractionPropsByUserAndProject(
448
- {
449
- userId: data.slackRequest.userId!,
450
- projectId: data.slackRequest.projectId!,
451
- },
452
- ),
453
468
  });
454
469
 
455
470
  // Log the button interaction
@@ -782,6 +782,23 @@ export default class SlackIncidentActions {
782
782
  return option.label !== "" || option.value !== "";
783
783
  });
784
784
 
785
+ if (dropdownOption.length === 0) {
786
+ if (data.slackRequest.slackChannelId) {
787
+ await SlackUtil.sendEphemeralMessageToChannel({
788
+ messageBlocks: [
789
+ {
790
+ _type: "WorkspacePayloadMarkdown",
791
+ text: "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
792
+ } as WorkspacePayloadMarkdown,
793
+ ],
794
+ authToken: data.slackRequest.projectAuthToken!,
795
+ channelId: data.slackRequest.slackChannelId,
796
+ userId: data.slackRequest.slackUserId!,
797
+ });
798
+ }
799
+ return;
800
+ }
801
+
785
802
  const onCallPolicyDropdown: WorkspaceDropdownBlock = {
786
803
  _type: "WorkspaceDropdownBlock",
787
804
  label: "On Call Policy",
@@ -13,6 +13,7 @@ import {
13
13
  WorkspaceTextAreaBlock,
14
14
  } from "../../../../../Types/Workspace/WorkspaceMessagePayload";
15
15
  import IncidentEpisodeInternalNoteService from "../../../../Services/IncidentEpisodeInternalNoteService";
16
+ import IncidentEpisodePublicNoteService from "../../../../Services/IncidentEpisodePublicNoteService";
16
17
  import OnCallDutyPolicy from "../../../../../Models/DatabaseModels/OnCallDutyPolicy";
17
18
  import OnCallDutyPolicyService from "../../../../Services/OnCallDutyPolicyService";
18
19
  import { LIMIT_PER_PROJECT } from "../../../../../Types/Database/LimitMax";
@@ -21,7 +22,7 @@ import UserNotificationEventType from "../../../../../Types/UserNotification/Use
21
22
  import IncidentState from "../../../../../Models/DatabaseModels/IncidentState";
22
23
  import IncidentStateService from "../../../../Services/IncidentStateService";
23
24
  import logger from "../../../Logger";
24
- import AccessTokenService from "../../../../Services/AccessTokenService";
25
+
25
26
  import CaptureSpan from "../../../Telemetry/CaptureSpan";
26
27
  import WorkspaceNotificationLogService from "../../../../Services/WorkspaceNotificationLogService";
27
28
  import WorkspaceUserAuthTokenService from "../../../../Services/WorkspaceUserAuthTokenService";
@@ -275,9 +276,7 @@ export default class SlackIncidentEpisodeActions {
275
276
  }
276
277
 
277
278
  // We send this early let slack know we're ok. We'll do the rest in the background.
278
- Response.sendJsonObjectResponse(req, res, {
279
- response_action: "clear",
280
- });
279
+ Response.sendTextResponse(req, res, "");
281
280
 
282
281
  const onCallPolicies: Array<OnCallDutyPolicy> =
283
282
  await OnCallDutyPolicyService.findBy({
@@ -305,6 +304,23 @@ export default class SlackIncidentEpisodeActions {
305
304
  return option.label !== "" || option.value !== "";
306
305
  });
307
306
 
307
+ if (dropdownOption.length === 0) {
308
+ if (data.slackRequest.slackChannelId) {
309
+ await SlackUtil.sendEphemeralMessageToChannel({
310
+ messageBlocks: [
311
+ {
312
+ _type: "WorkspacePayloadMarkdown",
313
+ text: "No on-call policies have been configured for this project yet. Please add an on-call policy in the OneUptime Dashboard under On-Call Duty > Policies to use this feature.",
314
+ } as WorkspacePayloadMarkdown,
315
+ ],
316
+ authToken: data.slackRequest.projectAuthToken!,
317
+ channelId: data.slackRequest.slackChannelId,
318
+ userId: data.slackRequest.slackUserId!,
319
+ });
320
+ }
321
+ return;
322
+ }
323
+
308
324
  const onCallPolicyDropdown: WorkspaceDropdownBlock = {
309
325
  _type: "WorkspaceDropdownBlock",
310
326
  label: "On Call Policy",
@@ -349,9 +365,7 @@ export default class SlackIncidentEpisodeActions {
349
365
  }
350
366
 
351
367
  // We send this early let slack know we're ok. We'll do the rest in the background.
352
- Response.sendJsonObjectResponse(req, res, {
353
- response_action: "clear",
354
- });
368
+ Response.sendTextResponse(req, res, "");
355
369
 
356
370
  // Incident Episodes use incident states
357
371
  const incidentStates: Array<IncidentState> =
@@ -438,18 +452,16 @@ export default class SlackIncidentEpisodeActions {
438
452
 
439
453
  const stateId: ObjectID = new ObjectID(stateString);
440
454
 
441
- await IncidentEpisodeService.updateOneById({
442
- id: episodeId,
443
- data: {
444
- currentIncidentStateId: stateId,
455
+ await IncidentEpisodeService.changeEpisodeState({
456
+ projectId: data.slackRequest.projectId!,
457
+ episodeId: episodeId,
458
+ incidentStateId: stateId,
459
+ notifyOwners: true,
460
+ rootCause: "State changed via Slack.",
461
+ props: {
462
+ isRoot: true,
463
+ userId: data.slackRequest.userId!,
445
464
  },
446
- props:
447
- await AccessTokenService.getDatabaseCommonInteractionPropsByUserAndProject(
448
- {
449
- userId: data.slackRequest.userId!,
450
- projectId: data.slackRequest.projectId!,
451
- },
452
- ),
453
465
  });
454
466
 
455
467
  // Log the button interaction
@@ -610,6 +622,14 @@ export default class SlackIncidentEpisodeActions {
610
622
  );
611
623
  }
612
624
 
625
+ if (!data.slackRequest.viewValues["noteType"]) {
626
+ return Response.sendErrorResponse(
627
+ req,
628
+ res,
629
+ new BadDataException("Invalid Note Type"),
630
+ );
631
+ }
632
+
613
633
  if (!data.slackRequest.viewValues["note"]) {
614
634
  return Response.sendErrorResponse(
615
635
  req,
@@ -620,18 +640,41 @@ export default class SlackIncidentEpisodeActions {
620
640
 
621
641
  const episodeId: ObjectID = new ObjectID(actionValue);
622
642
  const note: string = data.slackRequest.viewValues["note"].toString();
643
+ const noteType: string =
644
+ data.slackRequest.viewValues["noteType"].toString();
645
+
646
+ if (noteType !== "public" && noteType !== "private") {
647
+ return Response.sendErrorResponse(
648
+ req,
649
+ res,
650
+ new BadDataException("Invalid Note Type"),
651
+ );
652
+ }
623
653
 
624
654
  // send empty response.
625
655
  Response.sendJsonObjectResponse(req, res, {
626
656
  response_action: "clear",
627
657
  });
628
658
 
629
- await IncidentEpisodeInternalNoteService.addNote({
630
- incidentEpisodeId: episodeId!,
631
- note: note || "",
632
- projectId: data.slackRequest.projectId!,
633
- userId: data.slackRequest.userId!,
634
- });
659
+ // if public note then, add a note.
660
+ if (noteType === "public") {
661
+ await IncidentEpisodePublicNoteService.addNote({
662
+ incidentEpisodeId: episodeId!,
663
+ note: note || "",
664
+ projectId: data.slackRequest.projectId!,
665
+ userId: data.slackRequest.userId!,
666
+ });
667
+ }
668
+
669
+ // if private note then, add a note.
670
+ if (noteType === "private") {
671
+ await IncidentEpisodeInternalNoteService.addNote({
672
+ incidentEpisodeId: episodeId!,
673
+ note: note || "",
674
+ projectId: data.slackRequest.projectId!,
675
+ userId: data.slackRequest.userId!,
676
+ });
677
+ }
635
678
  }
636
679
 
637
680
  @CaptureSpan()
@@ -653,9 +696,24 @@ export default class SlackIncidentEpisodeActions {
653
696
  }
654
697
 
655
698
  // We send this early let slack know we're ok. We'll do the rest in the background.
656
- Response.sendJsonObjectResponse(req, res, {
657
- response_action: "clear",
658
- });
699
+ Response.sendTextResponse(req, res, "");
700
+
701
+ const notePickerDropdown: WorkspaceDropdownBlock = {
702
+ _type: "WorkspaceDropdownBlock",
703
+ label: "Note Type",
704
+ blockId: "noteType",
705
+ placeholder: "Select Note Type",
706
+ options: [
707
+ {
708
+ label: "Public Note (Will be posted on Status Page)",
709
+ value: "public",
710
+ },
711
+ {
712
+ label: "Private Note (Only visible to team members)",
713
+ value: "private",
714
+ },
715
+ ],
716
+ };
659
717
 
660
718
  const noteTextArea: WorkspaceTextAreaBlock = {
661
719
  _type: "WorkspaceTextAreaBlock",
@@ -672,7 +730,7 @@ export default class SlackIncidentEpisodeActions {
672
730
  cancelButtonTitle: "Cancel",
673
731
  actionId: SlackActionType.SubmitIncidentEpisodeNote,
674
732
  actionValue: actionValue,
675
- blocks: [noteTextArea],
733
+ blocks: [notePickerDropdown, noteTextArea],
676
734
  };
677
735
 
678
736
  await SlackUtil.showModalToUser({
@@ -47,7 +47,7 @@ export default class SlackIncidentEpisodeMessages {
47
47
  // view data.
48
48
  const viewIncidentEpisodeButton: WorkspaceMessagePayloadButton = {
49
49
  _type: "WorkspaceMessagePayloadButton",
50
- title: "View Episode",
50
+ title: "🔗 View Episode",
51
51
  url: await IncidentEpisodeService.getEpisodeLinkInDashboard(
52
52
  data.projectId!,
53
53
  data.incidentEpisodeId!,
@@ -61,7 +61,7 @@ export default class SlackIncidentEpisodeMessages {
61
61
  // execute on call.
62
62
  const executeOnCallButton: WorkspaceMessagePayloadButton = {
63
63
  _type: "WorkspaceMessagePayloadButton",
64
- title: "Execute On Call",
64
+ title: "📞 Execute On Call",
65
65
  value: data.incidentEpisodeId?.toString() || "",
66
66
  actionId: SlackActionType.ViewExecuteIncidentEpisodeOnCallPolicy,
67
67
  };
@@ -71,7 +71,7 @@ export default class SlackIncidentEpisodeMessages {
71
71
  // acknowledge data.
72
72
  const acknowledgeIncidentEpisodeButton: WorkspaceMessagePayloadButton = {
73
73
  _type: "WorkspaceMessagePayloadButton",
74
- title: "Acknowledge Episode",
74
+ title: "👀 Acknowledge Episode",
75
75
  value: data.incidentEpisodeId?.toString() || "",
76
76
  actionId: SlackActionType.AcknowledgeIncidentEpisode,
77
77
  };
@@ -81,7 +81,7 @@ export default class SlackIncidentEpisodeMessages {
81
81
  // resolve data.
82
82
  const resolveIncidentEpisodeButton: WorkspaceMessagePayloadButton = {
83
83
  _type: "WorkspaceMessagePayloadButton",
84
- title: "Resolve Episode",
84
+ title: "Resolve Episode",
85
85
  value: data.incidentEpisodeId?.toString() || "",
86
86
  actionId: SlackActionType.ResolveIncidentEpisode,
87
87
  };
@@ -91,7 +91,7 @@ export default class SlackIncidentEpisodeMessages {
91
91
  // change incident episode state.
92
92
  const changeIncidentEpisodeStateButton: WorkspaceMessagePayloadButton = {
93
93
  _type: "WorkspaceMessagePayloadButton",
94
- title: "Change Episode State",
94
+ title: "➡️ Change Episode State",
95
95
  value: data.incidentEpisodeId?.toString() || "",
96
96
  actionId: SlackActionType.ViewChangeIncidentEpisodeState,
97
97
  };
@@ -101,7 +101,7 @@ export default class SlackIncidentEpisodeMessages {
101
101
  // add note.
102
102
  const addNoteButton: WorkspaceMessagePayloadButton = {
103
103
  _type: "WorkspaceMessagePayloadButton",
104
- title: "Add Note",
104
+ title: "📄 Add Note",
105
105
  value: data.incidentEpisodeId?.toString() || "",
106
106
  actionId: SlackActionType.ViewAddIncidentEpisodeNote,
107
107
  };