@oneuptime/common 9.4.7 → 9.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Alert.ts +76 -0
- package/Models/DatabaseModels/AlertEpisode.ts +1201 -0
- package/Models/DatabaseModels/AlertEpisodeFeed.ts +529 -0
- package/Models/DatabaseModels/AlertEpisodeInternalNote.ts +455 -0
- package/Models/DatabaseModels/AlertEpisodeMember.ts +586 -0
- package/Models/DatabaseModels/AlertEpisodeOwnerTeam.ts +421 -0
- package/Models/DatabaseModels/AlertEpisodeOwnerUser.ts +419 -0
- package/Models/DatabaseModels/AlertEpisodeStateTimeline.ts +523 -0
- package/Models/DatabaseModels/AlertFeed.ts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.ts +1432 -0
- package/Models/DatabaseModels/Index.ts +18 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +70 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.ts +59 -0
- package/Models/DatabaseModels/StatusPageDomain.ts +2 -0
- package/Models/DatabaseModels/UserOnCallLog.ts +48 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +49 -0
- package/Models/DatabaseModels/WorkspaceNotificationLog.ts +57 -0
- package/Server/API/SlackAPI.ts +21 -0
- package/Server/API/UserOnCallLogTimelineAPI.ts +65 -25
- package/Server/Infrastructure/Postgres/SchemaMigrations/1768938069147-MigrationName.ts +751 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769125561322-MigrationName.ts +41 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769170578688-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769172358833-MigrationName.ts +177 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769176450526-MigrationName.ts +71 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769190495840-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769199303656-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769202898645-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769428619414-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769428821686-MigrationName.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769469813786-MigrationName.ts +71 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769517677937-RenameNotificationRuleTypes.ts +67 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +24 -0
- package/Server/Services/AlertEpisodeFeedService.ts +94 -0
- package/Server/Services/AlertEpisodeInternalNoteService.ts +71 -0
- package/Server/Services/AlertEpisodeMemberService.ts +267 -0
- package/Server/Services/AlertEpisodeOwnerTeamService.ts +10 -0
- package/Server/Services/AlertEpisodeOwnerUserService.ts +10 -0
- package/Server/Services/AlertEpisodeService.ts +1096 -0
- package/Server/Services/AlertEpisodeStateTimelineService.ts +557 -0
- package/Server/Services/AlertGroupingEngineService.ts +1120 -0
- package/Server/Services/AlertGroupingRuleService.ts +14 -0
- package/Server/Services/AlertService.ts +12 -0
- package/Server/Services/CallService.ts +2 -0
- package/Server/Services/Index.ts +21 -0
- package/Server/Services/MailService.ts +5 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +18 -1
- package/Server/Services/OnCallDutyPolicyExecutionLogService.ts +64 -2
- package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +27 -1
- package/Server/Services/OnCallDutyPolicyService.ts +16 -1
- package/Server/Services/PushNotificationService.ts +1 -0
- package/Server/Services/SmsService.ts +2 -0
- package/Server/Services/UserNotificationRuleService.ts +641 -10
- package/Server/Services/UserNotificationSettingService.ts +23 -0
- package/Server/Services/UserOnCallLogService.ts +58 -14
- package/Server/Services/WhatsAppService.ts +5 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +26 -0
- package/Server/Utils/AnalyticsDatabase/Statement.ts +6 -2
- package/Server/Utils/PushNotificationUtil.ts +75 -16
- package/Server/Utils/WhatsAppTemplateUtil.ts +13 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.ts +18 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +689 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +16 -0
- package/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +11 -0
- package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +915 -0
- package/Server/Utils/Workspace/Slack/Messages/AlertEpisode.ts +120 -0
- package/Server/Utils/Workspace/WorkspaceMessages/AlertEpisode.ts +74 -0
- package/Tests/Server/Services/AlertEpisodeMemberService.test.ts +200 -0
- package/Tests/Server/Services/AlertEpisodeService.test.ts +240 -0
- package/Tests/Server/Services/AlertGroupingEngineService.test.ts +542 -0
- package/Tests/Server/Services/AlertGroupingRuleService.test.ts +383 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +1 -1
- package/Tests/UI/Components/Input.test.tsx +1 -1
- package/Tests/UI/Components/TextArea.test.tsx +2 -2
- package/Types/BaseDatabase/SortOrder.ts +9 -0
- package/Types/Email/EmailTemplateType.ts +6 -0
- package/Types/NotificationRule/NotificationRuleType.ts +3 -1
- package/Types/NotificationSetting/NotificationSettingEventType.ts +7 -0
- package/Types/Permission.ts +309 -0
- package/Types/UserNotification/UserNotificationEventType.ts +1 -0
- package/Types/WhatsApp/WhatsAppTemplates.ts +24 -0
- package/Types/Workspace/NotificationRules/EventType.ts +1 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +32 -3
- package/UI/Components/Accordion/Accordion.tsx +20 -2
- package/UI/Components/Alerts/Alert.tsx +1 -0
- package/UI/Components/Button/Button.tsx +29 -0
- package/UI/Components/CardSelect/CardSelect.tsx +5 -1
- package/UI/Components/Checkbox/Checkbox.tsx +7 -3
- package/UI/Components/ColorCircle/ColorCircle.tsx +2 -0
- package/UI/Components/ColorViewer/ColorViewer.tsx +19 -3
- package/UI/Components/CopyableButton/CopyableButton.tsx +22 -5
- package/UI/Components/Detail/Detail.tsx +1 -1
- package/UI/Components/Dropdown/Dropdown.tsx +14 -1
- package/UI/Components/Forms/Fields/FormField.tsx +28 -0
- package/UI/Components/FullPageModal/FullPageModal.tsx +35 -4
- package/UI/Components/Input/Input.tsx +14 -2
- package/UI/Components/Link/Link.tsx +1 -0
- package/UI/Components/Loader/Loader.tsx +8 -2
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +76 -1
- package/UI/Components/Modal/Modal.tsx +47 -3
- package/UI/Components/ModelTable/BaseModelTable.tsx +42 -1
- package/UI/Components/MoreMenu/MoreMenu.tsx +84 -2
- package/UI/Components/OrderedStatesList/OrderedStatesList.tsx +30 -8
- package/UI/Components/Pagination/Pagination.tsx +113 -8
- package/UI/Components/ProgressBar/ProgressBar.tsx +12 -2
- package/UI/Components/Radio/Radio.tsx +21 -3
- package/UI/Components/SideMenu/CountModelSideMenuItem.tsx +54 -27
- package/UI/Components/StatusBubble/StatusBubble.tsx +7 -2
- package/UI/Components/Table/TableHeader.tsx +20 -3
- package/UI/Components/Tabs/Tab.tsx +16 -1
- package/UI/Components/Tabs/Tabs.tsx +12 -1
- package/UI/Components/TextArea/TextArea.tsx +12 -2
- package/UI/Components/Toggle/Toggle.tsx +14 -3
- package/UI/Components/Tooltip/Tooltip.tsx +11 -1
- package/UI/Components/TopAlert/TopAlert.tsx +2 -0
- package/build/dist/Models/DatabaseModels/Alert.js +77 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertEpisode.js +1225 -0
- package/build/dist/Models/DatabaseModels/AlertEpisode.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeFeed.js +553 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeInternalNote.js +467 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeInternalNote.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js +607 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeOwnerTeam.js +437 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeOwnerUser.js +436 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js +546 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertFeed.js +1 -0
- package/build/dist/Models/DatabaseModels/AlertFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertGroupingRule.js +1437 -0
- package/build/dist/Models/DatabaseModels/AlertGroupingRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +16 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +69 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +58 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js +2 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLog.js +47 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js +58 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +18 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +55 -15
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1768938069147-MigrationName.js +266 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1768938069147-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769125561322-MigrationName.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769125561322-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769170578688-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769170578688-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769172358833-MigrationName.js +68 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769172358833-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769176450526-MigrationName.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769176450526-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769190495840-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769190495840-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769199303656-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769199303656-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769202898645-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769202898645-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769428619414-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769428619414-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769428821686-MigrationName.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769428821686-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769469813786-MigrationName.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769469813786-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769517677937-RenameNotificationRuleTypes.js +67 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769517677937-RenameNotificationRuleTypes.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeFeedService.js +83 -0
- package/build/dist/Server/Services/AlertEpisodeFeedService.js.map +1 -0
- package/build/dist/Server/Services/AlertEpisodeInternalNoteService.js +70 -0
- package/build/dist/Server/Services/AlertEpisodeInternalNoteService.js.map +1 -0
- package/build/dist/Server/Services/AlertEpisodeMemberService.js +256 -0
- package/build/dist/Server/Services/AlertEpisodeMemberService.js.map +1 -0
- package/build/dist/Server/Services/AlertEpisodeOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/AlertEpisodeOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/AlertEpisodeOwnerUserService.js +9 -0
- package/build/dist/Server/Services/AlertEpisodeOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/AlertEpisodeService.js +973 -0
- package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -0
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +494 -0
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -0
- package/build/dist/Server/Services/AlertGroupingEngineService.js +893 -0
- package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -0
- package/build/dist/Server/Services/AlertGroupingRuleService.js +13 -0
- package/build/dist/Server/Services/AlertGroupingRuleService.js.map +1 -0
- package/build/dist/Server/Services/AlertService.js +11 -0
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/CallService.js +11 -10
- package/build/dist/Server/Services/CallService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +18 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MailService.js +3 -0
- package/build/dist/Server/Services/MailService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +10 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js +49 -2
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +21 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +9 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/PushNotificationService.js.map +1 -1
- package/build/dist/Server/Services/SmsService.js +11 -10
- package/build/dist/Server/Services/SmsService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +521 -43
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +9 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +48 -12
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/WhatsAppService.js +3 -0
- package/build/dist/Server/Services/WhatsAppService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +25 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +4 -2
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
- package/build/dist/Server/Utils/PushNotificationUtil.js +51 -16
- package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +8 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js +17 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +545 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +13 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js +10 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +651 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/Slack/Messages/AlertEpisode.js +100 -0
- package/build/dist/Server/Utils/Workspace/Slack/Messages/AlertEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/AlertEpisode.js +70 -0
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/AlertEpisode.js.map +1 -0
- package/build/dist/Tests/Server/Services/AlertEpisodeMemberService.test.js +165 -0
- package/build/dist/Tests/Server/Services/AlertEpisodeMemberService.test.js.map +1 -0
- package/build/dist/Tests/Server/Services/AlertEpisodeService.test.js +193 -0
- package/build/dist/Tests/Server/Services/AlertEpisodeService.test.js.map +1 -0
- package/build/dist/Tests/Server/Services/AlertGroupingEngineService.test.js +412 -0
- package/build/dist/Tests/Server/Services/AlertGroupingEngineService.test.js.map +1 -0
- package/build/dist/Tests/Server/Services/AlertGroupingRuleService.test.js +308 -0
- package/build/dist/Tests/Server/Services/AlertGroupingRuleService.test.js.map +1 -0
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js +1 -1
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/Input.test.js +1 -1
- package/build/dist/Tests/UI/Components/Input.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/TextArea.test.js +2 -2
- package/build/dist/Tests/UI/Components/TextArea.test.js.map +1 -1
- package/build/dist/Types/BaseDatabase/SortOrder.js +5 -0
- package/build/dist/Types/BaseDatabase/SortOrder.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +5 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/NotificationRule/NotificationRuleType.js +3 -1
- package/build/dist/Types/NotificationRule/NotificationRuleType.js.map +1 -1
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +5 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +264 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/UserNotification/UserNotificationEventType.js +1 -0
- package/build/dist/Types/UserNotification/UserNotificationEventType.js.map +1 -1
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +15 -0
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/EventType.js +1 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +28 -3
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -1
- package/build/dist/UI/Components/Accordion/Accordion.js +10 -3
- package/build/dist/UI/Components/Accordion/Accordion.js.map +1 -1
- package/build/dist/UI/Components/Alerts/Alert.js +1 -1
- package/build/dist/UI/Components/Alerts/Alert.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +8 -2
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/CardSelect/CardSelect.js +1 -1
- package/build/dist/UI/Components/CardSelect/CardSelect.js.map +1 -1
- package/build/dist/UI/Components/Checkbox/Checkbox.js +2 -2
- package/build/dist/UI/Components/Checkbox/Checkbox.js.map +1 -1
- package/build/dist/UI/Components/ColorCircle/ColorCircle.js +1 -1
- package/build/dist/UI/Components/ColorCircle/ColorCircle.js.map +1 -1
- package/build/dist/UI/Components/ColorViewer/ColorViewer.js +12 -3
- package/build/dist/UI/Components/ColorViewer/ColorViewer.js.map +1 -1
- package/build/dist/UI/Components/CopyableButton/CopyableButton.js +12 -5
- package/build/dist/UI/Components/CopyableButton/CopyableButton.js.map +1 -1
- package/build/dist/UI/Components/Detail/Detail.js +1 -1
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +5 -3
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +19 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/FullPageModal/FullPageModal.js +24 -5
- package/build/dist/UI/Components/FullPageModal/FullPageModal.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +3 -3
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/Link/Link.js +1 -1
- package/build/dist/UI/Components/Link/Link.js.map +1 -1
- package/build/dist/UI/Components/Loader/Loader.js +6 -4
- package/build/dist/UI/Components/Loader/Loader.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +56 -3
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +28 -3
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +23 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js +67 -6
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js.map +1 -1
- package/build/dist/UI/Components/OrderedStatesList/OrderedStatesList.js +14 -3
- package/build/dist/UI/Components/OrderedStatesList/OrderedStatesList.js.map +1 -1
- package/build/dist/UI/Components/Pagination/Pagination.js +69 -13
- package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
- package/build/dist/UI/Components/ProgressBar/ProgressBar.js +2 -2
- package/build/dist/UI/Components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/dist/UI/Components/Radio/Radio.js +8 -5
- package/build/dist/UI/Components/Radio/Radio.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/CountModelSideMenuItem.js +23 -4
- package/build/dist/UI/Components/SideMenu/CountModelSideMenuItem.js.map +1 -1
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js +2 -2
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js.map +1 -1
- package/build/dist/UI/Components/Table/TableHeader.js +12 -4
- package/build/dist/UI/Components/Table/TableHeader.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tab.js +8 -1
- package/build/dist/UI/Components/Tabs/Tab.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tabs.js +4 -3
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js +3 -3
- package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
- package/build/dist/UI/Components/Toggle/Toggle.js +7 -4
- package/build/dist/UI/Components/Toggle/Toggle.js.map +1 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js +4 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js.map +1 -1
- package/build/dist/UI/Components/TopAlert/TopAlert.js +1 -1
- package/build/dist/UI/Components/TopAlert/TopAlert.js.map +1 -1
- package/package.json +2 -1
|
@@ -51,6 +51,10 @@ import Alert from "../../Models/DatabaseModels/Alert";
|
|
|
51
51
|
import AlertService from "./AlertService";
|
|
52
52
|
import AlertSeverity from "../../Models/DatabaseModels/AlertSeverity";
|
|
53
53
|
import AlertSeverityService from "./AlertSeverityService";
|
|
54
|
+
import AlertEpisode from "../../Models/DatabaseModels/AlertEpisode";
|
|
55
|
+
import AlertEpisodeService from "./AlertEpisodeService";
|
|
56
|
+
import AlertEpisodeMember from "../../Models/DatabaseModels/AlertEpisodeMember";
|
|
57
|
+
import AlertEpisodeMemberService from "./AlertEpisodeMemberService";
|
|
54
58
|
import WorkspaceNotificationRule from "../../Models/DatabaseModels/WorkspaceNotificationRule";
|
|
55
59
|
import WorkspaceNotificationRuleService from "./WorkspaceNotificationRuleService";
|
|
56
60
|
import PushNotificationService from "./PushNotificationService";
|
|
@@ -73,6 +77,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
73
77
|
projectId: ObjectID;
|
|
74
78
|
triggeredByIncidentId?: ObjectID | undefined;
|
|
75
79
|
triggeredByAlertId?: ObjectID | undefined;
|
|
80
|
+
triggeredByAlertEpisodeId?: ObjectID | undefined;
|
|
76
81
|
userNotificationEventType: UserNotificationEventType;
|
|
77
82
|
onCallPolicyExecutionLogId?: ObjectID | undefined;
|
|
78
83
|
onCallPolicyId: ObjectID | undefined;
|
|
@@ -201,6 +206,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
201
206
|
logTimelineItem.triggeredByAlertId = options.triggeredByAlertId;
|
|
202
207
|
}
|
|
203
208
|
|
|
209
|
+
if (options.triggeredByAlertEpisodeId) {
|
|
210
|
+
logTimelineItem.triggeredByAlertEpisodeId =
|
|
211
|
+
options.triggeredByAlertEpisodeId;
|
|
212
|
+
}
|
|
213
|
+
|
|
204
214
|
if (options.onCallDutyPolicyExecutionLogTimelineId) {
|
|
205
215
|
logTimelineItem.onCallDutyPolicyExecutionLogTimelineId =
|
|
206
216
|
options.onCallDutyPolicyExecutionLogTimelineId;
|
|
@@ -210,6 +220,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
210
220
|
|
|
211
221
|
let incident: Incident | null = null;
|
|
212
222
|
let alert: Alert | null = null;
|
|
223
|
+
let alertEpisode: AlertEpisode | null = null;
|
|
213
224
|
|
|
214
225
|
if (
|
|
215
226
|
options.userNotificationEventType ===
|
|
@@ -270,8 +281,40 @@ export class Service extends DatabaseService<Model> {
|
|
|
270
281
|
});
|
|
271
282
|
}
|
|
272
283
|
|
|
273
|
-
if (
|
|
274
|
-
|
|
284
|
+
if (
|
|
285
|
+
options.userNotificationEventType ===
|
|
286
|
+
UserNotificationEventType.AlertEpisodeCreated &&
|
|
287
|
+
options.triggeredByAlertEpisodeId
|
|
288
|
+
) {
|
|
289
|
+
alertEpisode = await AlertEpisodeService.findOneById({
|
|
290
|
+
id: options.triggeredByAlertEpisodeId!,
|
|
291
|
+
props: {
|
|
292
|
+
isRoot: true,
|
|
293
|
+
},
|
|
294
|
+
select: {
|
|
295
|
+
_id: true,
|
|
296
|
+
title: true,
|
|
297
|
+
description: true,
|
|
298
|
+
projectId: true,
|
|
299
|
+
project: {
|
|
300
|
+
name: true,
|
|
301
|
+
},
|
|
302
|
+
currentAlertState: {
|
|
303
|
+
name: true,
|
|
304
|
+
},
|
|
305
|
+
alertSeverity: {
|
|
306
|
+
name: true,
|
|
307
|
+
},
|
|
308
|
+
episodeNumber: true,
|
|
309
|
+
rootCause: true,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (!incident && !alert && !alertEpisode) {
|
|
315
|
+
throw new BadDataException(
|
|
316
|
+
"Incident, Alert, or Alert Episode not found.",
|
|
317
|
+
);
|
|
275
318
|
}
|
|
276
319
|
|
|
277
320
|
if (
|
|
@@ -384,6 +427,56 @@ export class Service extends DatabaseService<Model> {
|
|
|
384
427
|
});
|
|
385
428
|
});
|
|
386
429
|
}
|
|
430
|
+
|
|
431
|
+
// send email for alert episode
|
|
432
|
+
if (
|
|
433
|
+
options.userNotificationEventType ===
|
|
434
|
+
UserNotificationEventType.AlertEpisodeCreated &&
|
|
435
|
+
alertEpisode
|
|
436
|
+
) {
|
|
437
|
+
logTimelineItem.status = UserNotificationStatus.Sending;
|
|
438
|
+
logTimelineItem.statusMessage = `Sending email to ${notificationRuleItem.userEmail?.email.toString()}`;
|
|
439
|
+
logTimelineItem.userEmailId = notificationRuleItem.userEmail.id!;
|
|
440
|
+
|
|
441
|
+
const updatedLog: UserOnCallLogTimeline =
|
|
442
|
+
await UserOnCallLogTimelineService.create({
|
|
443
|
+
data: logTimelineItem,
|
|
444
|
+
props: {
|
|
445
|
+
isRoot: true,
|
|
446
|
+
},
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
const emailMessage: EmailMessage =
|
|
450
|
+
await this.generateEmailTemplateForAlertEpisodeCreated(
|
|
451
|
+
notificationRuleItem.userEmail?.email,
|
|
452
|
+
alertEpisode,
|
|
453
|
+
updatedLog.id!,
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
MailService.sendMail(emailMessage, {
|
|
457
|
+
userOnCallLogTimelineId: updatedLog.id!,
|
|
458
|
+
projectId: options.projectId,
|
|
459
|
+
alertEpisodeId: alertEpisode.id!,
|
|
460
|
+
userId: notificationRuleItem.userId!,
|
|
461
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
462
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
463
|
+
teamId: options.userBelongsToTeamId,
|
|
464
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
465
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
466
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
467
|
+
}).catch(async (err: Error) => {
|
|
468
|
+
await UserOnCallLogTimelineService.updateOneById({
|
|
469
|
+
id: updatedLog.id!,
|
|
470
|
+
data: {
|
|
471
|
+
status: UserNotificationStatus.Error,
|
|
472
|
+
statusMessage: err.message || "Error sending email.",
|
|
473
|
+
},
|
|
474
|
+
props: {
|
|
475
|
+
isRoot: true,
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
}
|
|
387
480
|
}
|
|
388
481
|
|
|
389
482
|
// if you have an email but is not verified, then create a log.
|
|
@@ -512,6 +605,56 @@ export class Service extends DatabaseService<Model> {
|
|
|
512
605
|
});
|
|
513
606
|
});
|
|
514
607
|
}
|
|
608
|
+
|
|
609
|
+
// send sms for alert episode
|
|
610
|
+
if (
|
|
611
|
+
options.userNotificationEventType ===
|
|
612
|
+
UserNotificationEventType.AlertEpisodeCreated &&
|
|
613
|
+
alertEpisode
|
|
614
|
+
) {
|
|
615
|
+
logTimelineItem.status = UserNotificationStatus.Sending;
|
|
616
|
+
logTimelineItem.statusMessage = `Sending SMS to ${notificationRuleItem.userSms?.phone.toString()}.`;
|
|
617
|
+
logTimelineItem.userSmsId = notificationRuleItem.userSms.id!;
|
|
618
|
+
|
|
619
|
+
const updatedLog: UserOnCallLogTimeline =
|
|
620
|
+
await UserOnCallLogTimelineService.create({
|
|
621
|
+
data: logTimelineItem,
|
|
622
|
+
props: {
|
|
623
|
+
isRoot: true,
|
|
624
|
+
},
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
const smsMessage: SMS =
|
|
628
|
+
await this.generateSmsTemplateForAlertEpisodeCreated(
|
|
629
|
+
notificationRuleItem.userSms.phone,
|
|
630
|
+
alertEpisode,
|
|
631
|
+
updatedLog.id!,
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
SmsService.sendSms(smsMessage, {
|
|
635
|
+
projectId: alertEpisode.projectId,
|
|
636
|
+
userOnCallLogTimelineId: updatedLog.id!,
|
|
637
|
+
alertEpisodeId: alertEpisode.id!,
|
|
638
|
+
userId: notificationRuleItem.userId!,
|
|
639
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
640
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
641
|
+
teamId: options.userBelongsToTeamId,
|
|
642
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
643
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
644
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
645
|
+
}).catch(async (err: Error) => {
|
|
646
|
+
await UserOnCallLogTimelineService.updateOneById({
|
|
647
|
+
id: updatedLog.id!,
|
|
648
|
+
data: {
|
|
649
|
+
status: UserNotificationStatus.Error,
|
|
650
|
+
statusMessage: err.message || "Error sending SMS.",
|
|
651
|
+
},
|
|
652
|
+
props: {
|
|
653
|
+
isRoot: true,
|
|
654
|
+
},
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
}
|
|
515
658
|
}
|
|
516
659
|
|
|
517
660
|
if (
|
|
@@ -631,6 +774,56 @@ export class Service extends DatabaseService<Model> {
|
|
|
631
774
|
});
|
|
632
775
|
});
|
|
633
776
|
}
|
|
777
|
+
|
|
778
|
+
// send WhatsApp for alert episode
|
|
779
|
+
if (
|
|
780
|
+
options.userNotificationEventType ===
|
|
781
|
+
UserNotificationEventType.AlertEpisodeCreated &&
|
|
782
|
+
alertEpisode
|
|
783
|
+
) {
|
|
784
|
+
logTimelineItem.status = UserNotificationStatus.Sending;
|
|
785
|
+
logTimelineItem.statusMessage = `Sending WhatsApp message to ${notificationRuleItem.userWhatsApp?.phone.toString()}.`;
|
|
786
|
+
logTimelineItem.userWhatsAppId = notificationRuleItem.userWhatsApp.id!;
|
|
787
|
+
|
|
788
|
+
const updatedLog: UserOnCallLogTimeline =
|
|
789
|
+
await UserOnCallLogTimelineService.create({
|
|
790
|
+
data: logTimelineItem,
|
|
791
|
+
props: {
|
|
792
|
+
isRoot: true,
|
|
793
|
+
},
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
const whatsAppMessage: WhatsAppMessage =
|
|
797
|
+
await this.generateWhatsAppTemplateForAlertEpisodeCreated(
|
|
798
|
+
notificationRuleItem.userWhatsApp.phone,
|
|
799
|
+
alertEpisode,
|
|
800
|
+
updatedLog.id!,
|
|
801
|
+
);
|
|
802
|
+
|
|
803
|
+
WhatsAppService.sendWhatsAppMessage(whatsAppMessage, {
|
|
804
|
+
projectId: alertEpisode.projectId,
|
|
805
|
+
alertEpisodeId: alertEpisode.id!,
|
|
806
|
+
userOnCallLogTimelineId: updatedLog.id!,
|
|
807
|
+
userId: notificationRuleItem.userId!,
|
|
808
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
809
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
810
|
+
teamId: options.userBelongsToTeamId,
|
|
811
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
812
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
813
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
814
|
+
}).catch(async (err: Error) => {
|
|
815
|
+
await UserOnCallLogTimelineService.updateOneById({
|
|
816
|
+
id: updatedLog.id!,
|
|
817
|
+
data: {
|
|
818
|
+
status: UserNotificationStatus.Error,
|
|
819
|
+
statusMessage: err.message || "Error sending WhatsApp message.",
|
|
820
|
+
},
|
|
821
|
+
props: {
|
|
822
|
+
isRoot: true,
|
|
823
|
+
},
|
|
824
|
+
});
|
|
825
|
+
});
|
|
826
|
+
}
|
|
634
827
|
}
|
|
635
828
|
|
|
636
829
|
if (
|
|
@@ -758,6 +951,56 @@ export class Service extends DatabaseService<Model> {
|
|
|
758
951
|
});
|
|
759
952
|
});
|
|
760
953
|
}
|
|
954
|
+
|
|
955
|
+
// send call for alert episode
|
|
956
|
+
if (
|
|
957
|
+
options.userNotificationEventType ===
|
|
958
|
+
UserNotificationEventType.AlertEpisodeCreated &&
|
|
959
|
+
alertEpisode
|
|
960
|
+
) {
|
|
961
|
+
logTimelineItem.status = UserNotificationStatus.Sending;
|
|
962
|
+
logTimelineItem.statusMessage = `Making a call to ${notificationRuleItem.userCall?.phone.toString()}.`;
|
|
963
|
+
logTimelineItem.userCallId = notificationRuleItem.userCall.id!;
|
|
964
|
+
|
|
965
|
+
const updatedLog: UserOnCallLogTimeline =
|
|
966
|
+
await UserOnCallLogTimelineService.create({
|
|
967
|
+
data: logTimelineItem,
|
|
968
|
+
props: {
|
|
969
|
+
isRoot: true,
|
|
970
|
+
},
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
const callRequest: CallRequest =
|
|
974
|
+
await this.generateCallTemplateForAlertEpisodeCreated(
|
|
975
|
+
notificationRuleItem.userCall?.phone,
|
|
976
|
+
alertEpisode,
|
|
977
|
+
updatedLog.id!,
|
|
978
|
+
);
|
|
979
|
+
|
|
980
|
+
CallService.makeCall(callRequest, {
|
|
981
|
+
projectId: alertEpisode.projectId,
|
|
982
|
+
userOnCallLogTimelineId: updatedLog.id!,
|
|
983
|
+
alertEpisodeId: alertEpisode.id!,
|
|
984
|
+
userId: notificationRuleItem.userId!,
|
|
985
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
986
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
987
|
+
teamId: options.userBelongsToTeamId,
|
|
988
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
989
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
990
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
991
|
+
}).catch(async (err: Error) => {
|
|
992
|
+
await UserOnCallLogTimelineService.updateOneById({
|
|
993
|
+
id: updatedLog.id!,
|
|
994
|
+
data: {
|
|
995
|
+
status: UserNotificationStatus.Error,
|
|
996
|
+
statusMessage: err.message || "Error making call.",
|
|
997
|
+
},
|
|
998
|
+
props: {
|
|
999
|
+
isRoot: true,
|
|
1000
|
+
},
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
761
1004
|
}
|
|
762
1005
|
|
|
763
1006
|
if (
|
|
@@ -810,6 +1053,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
810
1053
|
alert.id!,
|
|
811
1054
|
)
|
|
812
1055
|
).toString(),
|
|
1056
|
+
alertNumber: alert.alertNumber,
|
|
813
1057
|
});
|
|
814
1058
|
|
|
815
1059
|
// send push notification.
|
|
@@ -881,6 +1125,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
881
1125
|
incident.id!,
|
|
882
1126
|
)
|
|
883
1127
|
).toString(),
|
|
1128
|
+
incidentNumber: incident.incidentNumber,
|
|
884
1129
|
});
|
|
885
1130
|
|
|
886
1131
|
// send push notification.
|
|
@@ -922,6 +1167,76 @@ export class Service extends DatabaseService<Model> {
|
|
|
922
1167
|
});
|
|
923
1168
|
});
|
|
924
1169
|
}
|
|
1170
|
+
|
|
1171
|
+
// send push notification for alert episode
|
|
1172
|
+
if (
|
|
1173
|
+
options.userNotificationEventType ===
|
|
1174
|
+
UserNotificationEventType.AlertEpisodeCreated &&
|
|
1175
|
+
alertEpisode
|
|
1176
|
+
) {
|
|
1177
|
+
logTimelineItem.status = UserNotificationStatus.Sending;
|
|
1178
|
+
logTimelineItem.statusMessage = `Sending push notification to device.`;
|
|
1179
|
+
logTimelineItem.userPushId = notificationRuleItem.userPush.id!;
|
|
1180
|
+
|
|
1181
|
+
const updatedLog: UserOnCallLogTimeline =
|
|
1182
|
+
await UserOnCallLogTimelineService.create({
|
|
1183
|
+
data: logTimelineItem,
|
|
1184
|
+
props: {
|
|
1185
|
+
isRoot: true,
|
|
1186
|
+
},
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
const pushMessage: PushNotificationMessage =
|
|
1190
|
+
PushNotificationUtil.createAlertEpisodeCreatedNotification({
|
|
1191
|
+
alertEpisodeTitle: alertEpisode.title!,
|
|
1192
|
+
projectName: alertEpisode.project?.name || "OneUptime",
|
|
1193
|
+
alertEpisodeViewLink: (
|
|
1194
|
+
await AlertEpisodeService.getEpisodeLinkInDashboard(
|
|
1195
|
+
alertEpisode.projectId!,
|
|
1196
|
+
alertEpisode.id!,
|
|
1197
|
+
)
|
|
1198
|
+
).toString(),
|
|
1199
|
+
episodeNumber: alertEpisode.episodeNumber,
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
PushNotificationService.sendPushNotification(
|
|
1203
|
+
{
|
|
1204
|
+
devices: [
|
|
1205
|
+
{
|
|
1206
|
+
token: notificationRuleItem.userPush.deviceToken!,
|
|
1207
|
+
...(notificationRuleItem.userPush.deviceName && {
|
|
1208
|
+
name: notificationRuleItem.userPush.deviceName,
|
|
1209
|
+
}),
|
|
1210
|
+
},
|
|
1211
|
+
],
|
|
1212
|
+
message: pushMessage,
|
|
1213
|
+
deviceType: notificationRuleItem.userPush.deviceType!,
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
projectId: options.projectId,
|
|
1217
|
+
userOnCallLogTimelineId: updatedLog.id!,
|
|
1218
|
+
alertEpisodeId: alertEpisode.id!,
|
|
1219
|
+
userId: notificationRuleItem.userId!,
|
|
1220
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
1221
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
1222
|
+
teamId: options.userBelongsToTeamId,
|
|
1223
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
1224
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
1225
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
1226
|
+
},
|
|
1227
|
+
).catch(async (err: Error) => {
|
|
1228
|
+
await UserOnCallLogTimelineService.updateOneById({
|
|
1229
|
+
id: updatedLog.id!,
|
|
1230
|
+
data: {
|
|
1231
|
+
status: UserNotificationStatus.Error,
|
|
1232
|
+
statusMessage: err.message || "Error sending push notification.",
|
|
1233
|
+
},
|
|
1234
|
+
props: {
|
|
1235
|
+
isRoot: true,
|
|
1236
|
+
},
|
|
1237
|
+
});
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
925
1240
|
}
|
|
926
1241
|
|
|
927
1242
|
if (
|
|
@@ -951,6 +1266,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
951
1266
|
|
|
952
1267
|
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
953
1268
|
|
|
1269
|
+
const alertIdentifier: string =
|
|
1270
|
+
alert.alertNumber !== undefined
|
|
1271
|
+
? `Alert number ${alert.alertNumber}, ${alert.title || "Alert"}`
|
|
1272
|
+
: alert.title || "Alert";
|
|
1273
|
+
|
|
954
1274
|
const callRequest: CallRequest = {
|
|
955
1275
|
to: to,
|
|
956
1276
|
data: [
|
|
@@ -961,7 +1281,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
961
1281
|
sayMessage: "A new alert has been created",
|
|
962
1282
|
},
|
|
963
1283
|
{
|
|
964
|
-
sayMessage:
|
|
1284
|
+
sayMessage: alertIdentifier,
|
|
965
1285
|
},
|
|
966
1286
|
{
|
|
967
1287
|
introMessage: "To acknowledge this alert press 1",
|
|
@@ -1002,6 +1322,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
1002
1322
|
|
|
1003
1323
|
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1004
1324
|
|
|
1325
|
+
const incidentIdentifier: string =
|
|
1326
|
+
incident.incidentNumber !== undefined
|
|
1327
|
+
? `Incident number ${incident.incidentNumber}, ${incident.title || "Incident"}`
|
|
1328
|
+
: incident.title || "Incident";
|
|
1329
|
+
|
|
1005
1330
|
const callRequest: CallRequest = {
|
|
1006
1331
|
to: to,
|
|
1007
1332
|
data: [
|
|
@@ -1012,7 +1337,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1012
1337
|
sayMessage: "A new incident has been created",
|
|
1013
1338
|
},
|
|
1014
1339
|
{
|
|
1015
|
-
sayMessage:
|
|
1340
|
+
sayMessage: incidentIdentifier,
|
|
1016
1341
|
},
|
|
1017
1342
|
{
|
|
1018
1343
|
introMessage: "To acknowledge this incident press 1",
|
|
@@ -1043,6 +1368,62 @@ export class Service extends DatabaseService<Model> {
|
|
|
1043
1368
|
return callRequest;
|
|
1044
1369
|
}
|
|
1045
1370
|
|
|
1371
|
+
@CaptureSpan()
|
|
1372
|
+
public async generateCallTemplateForAlertEpisodeCreated(
|
|
1373
|
+
to: Phone,
|
|
1374
|
+
alertEpisode: AlertEpisode,
|
|
1375
|
+
userOnCallLogTimelineId: ObjectID,
|
|
1376
|
+
): Promise<CallRequest> {
|
|
1377
|
+
const host: Hostname = await DatabaseConfig.getHost();
|
|
1378
|
+
|
|
1379
|
+
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1380
|
+
|
|
1381
|
+
const episodeIdentifier: string =
|
|
1382
|
+
alertEpisode.episodeNumber !== undefined
|
|
1383
|
+
? `Alert episode number ${alertEpisode.episodeNumber}, ${alertEpisode.title || "Alert Episode"}`
|
|
1384
|
+
: alertEpisode.title || "Alert Episode";
|
|
1385
|
+
|
|
1386
|
+
const callRequest: CallRequest = {
|
|
1387
|
+
to: to,
|
|
1388
|
+
data: [
|
|
1389
|
+
{
|
|
1390
|
+
sayMessage: "This is a call from OneUptime",
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
sayMessage: "A new alert episode has been created",
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
sayMessage: episodeIdentifier,
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
introMessage: "To acknowledge this alert episode press 1",
|
|
1400
|
+
numDigits: 1,
|
|
1401
|
+
timeoutInSeconds: 10,
|
|
1402
|
+
noInputMessage: "You have not entered any input. Good bye",
|
|
1403
|
+
onInputCallRequest: {
|
|
1404
|
+
"1": {
|
|
1405
|
+
sayMessage: "You have acknowledged this alert episode. Good bye",
|
|
1406
|
+
},
|
|
1407
|
+
default: {
|
|
1408
|
+
sayMessage: "Invalid input. Good bye",
|
|
1409
|
+
},
|
|
1410
|
+
},
|
|
1411
|
+
responseUrl: new URL(
|
|
1412
|
+
httpProtocol,
|
|
1413
|
+
host,
|
|
1414
|
+
new Route(AppApiRoute.toString())
|
|
1415
|
+
.addRoute(new UserOnCallLogTimeline().crudApiPath!)
|
|
1416
|
+
.addRoute(
|
|
1417
|
+
"/call/gather-input/" + userOnCallLogTimelineId.toString(),
|
|
1418
|
+
),
|
|
1419
|
+
),
|
|
1420
|
+
},
|
|
1421
|
+
],
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
return callRequest;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1046
1427
|
@CaptureSpan()
|
|
1047
1428
|
public async generateSmsTemplateForAlertCreated(
|
|
1048
1429
|
to: Phone,
|
|
@@ -1109,6 +1490,39 @@ export class Service extends DatabaseService<Model> {
|
|
|
1109
1490
|
return sms;
|
|
1110
1491
|
}
|
|
1111
1492
|
|
|
1493
|
+
@CaptureSpan()
|
|
1494
|
+
public async generateSmsTemplateForAlertEpisodeCreated(
|
|
1495
|
+
to: Phone,
|
|
1496
|
+
alertEpisode: AlertEpisode,
|
|
1497
|
+
userOnCallLogTimelineId: ObjectID,
|
|
1498
|
+
): Promise<SMS> {
|
|
1499
|
+
const host: Hostname = await DatabaseConfig.getHost();
|
|
1500
|
+
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1501
|
+
|
|
1502
|
+
const shortUrl: ShortLink = await ShortLinkService.saveShortLinkFor(
|
|
1503
|
+
new URL(
|
|
1504
|
+
httpProtocol,
|
|
1505
|
+
host,
|
|
1506
|
+
new Route(AppApiRoute.toString())
|
|
1507
|
+
.addRoute(new UserOnCallLogTimeline().crudApiPath!)
|
|
1508
|
+
.addRoute("/acknowledge-page/" + userOnCallLogTimelineId.toString()),
|
|
1509
|
+
),
|
|
1510
|
+
);
|
|
1511
|
+
const url: URL = await ShortLinkService.getShortenedUrl(shortUrl);
|
|
1512
|
+
|
|
1513
|
+
const episodeIdentifier: string =
|
|
1514
|
+
alertEpisode.episodeNumber !== undefined
|
|
1515
|
+
? `#${alertEpisode.episodeNumber} (${alertEpisode.title || "Alert Episode"})`
|
|
1516
|
+
: alertEpisode.title || "Alert Episode";
|
|
1517
|
+
|
|
1518
|
+
const sms: SMS = {
|
|
1519
|
+
to,
|
|
1520
|
+
message: `This is a message from OneUptime. A new alert episode has been created: ${episodeIdentifier}. To acknowledge this alert episode, please click on the following link ${url.toString()}`,
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
return sms;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1112
1526
|
@CaptureSpan()
|
|
1113
1527
|
public async generateWhatsAppTemplateForAlertCreated(
|
|
1114
1528
|
to: Phone,
|
|
@@ -1223,6 +1637,65 @@ export class Service extends DatabaseService<Model> {
|
|
|
1223
1637
|
};
|
|
1224
1638
|
}
|
|
1225
1639
|
|
|
1640
|
+
@CaptureSpan()
|
|
1641
|
+
public async generateWhatsAppTemplateForAlertEpisodeCreated(
|
|
1642
|
+
to: Phone,
|
|
1643
|
+
alertEpisode: AlertEpisode,
|
|
1644
|
+
userOnCallLogTimelineId: ObjectID,
|
|
1645
|
+
): Promise<WhatsAppMessage> {
|
|
1646
|
+
const host: Hostname = await DatabaseConfig.getHost();
|
|
1647
|
+
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1648
|
+
|
|
1649
|
+
const acknowledgeShortLink: ShortLink =
|
|
1650
|
+
await ShortLinkService.saveShortLinkFor(
|
|
1651
|
+
new URL(
|
|
1652
|
+
httpProtocol,
|
|
1653
|
+
host,
|
|
1654
|
+
new Route(AppApiRoute.toString())
|
|
1655
|
+
.addRoute(new UserOnCallLogTimeline().crudApiPath!)
|
|
1656
|
+
.addRoute(
|
|
1657
|
+
"/acknowledge-page/" + userOnCallLogTimelineId.toString(),
|
|
1658
|
+
),
|
|
1659
|
+
),
|
|
1660
|
+
);
|
|
1661
|
+
|
|
1662
|
+
const acknowledgeUrl: URL =
|
|
1663
|
+
await ShortLinkService.getShortenedUrl(acknowledgeShortLink);
|
|
1664
|
+
|
|
1665
|
+
const episodeLinkOnDashboard: string =
|
|
1666
|
+
alertEpisode.projectId && alertEpisode.id
|
|
1667
|
+
? (
|
|
1668
|
+
await AlertEpisodeService.getEpisodeLinkInDashboard(
|
|
1669
|
+
alertEpisode.projectId,
|
|
1670
|
+
alertEpisode.id,
|
|
1671
|
+
)
|
|
1672
|
+
).toString()
|
|
1673
|
+
: acknowledgeUrl.toString();
|
|
1674
|
+
|
|
1675
|
+
const templateKey: WhatsAppTemplateId =
|
|
1676
|
+
WhatsAppTemplateIds.AlertEpisodeCreated;
|
|
1677
|
+
const templateVariables: Record<string, string> = {
|
|
1678
|
+
project_name: alertEpisode.project?.name || "OneUptime",
|
|
1679
|
+
episode_title: alertEpisode.title || "",
|
|
1680
|
+
acknowledge_url: acknowledgeUrl.toString(),
|
|
1681
|
+
episode_number:
|
|
1682
|
+
alertEpisode.episodeNumber !== undefined
|
|
1683
|
+
? alertEpisode.episodeNumber.toString()
|
|
1684
|
+
: "",
|
|
1685
|
+
episode_link: episodeLinkOnDashboard,
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1688
|
+
const body: string = renderWhatsAppTemplate(templateKey, templateVariables);
|
|
1689
|
+
|
|
1690
|
+
return {
|
|
1691
|
+
to,
|
|
1692
|
+
body,
|
|
1693
|
+
templateKey,
|
|
1694
|
+
templateVariables,
|
|
1695
|
+
templateLanguageCode: WhatsAppTemplateLanguage[templateKey],
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1226
1699
|
@CaptureSpan()
|
|
1227
1700
|
public async generateEmailTemplateForAlertCreated(
|
|
1228
1701
|
to: Email,
|
|
@@ -1232,8 +1705,13 @@ export class Service extends DatabaseService<Model> {
|
|
|
1232
1705
|
const host: Hostname = await DatabaseConfig.getHost();
|
|
1233
1706
|
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1234
1707
|
|
|
1708
|
+
const alertNumber: string = alert.alertNumber
|
|
1709
|
+
? `#${alert.alertNumber}`
|
|
1710
|
+
: "";
|
|
1711
|
+
|
|
1235
1712
|
const vars: Dictionary<string> = {
|
|
1236
1713
|
alertTitle: alert.title!,
|
|
1714
|
+
alertNumber: alertNumber,
|
|
1237
1715
|
projectName: alert.project!.name!,
|
|
1238
1716
|
currentState: alert.currentAlertState!.name!,
|
|
1239
1717
|
alertDescription: await Markdown.convertToHTML(
|
|
@@ -1257,7 +1735,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1257
1735
|
toEmail: to!,
|
|
1258
1736
|
templateType: EmailTemplateType.AcknowledgeAlert,
|
|
1259
1737
|
vars: vars,
|
|
1260
|
-
subject:
|
|
1738
|
+
subject: `ACTION REQUIRED: Alert ${alertNumber} created - ${alert.title!}`,
|
|
1261
1739
|
};
|
|
1262
1740
|
|
|
1263
1741
|
return emailMessage;
|
|
@@ -1272,8 +1750,13 @@ export class Service extends DatabaseService<Model> {
|
|
|
1272
1750
|
const host: Hostname = await DatabaseConfig.getHost();
|
|
1273
1751
|
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1274
1752
|
|
|
1753
|
+
const incidentNumber: string = incident.incidentNumber
|
|
1754
|
+
? `#${incident.incidentNumber}`
|
|
1755
|
+
: "";
|
|
1756
|
+
|
|
1275
1757
|
const vars: Dictionary<string> = {
|
|
1276
1758
|
incidentTitle: incident.title!,
|
|
1759
|
+
incidentNumber: incidentNumber,
|
|
1277
1760
|
projectName: incident.project!.name!,
|
|
1278
1761
|
currentState: incident.currentIncidentState!.name!,
|
|
1279
1762
|
incidentDescription: await Markdown.convertToHTML(
|
|
@@ -1302,7 +1785,148 @@ export class Service extends DatabaseService<Model> {
|
|
|
1302
1785
|
toEmail: to!,
|
|
1303
1786
|
templateType: EmailTemplateType.AcknowledgeIncident,
|
|
1304
1787
|
vars: vars,
|
|
1305
|
-
subject:
|
|
1788
|
+
subject: `ACTION REQUIRED: Incident ${incidentNumber} created - ${incident.title!}`,
|
|
1789
|
+
};
|
|
1790
|
+
|
|
1791
|
+
return emailMessage;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
@CaptureSpan()
|
|
1795
|
+
public async generateEmailTemplateForAlertEpisodeCreated(
|
|
1796
|
+
to: Email,
|
|
1797
|
+
alertEpisode: AlertEpisode,
|
|
1798
|
+
userOnCallLogTimelineId: ObjectID,
|
|
1799
|
+
): Promise<EmailMessage> {
|
|
1800
|
+
const host: Hostname = await DatabaseConfig.getHost();
|
|
1801
|
+
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
1802
|
+
|
|
1803
|
+
// Fetch alerts that are members of this episode
|
|
1804
|
+
const episodeMembers: Array<AlertEpisodeMember> =
|
|
1805
|
+
await AlertEpisodeMemberService.findBy({
|
|
1806
|
+
query: {
|
|
1807
|
+
alertEpisodeId: alertEpisode.id!,
|
|
1808
|
+
},
|
|
1809
|
+
select: {
|
|
1810
|
+
alertId: true,
|
|
1811
|
+
alert: {
|
|
1812
|
+
_id: true,
|
|
1813
|
+
title: true,
|
|
1814
|
+
alertNumber: true,
|
|
1815
|
+
monitor: {
|
|
1816
|
+
_id: true,
|
|
1817
|
+
name: true,
|
|
1818
|
+
},
|
|
1819
|
+
},
|
|
1820
|
+
},
|
|
1821
|
+
props: {
|
|
1822
|
+
isRoot: true,
|
|
1823
|
+
},
|
|
1824
|
+
limit: LIMIT_PER_PROJECT,
|
|
1825
|
+
skip: 0,
|
|
1826
|
+
});
|
|
1827
|
+
|
|
1828
|
+
// Get unique monitors (resources affected)
|
|
1829
|
+
const monitorNames: Set<string> = new Set();
|
|
1830
|
+
for (const member of episodeMembers) {
|
|
1831
|
+
if (member.alert?.monitor?.name) {
|
|
1832
|
+
monitorNames.add(member.alert.monitor.name);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
const resourcesAffected: string =
|
|
1837
|
+
monitorNames.size > 0
|
|
1838
|
+
? Array.from(monitorNames).join(", ")
|
|
1839
|
+
: "No resources identified";
|
|
1840
|
+
|
|
1841
|
+
// Build alerts list HTML with proper email styling
|
|
1842
|
+
let alertsListHtml: string = "";
|
|
1843
|
+
if (episodeMembers.length > 0) {
|
|
1844
|
+
const alertRows: string[] = [];
|
|
1845
|
+
for (const member of episodeMembers) {
|
|
1846
|
+
if (member.alert) {
|
|
1847
|
+
const alertTitle: string = member.alert.title || "Untitled Alert";
|
|
1848
|
+
const alertNumber: string = member.alert.alertNumber
|
|
1849
|
+
? `#${member.alert.alertNumber}`
|
|
1850
|
+
: "";
|
|
1851
|
+
const alertLink: string = (
|
|
1852
|
+
await AlertService.getAlertLinkInDashboard(
|
|
1853
|
+
alertEpisode.projectId!,
|
|
1854
|
+
new ObjectID(member.alert._id as string),
|
|
1855
|
+
)
|
|
1856
|
+
).toString();
|
|
1857
|
+
const monitorName: string = member.alert.monitor?.name || "";
|
|
1858
|
+
|
|
1859
|
+
alertRows.push(`
|
|
1860
|
+
<tr>
|
|
1861
|
+
<td style="padding: 12px 16px; border-bottom: 1px solid #e2e8f0;">
|
|
1862
|
+
<table cellpadding="0" cellspacing="0" width="100%">
|
|
1863
|
+
<tr>
|
|
1864
|
+
<td style="vertical-align: middle;">
|
|
1865
|
+
<span style="display: inline-block; background-color: #dbeafe; color: #1e40af; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; margin-right: 8px;">${alertNumber}</span>
|
|
1866
|
+
<a href="${alertLink}" style="color: #2563eb; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; font-weight: 500; text-decoration: none;">${alertTitle}</a>
|
|
1867
|
+
${monitorName ? `<span style="display: block; color: #64748b; font-size: 12px; margin-top: 4px;">Monitor: ${monitorName}</span>` : ""}
|
|
1868
|
+
</td>
|
|
1869
|
+
<td style="text-align: right; vertical-align: middle;">
|
|
1870
|
+
<a href="${alertLink}" style="color: #2563eb; font-size: 12px; text-decoration: none;">View →</a>
|
|
1871
|
+
</td>
|
|
1872
|
+
</tr>
|
|
1873
|
+
</table>
|
|
1874
|
+
</td>
|
|
1875
|
+
</tr>
|
|
1876
|
+
`);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
if (alertRows.length > 0) {
|
|
1880
|
+
alertsListHtml = `
|
|
1881
|
+
<table cellpadding="0" cellspacing="0" width="100%" style="background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); border-radius: 8px; border: 1px solid #e2e8f0; margin: 8px 0 16px 0;">
|
|
1882
|
+
<tbody>
|
|
1883
|
+
${alertRows.join("")}
|
|
1884
|
+
</tbody>
|
|
1885
|
+
</table>
|
|
1886
|
+
`;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
const episodeNumber: string = alertEpisode.episodeNumber
|
|
1891
|
+
? `#${alertEpisode.episodeNumber}`
|
|
1892
|
+
: "";
|
|
1893
|
+
|
|
1894
|
+
const vars: Dictionary<string> = {
|
|
1895
|
+
alertEpisodeTitle: alertEpisode.title!,
|
|
1896
|
+
episodeNumber: episodeNumber,
|
|
1897
|
+
projectName: alertEpisode.project!.name!,
|
|
1898
|
+
currentState: alertEpisode.currentAlertState!.name!,
|
|
1899
|
+
alertEpisodeDescription: await Markdown.convertToHTML(
|
|
1900
|
+
alertEpisode.description! || "",
|
|
1901
|
+
MarkdownContentType.Email,
|
|
1902
|
+
),
|
|
1903
|
+
alertEpisodeSeverity: alertEpisode.alertSeverity!.name!,
|
|
1904
|
+
resourcesAffected: resourcesAffected,
|
|
1905
|
+
rootCause:
|
|
1906
|
+
alertEpisode.rootCause ||
|
|
1907
|
+
"No root cause identified for this alert episode",
|
|
1908
|
+
alertsList: alertsListHtml,
|
|
1909
|
+
alertsCount: episodeMembers.length.toString(),
|
|
1910
|
+
alertEpisodeViewLink: (
|
|
1911
|
+
await AlertEpisodeService.getEpisodeLinkInDashboard(
|
|
1912
|
+
alertEpisode.projectId!,
|
|
1913
|
+
alertEpisode.id!,
|
|
1914
|
+
)
|
|
1915
|
+
).toString(),
|
|
1916
|
+
acknowledgeAlertEpisodeLink: new URL(
|
|
1917
|
+
httpProtocol,
|
|
1918
|
+
host,
|
|
1919
|
+
new Route(AppApiRoute.toString())
|
|
1920
|
+
.addRoute(new UserOnCallLogTimeline().crudApiPath!)
|
|
1921
|
+
.addRoute("/acknowledge-page/" + userOnCallLogTimelineId.toString()),
|
|
1922
|
+
).toString(),
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
const emailMessage: EmailMessage = {
|
|
1926
|
+
toEmail: to!,
|
|
1927
|
+
templateType: EmailTemplateType.AcknowledgeAlertEpisode,
|
|
1928
|
+
vars: vars,
|
|
1929
|
+
subject: `ACTION REQUIRED: Alert Episode ${episodeNumber} created - ${alertEpisode.title!}`,
|
|
1306
1930
|
};
|
|
1307
1931
|
|
|
1308
1932
|
return emailMessage;
|
|
@@ -1315,6 +1939,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1315
1939
|
projectId: ObjectID;
|
|
1316
1940
|
triggeredByIncidentId?: ObjectID | undefined;
|
|
1317
1941
|
triggeredByAlertId?: ObjectID | undefined;
|
|
1942
|
+
triggeredByAlertEpisodeId?: ObjectID | undefined;
|
|
1318
1943
|
userNotificationEventType: UserNotificationEventType;
|
|
1319
1944
|
onCallPolicyExecutionLogId?: ObjectID | undefined;
|
|
1320
1945
|
onCallPolicyId: ObjectID | undefined;
|
|
@@ -1339,6 +1964,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
1339
1964
|
userOnCallLog.triggeredByAlertId = options.triggeredByAlertId;
|
|
1340
1965
|
}
|
|
1341
1966
|
|
|
1967
|
+
if (options.triggeredByAlertEpisodeId) {
|
|
1968
|
+
userOnCallLog.triggeredByAlertEpisodeId =
|
|
1969
|
+
options.triggeredByAlertEpisodeId;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1342
1972
|
userOnCallLog.userNotificationEventType = options.userNotificationEventType;
|
|
1343
1973
|
|
|
1344
1974
|
if (options.onCallPolicyExecutionLogId) {
|
|
@@ -1512,7 +2142,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1512
2142
|
userId,
|
|
1513
2143
|
userEmailId: userEmail.id!,
|
|
1514
2144
|
incidentSeverityId: incidentSeverity.id!,
|
|
1515
|
-
ruleType: NotificationRuleType.
|
|
2145
|
+
ruleType: NotificationRuleType.ON_CALL_EXECUTED_INCIDENT,
|
|
1516
2146
|
},
|
|
1517
2147
|
props: {
|
|
1518
2148
|
isRoot: true,
|
|
@@ -1530,7 +2160,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
1530
2160
|
notificationRule.userEmailId = userEmail.id!;
|
|
1531
2161
|
notificationRule.incidentSeverityId = incidentSeverity.id!;
|
|
1532
2162
|
notificationRule.notifyAfterMinutes = 0;
|
|
1533
|
-
notificationRule.ruleType =
|
|
2163
|
+
notificationRule.ruleType =
|
|
2164
|
+
NotificationRuleType.ON_CALL_EXECUTED_INCIDENT;
|
|
1534
2165
|
|
|
1535
2166
|
await this.create({
|
|
1536
2167
|
data: notificationRule,
|
|
@@ -1573,7 +2204,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1573
2204
|
userId,
|
|
1574
2205
|
userEmailId: userEmail.id!,
|
|
1575
2206
|
alertSeverityId: alertSeverity.id!,
|
|
1576
|
-
ruleType: NotificationRuleType.
|
|
2207
|
+
ruleType: NotificationRuleType.ON_CALL_EXECUTED_ALERT,
|
|
1577
2208
|
},
|
|
1578
2209
|
props: {
|
|
1579
2210
|
isRoot: true,
|
|
@@ -1591,7 +2222,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
1591
2222
|
notificationRule.userEmailId = userEmail.id!;
|
|
1592
2223
|
notificationRule.alertSeverityId = alertSeverity.id!;
|
|
1593
2224
|
notificationRule.notifyAfterMinutes = 0;
|
|
1594
|
-
notificationRule.ruleType = NotificationRuleType.
|
|
2225
|
+
notificationRule.ruleType = NotificationRuleType.ON_CALL_EXECUTED_ALERT;
|
|
1595
2226
|
|
|
1596
2227
|
await this.create({
|
|
1597
2228
|
data: notificationRule,
|