@oneuptime/common 9.4.7 → 9.4.8
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/StatusPageDomain.ts +2 -0
- package/Models/DatabaseModels/WorkspaceNotificationLog.ts +57 -0
- package/Server/API/SlackAPI.ts +21 -0
- 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/Index.ts +20 -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 +988 -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/OnCallDutyPolicyService.ts +5 -0
- package/Server/Services/SmsService.ts +2 -0
- package/Server/Services/UserNotificationSettingService.ts +23 -0
- 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/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 +5 -0
- package/Types/NotificationRule/NotificationRuleType.ts +1 -0
- 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 +20 -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/StatusPageDomain.js +2 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.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/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/Index.js +20 -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 +885 -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/OnCallDutyPolicyService.js +3 -0
- package/build/dist/Server/Services/OnCallDutyPolicyService.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/UserNotificationSettingService.js +9 -0
- package/build/dist/Server/Services/UserNotificationSettingService.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/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 +4 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/NotificationRule/NotificationRuleType.js +1 -0
- 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 +12 -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
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
import { ExpressRequest, ExpressResponse } from "../../../Express";
|
|
2
|
+
import Response from "../../../Response";
|
|
3
|
+
import MicrosoftTeamsAuthAction, {
|
|
4
|
+
MicrosoftTeamsAction,
|
|
5
|
+
MicrosoftTeamsRequest,
|
|
6
|
+
} from "./Auth";
|
|
7
|
+
import { MicrosoftTeamsAlertEpisodeActionType } from "./ActionTypes";
|
|
8
|
+
import logger from "../../../Logger";
|
|
9
|
+
import ObjectID from "../../../../../Types/ObjectID";
|
|
10
|
+
import AlertEpisodeService from "../../../../Services/AlertEpisodeService";
|
|
11
|
+
import AlertEpisode from "../../../../../Models/DatabaseModels/AlertEpisode";
|
|
12
|
+
import CaptureSpan from "../../../Telemetry/CaptureSpan";
|
|
13
|
+
import { TurnContext } from "botbuilder";
|
|
14
|
+
import { JSONObject, JSONValue } from "../../../../../Types/JSON";
|
|
15
|
+
import AlertEpisodeInternalNoteService from "../../../../Services/AlertEpisodeInternalNoteService";
|
|
16
|
+
import OnCallDutyPolicyService from "../../../../Services/OnCallDutyPolicyService";
|
|
17
|
+
import AlertStateService from "../../../../Services/AlertStateService";
|
|
18
|
+
import UserNotificationEventType from "../../../../../Types/UserNotification/UserNotificationEventType";
|
|
19
|
+
import OnCallDutyPolicy from "../../../../../Models/DatabaseModels/OnCallDutyPolicy";
|
|
20
|
+
import AlertState from "../../../../../Models/DatabaseModels/AlertState";
|
|
21
|
+
|
|
22
|
+
export default class MicrosoftTeamsAlertEpisodeActions {
|
|
23
|
+
@CaptureSpan()
|
|
24
|
+
public static isAlertEpisodeAction(data: { actionType: string }): boolean {
|
|
25
|
+
return (
|
|
26
|
+
data.actionType.includes("AlertEpisode") ||
|
|
27
|
+
data.actionType ===
|
|
28
|
+
MicrosoftTeamsAlertEpisodeActionType.AckAlertEpisode ||
|
|
29
|
+
data.actionType ===
|
|
30
|
+
MicrosoftTeamsAlertEpisodeActionType.ResolveAlertEpisode ||
|
|
31
|
+
data.actionType ===
|
|
32
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewAlertEpisode ||
|
|
33
|
+
data.actionType ===
|
|
34
|
+
MicrosoftTeamsAlertEpisodeActionType.AlertEpisodeCreated ||
|
|
35
|
+
data.actionType ===
|
|
36
|
+
MicrosoftTeamsAlertEpisodeActionType.AlertEpisodeStateChanged ||
|
|
37
|
+
data.actionType ===
|
|
38
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewAddAlertEpisodeNote ||
|
|
39
|
+
data.actionType ===
|
|
40
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitAlertEpisodeNote ||
|
|
41
|
+
data.actionType ===
|
|
42
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewExecuteAlertEpisodeOnCallPolicy ||
|
|
43
|
+
data.actionType ===
|
|
44
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitExecuteAlertEpisodeOnCallPolicy ||
|
|
45
|
+
data.actionType ===
|
|
46
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewChangeAlertEpisodeState ||
|
|
47
|
+
data.actionType ===
|
|
48
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitChangeAlertEpisodeState
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@CaptureSpan()
|
|
53
|
+
public static async handleAlertEpisodeAction(data: {
|
|
54
|
+
teamsRequest: MicrosoftTeamsRequest;
|
|
55
|
+
action: MicrosoftTeamsAction;
|
|
56
|
+
req: ExpressRequest;
|
|
57
|
+
res: ExpressResponse;
|
|
58
|
+
}): Promise<void> {
|
|
59
|
+
const { teamsRequest, action } = data;
|
|
60
|
+
|
|
61
|
+
logger.debug("Handling Microsoft Teams alert episode action:");
|
|
62
|
+
logger.debug(action);
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
switch (action.actionType) {
|
|
66
|
+
case MicrosoftTeamsAlertEpisodeActionType.AckAlertEpisode:
|
|
67
|
+
await this.acknowledgeAlertEpisode({
|
|
68
|
+
teamsRequest,
|
|
69
|
+
action,
|
|
70
|
+
});
|
|
71
|
+
break;
|
|
72
|
+
|
|
73
|
+
case MicrosoftTeamsAlertEpisodeActionType.ResolveAlertEpisode:
|
|
74
|
+
await this.resolveAlertEpisode({
|
|
75
|
+
teamsRequest,
|
|
76
|
+
action,
|
|
77
|
+
});
|
|
78
|
+
break;
|
|
79
|
+
|
|
80
|
+
case MicrosoftTeamsAlertEpisodeActionType.ViewAlertEpisode:
|
|
81
|
+
// This is handled by opening the URL directly
|
|
82
|
+
break;
|
|
83
|
+
|
|
84
|
+
default:
|
|
85
|
+
logger.debug("Unhandled alert episode action: " + action.actionType);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
logger.error("Error handling Microsoft Teams alert episode action:");
|
|
90
|
+
logger.error(error);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
Response.sendTextResponse(data.req, data.res, "");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@CaptureSpan()
|
|
97
|
+
private static async acknowledgeAlertEpisode(data: {
|
|
98
|
+
teamsRequest: MicrosoftTeamsRequest;
|
|
99
|
+
action: MicrosoftTeamsAction;
|
|
100
|
+
}): Promise<void> {
|
|
101
|
+
const episodeId: string = data.action.actionValue || "";
|
|
102
|
+
|
|
103
|
+
if (!episodeId) {
|
|
104
|
+
logger.error("No episode ID provided for acknowledge action");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
logger.debug("Acknowledging alert episode: " + episodeId);
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const episode: AlertEpisode | null = await AlertEpisodeService.findOneBy({
|
|
112
|
+
query: {
|
|
113
|
+
_id: episodeId,
|
|
114
|
+
projectId: data.teamsRequest.projectId,
|
|
115
|
+
},
|
|
116
|
+
select: {
|
|
117
|
+
_id: true,
|
|
118
|
+
projectId: true,
|
|
119
|
+
currentAlertState: {
|
|
120
|
+
_id: true,
|
|
121
|
+
name: true,
|
|
122
|
+
isAcknowledgedState: true,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
props: {
|
|
126
|
+
isRoot: true,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (!episode) {
|
|
131
|
+
logger.error("Alert episode not found: " + episodeId);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (episode.currentAlertState?.isAcknowledgedState) {
|
|
136
|
+
logger.debug("Alert episode is already acknowledged");
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const oneUptimeUserId: ObjectID =
|
|
141
|
+
await MicrosoftTeamsAuthAction.getOneUptimeUserIdFromTeamsUserId({
|
|
142
|
+
teamsUserId: data.teamsRequest.userId || "",
|
|
143
|
+
projectId: data.teamsRequest.projectId,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
await AlertEpisodeService.acknowledgeEpisode(
|
|
147
|
+
new ObjectID(episodeId),
|
|
148
|
+
oneUptimeUserId,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
logger.debug("Alert episode acknowledged successfully");
|
|
152
|
+
} catch (error) {
|
|
153
|
+
logger.error("Error acknowledging alert episode:");
|
|
154
|
+
logger.error(error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@CaptureSpan()
|
|
159
|
+
private static async resolveAlertEpisode(data: {
|
|
160
|
+
teamsRequest: MicrosoftTeamsRequest;
|
|
161
|
+
action: MicrosoftTeamsAction;
|
|
162
|
+
}): Promise<void> {
|
|
163
|
+
const episodeId: string = data.action.actionValue || "";
|
|
164
|
+
|
|
165
|
+
if (!episodeId) {
|
|
166
|
+
logger.error("No episode ID provided for resolve action");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
logger.debug("Resolving alert episode: " + episodeId);
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
const episode: AlertEpisode | null = await AlertEpisodeService.findOneBy({
|
|
174
|
+
query: {
|
|
175
|
+
_id: episodeId,
|
|
176
|
+
projectId: data.teamsRequest.projectId,
|
|
177
|
+
},
|
|
178
|
+
select: {
|
|
179
|
+
_id: true,
|
|
180
|
+
projectId: true,
|
|
181
|
+
currentAlertState: {
|
|
182
|
+
_id: true,
|
|
183
|
+
name: true,
|
|
184
|
+
isResolvedState: true,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
props: {
|
|
188
|
+
isRoot: true,
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
if (!episode) {
|
|
193
|
+
logger.error("Alert episode not found: " + episodeId);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (episode.currentAlertState?.isResolvedState) {
|
|
198
|
+
logger.debug("Alert episode is already resolved");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const oneUptimeUserId: ObjectID =
|
|
203
|
+
await MicrosoftTeamsAuthAction.getOneUptimeUserIdFromTeamsUserId({
|
|
204
|
+
teamsUserId: data.teamsRequest.userId || "",
|
|
205
|
+
projectId: data.teamsRequest.projectId,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
await AlertEpisodeService.resolveEpisode(
|
|
209
|
+
new ObjectID(episodeId),
|
|
210
|
+
oneUptimeUserId,
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
logger.debug("Alert episode resolved successfully");
|
|
214
|
+
} catch (error) {
|
|
215
|
+
logger.error("Error resolving alert episode:");
|
|
216
|
+
logger.error(error);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@CaptureSpan()
|
|
221
|
+
public static async handleBotAlertEpisodeAction(data: {
|
|
222
|
+
actionType: string;
|
|
223
|
+
actionValue: string;
|
|
224
|
+
value: JSONObject;
|
|
225
|
+
projectId: ObjectID;
|
|
226
|
+
oneUptimeUserId: ObjectID;
|
|
227
|
+
turnContext: TurnContext;
|
|
228
|
+
}): Promise<void> {
|
|
229
|
+
const {
|
|
230
|
+
actionType,
|
|
231
|
+
actionValue,
|
|
232
|
+
value,
|
|
233
|
+
projectId,
|
|
234
|
+
oneUptimeUserId,
|
|
235
|
+
turnContext,
|
|
236
|
+
} = data;
|
|
237
|
+
|
|
238
|
+
if (actionType === MicrosoftTeamsAlertEpisodeActionType.AckAlertEpisode) {
|
|
239
|
+
if (!actionValue) {
|
|
240
|
+
await turnContext.sendActivity(
|
|
241
|
+
"Unable to acknowledge: missing alert episode id.",
|
|
242
|
+
);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
await AlertEpisodeService.acknowledgeEpisode(
|
|
247
|
+
new ObjectID(actionValue),
|
|
248
|
+
oneUptimeUserId,
|
|
249
|
+
);
|
|
250
|
+
await turnContext.sendActivity("✅ Alert episode acknowledged.");
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (
|
|
255
|
+
actionType === MicrosoftTeamsAlertEpisodeActionType.ResolveAlertEpisode
|
|
256
|
+
) {
|
|
257
|
+
if (!actionValue) {
|
|
258
|
+
await turnContext.sendActivity(
|
|
259
|
+
"Unable to resolve: missing alert episode id.",
|
|
260
|
+
);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
await AlertEpisodeService.resolveEpisode(
|
|
265
|
+
new ObjectID(actionValue),
|
|
266
|
+
oneUptimeUserId,
|
|
267
|
+
);
|
|
268
|
+
await turnContext.sendActivity("✅ Alert episode resolved.");
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (actionType === MicrosoftTeamsAlertEpisodeActionType.ViewAlertEpisode) {
|
|
273
|
+
if (!actionValue) {
|
|
274
|
+
await turnContext.sendActivity(
|
|
275
|
+
"Unable to view alert episode: missing episode id.",
|
|
276
|
+
);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const episode: AlertEpisode | null = await AlertEpisodeService.findOneBy({
|
|
281
|
+
query: {
|
|
282
|
+
_id: actionValue,
|
|
283
|
+
projectId: projectId,
|
|
284
|
+
},
|
|
285
|
+
select: {
|
|
286
|
+
_id: true,
|
|
287
|
+
title: true,
|
|
288
|
+
description: true,
|
|
289
|
+
currentAlertState: {
|
|
290
|
+
name: true,
|
|
291
|
+
},
|
|
292
|
+
alertSeverity: {
|
|
293
|
+
name: true,
|
|
294
|
+
},
|
|
295
|
+
createdAt: true,
|
|
296
|
+
alertCount: true,
|
|
297
|
+
},
|
|
298
|
+
props: {
|
|
299
|
+
isRoot: true,
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
if (!episode) {
|
|
304
|
+
await turnContext.sendActivity("Alert episode not found.");
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const message: string = `**Alert Episode Details**\n\n**Title:** ${episode.title}\n**Description:** ${episode.description || "No description"}\n**State:** ${episode.currentAlertState?.name || "Unknown"}\n**Severity:** ${episode.alertSeverity?.name || "Unknown"}\n**Alert Count:** ${episode.alertCount || 0}\n**Created At:** ${episode.createdAt ? new Date(episode.createdAt).toLocaleString() : "Unknown"}`;
|
|
309
|
+
|
|
310
|
+
await turnContext.sendActivity(message);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (
|
|
315
|
+
actionType ===
|
|
316
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewAddAlertEpisodeNote
|
|
317
|
+
) {
|
|
318
|
+
if (!actionValue) {
|
|
319
|
+
await turnContext.sendActivity(
|
|
320
|
+
"Unable to add note: missing episode id.",
|
|
321
|
+
);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Send the input card
|
|
326
|
+
const card: JSONObject = this.buildAddAlertEpisodeNoteCard(actionValue);
|
|
327
|
+
await turnContext.sendActivity({
|
|
328
|
+
attachments: [
|
|
329
|
+
{
|
|
330
|
+
contentType: "application/vnd.microsoft.card.adaptive",
|
|
331
|
+
content: card,
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
});
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (
|
|
339
|
+
actionType === MicrosoftTeamsAlertEpisodeActionType.SubmitAlertEpisodeNote
|
|
340
|
+
) {
|
|
341
|
+
if (!actionValue) {
|
|
342
|
+
await turnContext.sendActivity(
|
|
343
|
+
"Unable to add note: missing episode id.",
|
|
344
|
+
);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Check if form data is provided
|
|
349
|
+
const note: JSONValue = value["note"];
|
|
350
|
+
|
|
351
|
+
if (note) {
|
|
352
|
+
// Submit the note
|
|
353
|
+
const episodeId: ObjectID = new ObjectID(actionValue);
|
|
354
|
+
|
|
355
|
+
await AlertEpisodeInternalNoteService.addNote({
|
|
356
|
+
alertEpisodeId: episodeId,
|
|
357
|
+
note: note.toString(),
|
|
358
|
+
projectId: projectId,
|
|
359
|
+
userId: oneUptimeUserId,
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
await turnContext.sendActivity("✅ Note added successfully.");
|
|
363
|
+
|
|
364
|
+
// Hide the form card by deleting it
|
|
365
|
+
if (turnContext.activity.replyToId) {
|
|
366
|
+
await turnContext.deleteActivity(turnContext.activity.replyToId);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
await turnContext.sendActivity("Unable to add note: missing note data.");
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (
|
|
376
|
+
actionType ===
|
|
377
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewExecuteAlertEpisodeOnCallPolicy
|
|
378
|
+
) {
|
|
379
|
+
if (!actionValue) {
|
|
380
|
+
await turnContext.sendActivity(
|
|
381
|
+
"Unable to execute on-call policy: missing episode id.",
|
|
382
|
+
);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Send the input card
|
|
387
|
+
const card: JSONObject | null =
|
|
388
|
+
await this.buildExecuteAlertEpisodeOnCallPolicyCard(
|
|
389
|
+
actionValue,
|
|
390
|
+
projectId,
|
|
391
|
+
);
|
|
392
|
+
if (!card) {
|
|
393
|
+
await turnContext.sendActivity(
|
|
394
|
+
"No on-call policies found in the project",
|
|
395
|
+
);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
await turnContext.sendActivity({
|
|
399
|
+
attachments: [
|
|
400
|
+
{
|
|
401
|
+
contentType: "application/vnd.microsoft.card.adaptive",
|
|
402
|
+
content: card,
|
|
403
|
+
},
|
|
404
|
+
],
|
|
405
|
+
});
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (
|
|
410
|
+
actionType ===
|
|
411
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitExecuteAlertEpisodeOnCallPolicy
|
|
412
|
+
) {
|
|
413
|
+
if (!actionValue) {
|
|
414
|
+
await turnContext.sendActivity(
|
|
415
|
+
"Unable to execute on-call policy: missing episode id.",
|
|
416
|
+
);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Check if form data is provided
|
|
421
|
+
const onCallPolicyId: JSONValue = value["onCallPolicy"];
|
|
422
|
+
|
|
423
|
+
if (onCallPolicyId) {
|
|
424
|
+
// Execute the policy
|
|
425
|
+
const episodeId: ObjectID = new ObjectID(actionValue);
|
|
426
|
+
|
|
427
|
+
await OnCallDutyPolicyService.executePolicy(
|
|
428
|
+
new ObjectID(onCallPolicyId.toString()),
|
|
429
|
+
{
|
|
430
|
+
triggeredByAlertEpisodeId: episodeId,
|
|
431
|
+
userNotificationEventType:
|
|
432
|
+
UserNotificationEventType.AlertEpisodeCreated,
|
|
433
|
+
},
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
await turnContext.sendActivity(
|
|
437
|
+
"✅ On-call policy executed successfully.",
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
// Hide the form card by deleting it
|
|
441
|
+
if (turnContext.activity.replyToId) {
|
|
442
|
+
await turnContext.deleteActivity(turnContext.activity.replyToId);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
await turnContext.sendActivity(
|
|
448
|
+
"Unable to execute on-call policy: missing policy id.",
|
|
449
|
+
);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (
|
|
454
|
+
actionType ===
|
|
455
|
+
MicrosoftTeamsAlertEpisodeActionType.ViewChangeAlertEpisodeState
|
|
456
|
+
) {
|
|
457
|
+
if (!actionValue) {
|
|
458
|
+
await turnContext.sendActivity(
|
|
459
|
+
"Unable to change episode state: missing episode id.",
|
|
460
|
+
);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// Send the input card
|
|
465
|
+
const card: JSONObject = await this.buildChangeAlertEpisodeStateCard(
|
|
466
|
+
actionValue,
|
|
467
|
+
projectId,
|
|
468
|
+
);
|
|
469
|
+
await turnContext.sendActivity({
|
|
470
|
+
attachments: [
|
|
471
|
+
{
|
|
472
|
+
contentType: "application/vnd.microsoft.card.adaptive",
|
|
473
|
+
content: card,
|
|
474
|
+
},
|
|
475
|
+
],
|
|
476
|
+
});
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (
|
|
481
|
+
actionType ===
|
|
482
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitChangeAlertEpisodeState
|
|
483
|
+
) {
|
|
484
|
+
if (!actionValue) {
|
|
485
|
+
await turnContext.sendActivity(
|
|
486
|
+
"Unable to change episode state: missing episode id.",
|
|
487
|
+
);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Check if form data is provided
|
|
492
|
+
const alertStateId: JSONValue = value["alertState"];
|
|
493
|
+
|
|
494
|
+
if (alertStateId) {
|
|
495
|
+
// Update the state
|
|
496
|
+
const episodeId: ObjectID = new ObjectID(actionValue);
|
|
497
|
+
|
|
498
|
+
await AlertEpisodeService.updateOneById({
|
|
499
|
+
id: episodeId,
|
|
500
|
+
data: {
|
|
501
|
+
currentAlertStateId: new ObjectID(alertStateId.toString()),
|
|
502
|
+
},
|
|
503
|
+
props: {
|
|
504
|
+
isRoot: true,
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
await turnContext.sendActivity(
|
|
509
|
+
"✅ Alert episode state changed successfully.",
|
|
510
|
+
);
|
|
511
|
+
|
|
512
|
+
// Hide the form card by deleting it
|
|
513
|
+
if (turnContext.activity.replyToId) {
|
|
514
|
+
await turnContext.deleteActivity(turnContext.activity.replyToId);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
await turnContext.sendActivity(
|
|
520
|
+
"Unable to change episode state: missing state id.",
|
|
521
|
+
);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// Default fallback for unimplemented actions
|
|
526
|
+
await turnContext.sendActivity(
|
|
527
|
+
"Sorry, but the action " +
|
|
528
|
+
actionType +
|
|
529
|
+
" you requested is not implemented yet.",
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
private static buildAddAlertEpisodeNoteCard(episodeId: string): JSONObject {
|
|
534
|
+
return {
|
|
535
|
+
type: "AdaptiveCard",
|
|
536
|
+
$schema: "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
537
|
+
version: "1.5",
|
|
538
|
+
body: [
|
|
539
|
+
{
|
|
540
|
+
type: "TextBlock",
|
|
541
|
+
text: "Add Alert Episode Note",
|
|
542
|
+
size: "Large",
|
|
543
|
+
weight: "Bolder",
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
type: "Input.Text",
|
|
547
|
+
id: "note",
|
|
548
|
+
label: "Note",
|
|
549
|
+
isMultiline: true,
|
|
550
|
+
placeholder: "Please type in plain text or markdown.",
|
|
551
|
+
},
|
|
552
|
+
],
|
|
553
|
+
actions: [
|
|
554
|
+
{
|
|
555
|
+
type: "Action.Submit",
|
|
556
|
+
title: "Submit",
|
|
557
|
+
data: {
|
|
558
|
+
action: MicrosoftTeamsAlertEpisodeActionType.SubmitAlertEpisodeNote,
|
|
559
|
+
actionValue: episodeId,
|
|
560
|
+
},
|
|
561
|
+
},
|
|
562
|
+
],
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
private static async buildExecuteAlertEpisodeOnCallPolicyCard(
|
|
567
|
+
episodeId: string,
|
|
568
|
+
projectId: ObjectID,
|
|
569
|
+
): Promise<JSONObject | null> {
|
|
570
|
+
const onCallPolicies: Array<OnCallDutyPolicy> =
|
|
571
|
+
await OnCallDutyPolicyService.findBy({
|
|
572
|
+
query: {
|
|
573
|
+
projectId: projectId,
|
|
574
|
+
},
|
|
575
|
+
select: {
|
|
576
|
+
name: true,
|
|
577
|
+
_id: true,
|
|
578
|
+
},
|
|
579
|
+
props: {
|
|
580
|
+
isRoot: true,
|
|
581
|
+
},
|
|
582
|
+
limit: 50,
|
|
583
|
+
skip: 0,
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
const choices: Array<{ title: string; value: string }> = onCallPolicies
|
|
587
|
+
.map((policy: OnCallDutyPolicy) => {
|
|
588
|
+
return {
|
|
589
|
+
title: policy.name || "",
|
|
590
|
+
value: policy._id?.toString() || "",
|
|
591
|
+
};
|
|
592
|
+
})
|
|
593
|
+
.filter((choice: { title: string; value: string }) => {
|
|
594
|
+
return choice.title && choice.value;
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
if (choices.length === 0) {
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return {
|
|
602
|
+
type: "AdaptiveCard",
|
|
603
|
+
$schema: "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
604
|
+
version: "1.5",
|
|
605
|
+
body: [
|
|
606
|
+
{
|
|
607
|
+
type: "TextBlock",
|
|
608
|
+
text: "Execute On-Call Policy",
|
|
609
|
+
size: "Large",
|
|
610
|
+
weight: "Bolder",
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
type: "Input.ChoiceSet",
|
|
614
|
+
id: "onCallPolicy",
|
|
615
|
+
label: "On-Call Policy",
|
|
616
|
+
style: "compact",
|
|
617
|
+
choices: choices,
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
actions: [
|
|
621
|
+
{
|
|
622
|
+
type: "Action.Submit",
|
|
623
|
+
title: "Execute",
|
|
624
|
+
data: {
|
|
625
|
+
action:
|
|
626
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitExecuteAlertEpisodeOnCallPolicy,
|
|
627
|
+
actionValue: episodeId,
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
],
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
private static async buildChangeAlertEpisodeStateCard(
|
|
635
|
+
episodeId: string,
|
|
636
|
+
projectId: ObjectID,
|
|
637
|
+
): Promise<JSONObject> {
|
|
638
|
+
const alertStates: Array<AlertState> =
|
|
639
|
+
await AlertStateService.getAllAlertStates({
|
|
640
|
+
projectId: projectId,
|
|
641
|
+
props: {
|
|
642
|
+
isRoot: true,
|
|
643
|
+
},
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
const choices: Array<{ title: string; value: string }> = alertStates
|
|
647
|
+
.map((state: AlertState) => {
|
|
648
|
+
return {
|
|
649
|
+
title: state.name || "",
|
|
650
|
+
value: state._id?.toString() || "",
|
|
651
|
+
};
|
|
652
|
+
})
|
|
653
|
+
.filter((choice: { title: string; value: string }) => {
|
|
654
|
+
return choice.title && choice.value;
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
return {
|
|
658
|
+
type: "AdaptiveCard",
|
|
659
|
+
$schema: "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
660
|
+
version: "1.5",
|
|
661
|
+
body: [
|
|
662
|
+
{
|
|
663
|
+
type: "TextBlock",
|
|
664
|
+
text: "Change Alert Episode State",
|
|
665
|
+
size: "Large",
|
|
666
|
+
weight: "Bolder",
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
type: "Input.ChoiceSet",
|
|
670
|
+
id: "alertState",
|
|
671
|
+
label: "Alert State",
|
|
672
|
+
style: "compact",
|
|
673
|
+
choices: choices,
|
|
674
|
+
},
|
|
675
|
+
],
|
|
676
|
+
actions: [
|
|
677
|
+
{
|
|
678
|
+
type: "Action.Submit",
|
|
679
|
+
title: "Change",
|
|
680
|
+
data: {
|
|
681
|
+
action:
|
|
682
|
+
MicrosoftTeamsAlertEpisodeActionType.SubmitChangeAlertEpisodeState,
|
|
683
|
+
actionValue: episodeId,
|
|
684
|
+
},
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
}
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
MicrosoftTeamsOnCallDutyActionType,
|
|
86
86
|
} from "./Actions/ActionTypes";
|
|
87
87
|
import MicrosoftTeamsAlertActions from "./Actions/Alert";
|
|
88
|
+
import MicrosoftTeamsAlertEpisodeActions from "./Actions/AlertEpisode";
|
|
88
89
|
import MicrosoftTeamsMonitorActions from "./Actions/Monitor";
|
|
89
90
|
import MicrosoftTeamsScheduledMaintenanceActions from "./Actions/ScheduledMaintenance";
|
|
90
91
|
import MicrosoftTeamsOnCallDutyActions from "./Actions/OnCallDutyPolicy";
|
|
@@ -2519,6 +2520,21 @@ All monitoring checks are passing normally.`;
|
|
|
2519
2520
|
return;
|
|
2520
2521
|
}
|
|
2521
2522
|
|
|
2523
|
+
// Handle alert episode actions
|
|
2524
|
+
if (
|
|
2525
|
+
MicrosoftTeamsAlertEpisodeActions.isAlertEpisodeAction({ actionType })
|
|
2526
|
+
) {
|
|
2527
|
+
await MicrosoftTeamsAlertEpisodeActions.handleBotAlertEpisodeAction({
|
|
2528
|
+
actionType,
|
|
2529
|
+
actionValue,
|
|
2530
|
+
value,
|
|
2531
|
+
projectId,
|
|
2532
|
+
oneUptimeUserId,
|
|
2533
|
+
turnContext: data.turnContext,
|
|
2534
|
+
});
|
|
2535
|
+
return;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2522
2538
|
// Handle monitor actions
|
|
2523
2539
|
if (MicrosoftTeamsMonitorActions.isMonitorAction({ actionType })) {
|
|
2524
2540
|
await MicrosoftTeamsMonitorActions.handleBotMonitorAction({
|