Compare commits

...

393 Commits

Author SHA1 Message Date
Simon Larsen
30940991e0 feat: add endpoint to calculate uptime percentage for status page resources 2025-02-20 19:07:45 +00:00
Simon Larsen
a6d3047007 refactor: comment out workspace connections sections in side menus 2025-02-20 14:05:40 +00:00
Simon Larsen
2ae0d139ea refactor: simplify WorkflowTimeoutInMs declaration in EnvironmentConfig 2025-02-20 14:02:49 +00:00
Simon Larsen
1507583cf3 feat: add workflow timeout configuration and update related files 2025-02-20 14:00:28 +00:00
Simon Larsen
310e1b764c fix: log complete request body instead of just code in VM sandbox execution 2025-02-20 13:51:40 +00:00
Simon Larsen
1d7a25f2bb refactor: clean up code formatting and remove unnecessary whitespace in various files 2025-02-14 21:46:02 +00:00
Simon Larsen
3bc89a8cae feat: add migration to update postUpdatesToWorkspaceChannels column type to JSONB in Incident, Alert, and ScheduledMaintenance tables 2025-02-14 21:43:06 +00:00
Simon Larsen
ff54b5a26c feat: add notification event type support in WorkspaceNotificationRuleService and update NotificationRuleForm validation 2025-02-14 21:41:46 +00:00
Simon Larsen
07b9f38e90 feat: enhance Notification Rule form to support new channel template name and improve validation messages for existing channels 2025-02-14 19:45:40 +00:00
Simon Larsen
f612940668 feat: update Alert, Incident, and ScheduledMaintenance models to support multiple workspace channels and change column types to JSON 2025-02-14 18:35:44 +00:00
Simon Larsen
6046bda443 feat: update WorkspaceNotificationRuleService to return created channels and enhance WorkspaceChannel interface 2025-02-14 17:53:40 +00:00
Simon Larsen
cd97a72ef2 refactor: clean up whitespace and improve formatting in workspace utility classes 2025-02-14 17:51:05 +00:00
Simon Larsen
c20fbcc7a4 fix: correct spelling errors in comments and update variable names for clarity 2025-02-14 17:27:27 +00:00
Simon Larsen
f22e410860 feat: implement MicrosoftTeams workspace utility and enhance notification rule interfaces 2025-02-14 16:28:02 +00:00
Simon Larsen
3059ca848e refactor: reorganize Slack utility imports and introduce CreateChannelNotificationRule interface 2025-02-14 15:50:20 +00:00
Simon Larsen
ce8b8c3b58 refactor: update import path for IncidentNotificationRule to improve module organization 2025-02-14 13:13:29 +00:00
Simon Larsen
78846a3f95 refactor: improve code formatting and add documentation for non-HTTP methods in API reference 2025-02-14 13:12:44 +00:00
Simon Larsen
994f329a49 fix: update example API request URLs to use dynamic ID placeholders 2025-02-14 13:00:44 +00:00
Simon Larsen
d621df58cd refactor: remove obsolete migration file and clean up Slack utility code 2025-02-14 12:48:26 +00:00
Simon Larsen
0e0ccd9651 refactor: update method visibility and improve naming consistency in notification rule conditions 2025-02-14 12:36:54 +00:00
Simon Larsen
cc0adea216 refactor: remove unnecessary blank line in BaseAPI 2025-02-14 12:30:08 +00:00
Simon Larsen
8ec0825a52 feat: add update and delete item routes to BaseAPI and improve monitor ID handling in WorkspaceNotificationRuleService 2025-02-14 12:26:47 +00:00
Simon Larsen
4d083f9663 feat: refactor notification rule service to support new notification rule types and improve channel handling 2025-02-14 12:16:02 +00:00
Simon Larsen
81b3795b1c feat: update migration and interfaces to rename Slack channel references to Workspace channel for consistency 2025-02-14 09:58:10 +00:00
Simon Larsen
74cf9ae184 feat: rename Slack channel references to Workspace channel for consistency across models 2025-02-12 17:58:29 +00:00
Simon Larsen
9ba4c0bfdd feat: implement validation for notification rule form inputs to enhance user experience 2025-02-12 17:49:07 +00:00
Simon Larsen
85e83c6822 feat: rename inviteOwnersToNewChannel to shouldInviteOwnersToNewChannel for clarity and update NotificationRuleForm to include new toggle option 2025-02-12 17:33:05 +00:00
Simon Larsen
65eedde511 feat: reintroduce AlertNotificationRule interface and update NotificationRuleForm to support new channel creation and user invitations 2025-02-12 17:29:46 +00:00
Simon Larsen
7d45056ae4 feat: update notification rule form to support dynamic workspace type for channel creation and user invitations 2025-02-12 17:16:52 +00:00
Simon Larsen
f2db382087 feat: introduce new notification rule types for monitor status, alerts, and scheduled maintenance with updated logic for channel management 2025-02-12 17:14:18 +00:00
Simon Larsen
3e99783119 feat: add migration to rename Slack channel ID columns to channel name for improved clarity 2025-02-12 15:36:20 +00:00
Simon Larsen
de6bbbee8c feat: rename Slack channel ID references to channel name and update related logic for improved clarity 2025-02-12 15:35:17 +00:00
Simon Larsen
0309c2d7e8 feat: enhance Slack notification rule handling by adding channel creation logic and user invitation functionality 2025-02-12 14:23:33 +00:00
Simon Larsen
1c9bb0605b feat: update notification rule conditions and enhance incident service methods for improved clarity and functionality 2025-02-12 13:58:03 +00:00
Simon Larsen
b8b98be7a0 feat: rename WorkspacePayloadBlock to WorkspaceMessageBlock and update related methods in WorkspaceNotificationRuleService 2025-02-11 19:20:53 +00:00
Simon Larsen
6c037b0996 feat: rename WorkspaceNotificationPayload to WorkspaceMessagePayload and update related services 2025-02-11 17:49:29 +00:00
Simon Larsen
326b60c260 feat: enhance Slack notification payload structure and improve incident service methods 2025-02-11 17:17:03 +00:00
Simon Larsen
e13ab0b214 feat: implement getWorkspacePayloadForIncidentCreate method and enhance Slack notification payload structure 2025-02-11 16:25:16 +00:00
Simon Larsen
01f8a27dd2 feat: add postUpdatesToSlackChannelId field to Alert, Incident, and ScheduledMaintenance models for Slack integration 2025-02-11 15:51:52 +00:00
Simon Larsen
081029b49a feat: add postUpdatesToSlackChannelId field to Alert, Incident, and ScheduledMaintenance models for Slack integration 2025-02-11 13:57:33 +00:00
Simon Larsen
32d55fdc46 refactor: improve code formatting and enhance readability in various service and utility files 2025-02-11 13:53:21 +00:00
Simon Larsen
69aa680dd1 feat: update user creation to optionally include full name and enhance Slack notification methods 2025-02-11 13:43:37 +00:00
Simon Larsen
117c02d457 refactor: comment out Workspace Connections section in SideMenu components 2025-02-11 10:17:43 +00:00
Simon Larsen
f74fcb3734 refactor: clean up whitespace and improve code formatting in various components 2025-02-10 21:20:43 +00:00
Simon Larsen
676d6598d7 feat: enhance error handling and messaging in MonitorCriteriaInstance and related components 2025-02-10 21:15:38 +00:00
Simon Larsen
af1edfef99 fix: correct validation error check in MonitorStep and tidy up CriteriaFilters component 2025-02-10 20:50:02 +00:00
Simon Larsen
56cadf01fd feat: implement hasValueField utility method for CriteriaFilter validation 2025-02-10 20:35:22 +00:00
Simon Larsen
6a0ef8d940 refactor: improve code formatting and structure in migration files and notification rule validation logic 2025-02-10 20:21:43 +00:00
Simon Larsen
1e01942218 feat: implement validation logic for Slack notification rules in NotificationRuleConditionUtil 2025-02-10 20:16:59 +00:00
Simon Larsen
5dab4f8042 feat: add scheduledMaintenanceNumber column to ScheduledMaintenance table and create corresponding index 2025-02-10 19:54:52 +00:00
Simon Larsen
3e4a50d430 refactor: clean up code by removing unnecessary blank lines in Alert and ScheduledMaintenance models, migration files, and services 2025-02-10 18:54:54 +00:00
Simon Larsen
96d236b034 feat: add scheduledMaintenanceNumber to ScheduledMaintenance model and implement related logic in service and UI components 2025-02-10 18:50:52 +00:00
Simon Larsen
ade5e69aa0 feat: add alertNumber column to Alert table and create corresponding index 2025-02-10 18:06:55 +00:00
Simon Larsen
4733c710b2 feat: add alertNumber field to Alert model and implement related logic in AlertService and UI components 2025-02-10 18:02:54 +00:00
Simon Larsen
1c8922249e feat: add WorkspaceNotificationPayload interface and update notifyWorkspace method to accept new payload structure 2025-02-10 17:55:50 +00:00
Simon Larsen
73c787836f feat: introduce WorkspaceType and NotificationRuleEventType enums; implement SlackNotificationRule interface and related services 2025-02-10 17:43:49 +00:00
Simon Larsen
ec6f3d84d7 refactor: rename ServiceProviderType to WorkspaceType and update related components for consistency 2025-02-10 17:40:07 +00:00
Simon Larsen
1f2df5f3ee refactor: rename initialValue prop to value in notification rule components for consistency 2025-02-10 14:47:33 +00:00
Simon Larsen
121a78ea8d refactor: improve code formatting and readability in form components 2025-02-10 14:42:34 +00:00
Simon Larsen
832ab4ab24 Merge branch 'master' of github.com:OneUptime/oneuptime 2025-02-10 14:25:33 +00:00
Simon Larsen
445f3906ee feat: improve notification rule forms and conditions; enhance filter handling and UI elements 2025-02-10 14:25:30 +00:00
Simon Larsen
c869acc0e5 Merge pull request #1831 from diabolocom/nginx_ipv6
Feature: Nginx: Allow to specify listen options
2025-02-10 13:59:24 +00:00
Simon Larsen
0d2b2a272b feat: enhance notification rule conditions and form fields with additional labels and descriptions 2025-02-10 13:18:37 +00:00
Simon Larsen
d8ac1c39b7 feat: add option to show horizontal rule in form fields 2025-02-10 13:03:21 +00:00
Simon Larsen
e31dbe935c feat: enhance Slack integration and notification rule forms with additional descriptions and conditions 2025-02-10 12:59:00 +00:00
Jules Lefebvre
35e46cebfc feat(helm): add nginx listen config values
Add the posibility to define `NGINX_LISTEN_ADDRESS` and `NGINX_LISTEN_OPTIONS` via the `nginx.listenAddress` and `nginx.listenOptions` to allow to listen on all single and dual stack
2025-02-10 13:58:28 +01:00
Jules Lefebvre
891861f396 feat(docker-compose): add nginx listen enviroment variables
Add the posibility to define `NGINX_LISTEN_ADDRESS` and `NGINX_LISTEN_OPTIONS` to allow to listen on all single and dual stack
2025-02-10 13:57:36 +01:00
Jules Lefebvre
fbc38230b8 feat(nginx): allow to specify listen options 2025-02-10 13:44:35 +01:00
Simon Larsen
61561f9745 fix: add missing comma in schema migrations index for consistency 2025-02-10 12:25:09 +00:00
Simon Larsen
13e5f57160 feat: add migration for ServiceProviderUserAuthToken table and update index; log project creation for user 2025-02-10 11:43:03 +00:00
Simon Larsen
7600085473 feat: add migration for ServiceProviderUserAuthToken, ServiceProviderProjectAuthToken, ServiceProviderSetting, and ServiceProviderNotificationRule tables 2025-02-10 11:29:53 +00:00
Simon Larsen
99641d6994 refactor: remove obsolete migration files and clean up schema migrations index 2025-02-10 11:25:27 +00:00
Simon Larsen
dea66cc8d8 refactor: improve formatting of radioButtonOptions mapping in FormField component 2025-02-07 20:02:25 +00:00
Simon Larsen
1dd43a69a0 refactor: clean up formatting and improve readability in various components 2025-02-07 19:43:09 +00:00
Simon Larsen
e539cb7ae3 feat: add onBeforeCreate handler to ServiceProviderNotificationRulesTable for event type and project ID assignment 2025-02-07 19:33:50 +00:00
Simon Larsen
5269f7a164 feat: replace RadioButton with OptionChooserButton in form field schema and update related components 2025-02-07 19:29:02 +00:00
Simon Larsen
8e1d6b420f feat: enhance SlackIntegration component with connection handlers and improve notification rule naming 2025-02-07 19:10:30 +00:00
Simon Larsen
311f7dbb5b refactor: rename connection state variables for clarity in SlackIntegration component 2025-02-07 18:51:54 +00:00
Simon Larsen
9ac64b5873 feat: add color selection to ServiceProviderNotificationRulesTable and update SlackIntegration component props 2025-02-07 18:45:56 +00:00
Simon Larsen
e54126e6bf refactor: clean up permission definitions and formatting in ServiceProvider models 2025-02-07 18:36:56 +00:00
Simon Larsen
a4acc59505 fix: remove unnecessary permissions from ServiceProviderNotificationRule update access control 2025-02-07 18:31:35 +00:00
Simon Larsen
854bc297a6 feat: add permissions for Service Provider Notification Rules and update access control in ServiceProviderProjectAuthToken 2025-02-07 18:29:34 +00:00
Simon Larsen
69bfb48573 refactor: rename Settings component to SlackIntegrationPage for clarity 2025-02-07 18:18:20 +00:00
Simon Larsen
9ef7f720b1 refactor: improve code formatting and readability in ServiceProviderNotificationRulesTable and SlackIntegration components 2025-02-07 18:14:42 +00:00
Simon Larsen
2155dcad65 fix: correct spelling of NotificationRuleForm and NotificationRuleViewElement components; remove unused ServiceProviderNotificationRules component 2025-02-07 18:10:58 +00:00
Simon Larsen
fb4da29ade fix: correct URL formatting for social media and blog links in BlogPostUtil 2025-02-07 14:04:14 +00:00
Simon Larsen
d146d33059 Merge branch 'master' of github.com:OneUptime/oneuptime 2025-02-07 11:03:51 +00:00
Simon Larsen
978ac9155f refactor: update event type cases in NotificationRuleConditionUtil for consistency 2025-02-07 11:03:34 +00:00
Simon Larsen
cf9b4f0eba refactor: simplify value extraction in NotificationRuleConditionElement 2025-02-07 11:01:58 +00:00
Simon Larsen
d26a2aa995 refactor: update type annotations for selected alert and incident conditions in NotificationRuleConditionElement 2025-02-07 10:56:15 +00:00
Simon Larsen
c8301e21eb feat: update NotificationRule components to include event type in titles and descriptions 2025-02-07 10:53:25 +00:00
Simon Larsen
1a24232a1c refactor: improve code formatting and readability in AlertSeverityElement, IncidentStateElement, and NotificationRuleForm components 2025-02-07 10:42:06 +00:00
Simon Larsen
69c94835fe Merge pull request #1830 from OneUptime/slack-app
Slack app
2025-02-07 10:26:00 +00:00
Simon Larsen
706a9145ac feat: add NotificationRuleConditions and NotificationRuleForm components for enhanced notification rule management 2025-02-06 19:57:05 +00:00
Simon Larsen
9bde6194a5 feat: add NotificationRuleConditionElement and related components for alert and incident states 2025-02-06 19:29:55 +00:00
Simon Larsen
3dd8c62bc4 feat: enhance SlackNotificationRule and NotificationRuleForm with new fields and conditions 2025-02-06 18:47:12 +00:00
Simon Larsen
895a434d0e refactor: clean up code formatting and improve readability in various files 2025-02-06 17:49:01 +00:00
Simon Larsen
d3ec3a60df feat: implement NotificationRuleForm component and utility functions for condition checks 2025-02-06 14:25:39 +00:00
Simon Larsen
df15a2dcae feat: add name and description fields to ServiceProviderNotificationRule model and update migration 2025-02-06 12:18:04 +00:00
Simon Larsen
5e4b24dcfb feat: refactor notification rule models to use BaseNotificationRule and update filter conditions 2025-02-06 11:14:52 +00:00
Simon Larsen
0eae73c4e5 feat: add ServiceProviderNotificationRule model and service with migration 2025-02-06 11:03:43 +00:00
Simon Larsen
deb3f81e5d Merge pull request #1817 from OneUptime/slack-app
Slack App
2025-02-05 19:22:02 +00:00
Simon Larsen
dcb3fe6f69 feat: add ServiceProviderSetting model and service with CRUD operations 2025-02-05 17:33:45 +00:00
Simon Larsen
4bbecb3013 feat: refactor ServiceProviderProjectAuthToken and ServiceProviderSetting models, add deletedByUserId field 2025-02-05 16:25:13 +00:00
Simon Larsen
52954f3702 feat: add migration for ServiceProviderUserAuthToken and ServiceProviderProjectAuthToken tables 2025-02-05 16:17:37 +00:00
Simon Larsen
12a7fff668 refactor: update ServiceProviderUserAuthToken to use ServiceProviderType enum 2025-02-05 16:12:14 +00:00
Simon Larsen
14e489a719 feat: implement ServiceProviderType enum and refactor auth token services for Slack and Microsoft Teams 2025-02-05 16:09:50 +00:00
Simon Larsen
83f2935f41 fix: update Slack integration page URL to reflect new settings path 2025-02-05 16:00:49 +00:00
Simon Larsen
28855d482e 2025-02-05 15:56:15 +00:00
Simon Larsen
7c11ebdacf refactor: rename "Workspace Integrations" to "Workspace Connections" in SideMenu 2025-02-05 14:10:17 +00:00
Simon Larsen
592c806465 feat: add user and project auth token services to BaseAPI routing 2025-02-05 14:09:36 +00:00
Simon Larsen
7a3d0266c4 chore: update SlackAPI comments to use sample access tokens for clarity 2025-02-05 14:00:17 +00:00
Simon Larsen
e9b7368cf1 refactor: clean up code by removing unnecessary whitespace and improving formatting 2025-02-05 13:58:27 +00:00
Simon Larsen
f8c0004f85 feat: add Slack integration section to settings menu and routing 2025-02-05 13:45:26 +00:00
Simon Larsen
b007cb8bbd feat: implement Slack integration settings page and enhance auth token services for user and project 2025-02-05 13:43:22 +00:00
Simon Larsen
541015766c feat: rename service type to service provider type and add new fields for user and project IDs in service provider 2025-02-05 11:55:17 +00:00
Simon Larsen
5310087287 feat: update Slack app manifest by refining user and bot scopes and adding a temporary manifest file 2025-02-04 19:33:32 +00:00
Simon Larsen
7649c6c566 feat: update Slack integration authorization URL and add app manifest for enhanced functionality 2025-02-04 19:23:09 +00:00
Simon Larsen
1b2650f6df feat: expand Slack app manifest scopes for enhanced functionality 2025-02-04 19:14:02 +00:00
Simon Larsen
de3586d60e feat: update Slack integration error handling and redirect logic in user settings 2025-02-04 19:08:17 +00:00
Simon Larsen
a0ca579c2f feat: enhance Slack integration error handling and redirect logic in user settings 2025-02-04 19:04:39 +00:00
Simon Larsen
9bc7a115a1 feat: implement Slack app manifest retrieval and enhance scope validation in user settings 2025-02-04 18:51:26 +00:00
Simon Larsen
aef7af0a9a feat: refactor Slack utility imports and add new Slack utility class 2025-02-04 18:35:34 +00:00
Simon Larsen
e9f2e46e16 feat: add endpoint to retrieve Slack app manifest 2025-02-04 18:17:44 +00:00
Simon Larsen
56fd18f7c9 feat: update Slack API with improved error handling and new command shortcuts 2025-02-04 18:16:30 +00:00
Simon Larsen
ecccd8b536 feat: enhance Slack authentication flow with projectId and userId validation 2025-02-04 18:09:35 +00:00
Simon Larsen
dd2f0f37f2 fix: simplify signature validation logic in SlackAuthorization middleware 2025-02-04 18:00:32 +00:00
Simon Larsen
600a5eafe3 fix: update SlackAuthorization middleware to use req.body instead of req.rawBody 2025-02-04 17:54:53 +00:00
Simon Larsen
9b07bf7a08 feat: implement Slack API integration with authorization and event handling 2025-02-04 17:53:59 +00:00
Simon Larsen
d341f6c2b0 feat: enhance Slack integration with error handling and documentation 2025-02-04 15:33:24 +00:00
Simon Larsen
06a030f518 feat: add Slack app client credentials to Helm chart configuration 2025-02-04 14:34:42 +00:00
Simon Larsen
b02fed6e5b feat: add Slack App configuration to environment and UI settings 2025-02-04 14:33:48 +00:00
Simon Larsen
310884bd73 feat: implement Slack OAuth redirection in SlackIntegration component 2025-02-04 14:22:19 +00:00
Simon Larsen
0c625d52c2 feat: update Slack icon SVG paths for improved rendering 2025-02-04 14:11:54 +00:00
Simon Larsen
82ab70f396 refactor: clean up whitespace and formatting in UserSettingsBreadcrumbs and UserSettingsRoutes 2025-02-04 14:08:15 +00:00
Simon Larsen
24d9c9dbc0 feat: add Slack integration to user settings with routing and breadcrumbs 2025-02-04 14:04:49 +00:00
Simon Larsen
d9f1dc9fd2 feat: add UserAuthToken and ProjectAuthToken services and migrations 2025-02-04 13:44:51 +00:00
Simon Larsen
4b503471bd feat: implement Slack status API and initialize routing 2025-02-04 12:40:05 +00:00
Simon Larsen
b523434be3 feat: add Slack app manifest for OneUptime integration 2025-02-04 11:43:22 +00:00
Simon Larsen
f32b1950d9 fix: add return type to sendSubscriptionChangeWebhookSlackNotification method in ProjectService 2025-02-03 18:42:08 +00:00
Simon Larsen
e1c45a5c99 refactor: update property name from 'id' to '_id' and improve Slack message formatting in ProjectService 2025-02-03 18:41:20 +00:00
Simon Larsen
195655b4df refactor: improve code formatting and readability in ProjectService 2025-02-03 18:23:59 +00:00
Simon Larsen
9d7d65f0ef feat: add Slack notification for subscription plan changes in ProjectService 2025-02-03 18:05:08 +00:00
Simon Larsen
985b5410f6 refactor: clean up formatting and improve code readability in environment config and project service 2025-02-03 17:54:41 +00:00
Simon Larsen
d1dd57deec feat: add Slack webhook notifications for user creation, project management, and subscription updates 2025-02-03 17:50:34 +00:00
Simon Larsen
2ec6902537 refactor: improve async handling in BlogPost utility methods 2025-02-03 17:26:01 +00:00
Simon Larsen
cd130bc8ef feat: enhance status page URL handling and add unsubscribe link in subscription emails 2025-01-31 14:34:11 +00:00
Simon Larsen
3fcd1f694e refactor: clean up whitespace and formatting in blog-related files 2025-01-31 14:14:39 +00:00
Simon Larsen
b98b43b9f6 feat: add blog management features and update routing for blog posts 2025-01-31 14:10:54 +00:00
Simon Larsen
b59c76f771 feat: set log limit to 250 in TraceExplorer and Logs components 2025-01-30 20:35:46 +00:00
Simon Larsen
4d2e386328 feat: set default log limit to 250 in DashboardLogsViewer 2025-01-30 17:23:56 +00:00
Simon Larsen
deddcbe152 refactor: add serviceName attribute to telemetry data attributes 2025-01-30 17:00:30 +00:00
Simon Larsen
e305284fe2 refactor: enhance error handling and logging in TelemetryIngest middleware 2025-01-30 16:47:55 +00:00
Simon Larsen
3163debdb8 chore: remove end-to-end test workflow from GitHub Actions 2025-01-30 15:39:59 +00:00
Simon Larsen
f827237a80 refactor: change convertSelectReturnedDataToJson method visibility from private to public in AnalyticsDatabaseService 2025-01-30 15:22:32 +00:00
Simon Larsen
c038e39620 refactor: replace executeQuery calls with execute for consistency in AnalyticsDatabaseService 2025-01-30 15:20:28 +00:00
Simon Larsen
b8c1190c9f refactor: update execute method calls to use executeQuery for consistency in AnalyticsDatabaseService 2025-01-30 14:54:12 +00:00
Simon Larsen
7f5ff5068e refactor: improve code formatting and readability in AnalyticsDatabaseService and LogsViewer components 2025-01-30 14:47:54 +00:00
Simon Larsen
943acc8567 feat: add Clickhouse configuration volume and update AnalyticsDatabaseService to use ResultSet for JSON responses 2025-01-30 11:58:43 +00:00
Simon Larsen
81798211ea chore: update @clickhouse/client and @clickhouse/client-common to version 1.10.1 2025-01-29 21:02:48 +00:00
Simon Larsen
39596f6a42 refactor: replace <div> tags with <pre> for better JSON body rendering in LogsViewer component 2025-01-29 18:35:13 +00:00
Simon Larsen
36a181e77e refactor: replace <pre> tags with <div> for log body rendering in LogsViewer component 2025-01-29 18:25:55 +00:00
Simon Larsen
032c03a877 docs: update health check extension comment to indicate deprecation and suggest upgrade to health_check_v2 2025-01-29 15:42:19 +00:00
Simon Larsen
500299fb2f feat: add liveness, readiness, and startup probes to otel-collector configuration 2025-01-29 15:40:26 +00:00
Simon Larsen
b959e84032 feat: add health check extension to OTel collector configuration 2025-01-29 15:38:57 +00:00
Simon Larsen
30edc194f4 feat: add batch processor configuration for OTLP exporter in collector config template 2025-01-29 14:07:49 +00:00
Simon Larsen
0a20894dd1 feat: add DISABLE_TELEMETRY environment variable to multiple templates for telemetry control 2025-01-28 20:28:03 +00:00
Simon Larsen
1045a7399f fix: change OTLP exporter protocol from http/json to http/protobuf in config template 2025-01-28 19:44:51 +00:00
Simon Larsen
0f3ef0027b fix: update OTLP exporter protocol from http/protobuf to http/json in config template 2025-01-28 19:19:24 +00:00
Simon Larsen
2f43bc5c65 feat: add setup function for ts-node installation in configure script 2025-01-28 18:34:59 +00:00
Simon Larsen
8d9f7e125d feat: add additional breadcrumb links for status pages 2025-01-28 18:27:06 +00:00
Simon Larsen
3ac841ddc1 refactor: improve code formatting and simplify component structure in status pages 2025-01-28 17:27:21 +00:00
Simon Larsen
9fc8c6f7a2 refactor: update route paths and simplify side menu component for status pages 2025-01-28 17:24:22 +00:00
Simon Larsen
62cd974235 refactor: clean up whitespace and improve code formatting in status pages 2025-01-28 13:05:14 +00:00
Simon Larsen
a0d03238ee feat: add announcements route and update breadcrumbs for status pages 2025-01-28 12:55:43 +00:00
Simon Larsen
4303cf00cc feat: add announcements page and update routing for status pages 2025-01-28 12:49:57 +00:00
Simon Larsen
747ea70de5 refactor: update date formatting in scheduled maintenance feed for improved readability 2025-01-28 12:00:19 +00:00
Simon Larsen
6dd4ef22df refactor: enhance scheduled maintenance feed with additional details and improve Recurring class string representation 2025-01-28 11:52:11 +00:00
Simon Larsen
4b97c79ae2 refactor: enhance alert and scheduled maintenance feed updates with additional data fields 2025-01-28 11:36:30 +00:00
Simon Larsen
d34b118c68 refactor: streamline summary prop definition in form components 2025-01-28 11:26:37 +00:00
Simon Larsen
a3ff2e1067 refactor: introduce FormSummaryConfig interface and update form components to use it 2025-01-28 11:23:32 +00:00
Simon Larsen
e6ef2a7945 chore: add concurrency settings to test-release workflow 2025-01-27 19:57:57 +00:00
Simon Larsen
9bf8d5d941 refactor: improve readability of getSummaryElement functions in ScheduledMaintenanceCreate component 2025-01-27 19:53:34 +00:00
Simon Larsen
f3ee93bd48 refactor: remove unused import from Create.tsx in ScheduledMaintenanceEvents 2025-01-27 19:47:06 +00:00
Simon Larsen
5b78fee225 refactor: rename StatusPagesLabel to StatusPagesElement and update imports across components 2025-01-27 19:46:51 +00:00
Simon Larsen
dd73947b7f Merge branch 'release' of github.com:OneUptime/oneuptime into release 2025-01-27 18:25:15 +00:00
Simon Larsen
78998fb123 refactor: simplify form field mapping and improve readability in FormSummary component 2025-01-27 18:22:51 +00:00
Simon Larsen
0bcfccffe0 feat: add margin-bottom to form step title for improved spacing in FormSummary component 2025-01-27 18:19:23 +00:00
Simon Larsen
3ab45f40ca feat: optimize FormSummary component by refining field filtering logic and improving step title styling 2025-01-27 18:16:16 +00:00
Simon Larsen
bb2f610bc8 feat: enhance form summary component to support conditional rendering of form steps and improve layout structure 2025-01-27 18:10:45 +00:00
Simon Larsen
9b685133c4 feat: enhance incident severity and monitor status components with new props for animation and improved data handling 2025-01-27 17:58:21 +00:00
Simon Larsen
33c4943794 refactor: standardize fetch functions to use PromiseVoidFunction type and improve error handling in incident severity, monitors, monitor statuses, and on-call policies components 2025-01-27 17:49:33 +00:00
Simon Larsen
a7f8aa4faa refactor: update state initialization and error handling in Fetch components; improve type definitions for fetch functions 2025-01-27 17:41:27 +00:00
Simon Larsen
722fe30c8f feat: implement FetchMonitors, FetchMonitorStatuses, and FetchOnCallPolicies components; update Field interface for summary element handling 2025-01-27 17:37:08 +00:00
Simon Larsen
500104eb81 feat: add FetchTeams and FetchUsers components; implement label ID handling in IncidentCreate 2025-01-27 17:07:22 +00:00
Simon Larsen
41c3a14dfa fix: change exit code in configure.sh to allow continuation on directory change failure 2025-01-27 16:55:47 +00:00
Simon Larsen
113eda94fa Merge branch 'master' of github.com:OneUptime/oneuptime 2025-01-27 16:51:49 +00:00
Simon Larsen
c6ce43f7cc feat: add FormSummary component and integrate it into BasicForm; implement FetchLabels for incident labels 2025-01-27 16:49:53 +00:00
Simon Larsen
6d5bc60127 fix: update secondTLDs initialization to use split method for better readability 2025-01-27 16:49:46 +00:00
Simon Larsen
b7b7b28834 Merge pull request #1816 from KalvadTech/improve_configure_sh
refactor: modernize configure.sh
2025-01-27 16:48:26 +00:00
Loïc Tosser
5a0b0d7c61 refactor: modernize configure.sh with improved error handling, modularity, and installation process 2025-01-27 18:50:51 +04:00
Simon Larsen
79bf7ce7ee fix: replace props.steps with getFormSteps in BasicForm component 2025-01-27 11:03:31 +00:00
Simon Larsen
4ab150bf75 refactor: clean up code formatting and improve readability in various files 2025-01-27 10:54:46 +00:00
Simon Larsen
951668c982 fix: update debug log messages to specify 'test' for monitor list API 2025-01-27 10:52:59 +00:00
Simon Larsen
d7845407f0 fix: set default limit to 100 in FetchMonitorTest 2025-01-27 10:47:35 +00:00
Simon Larsen
8c5e3187ab feat: add MonitorTestService to services index 2025-01-27 10:44:56 +00:00
Simon Larsen
d2ae1cd845 Merge pull request #1814 from OneUptime/master
chore: update playwright to version 1.50.0 and adjust debugger port i…
2025-01-24 19:18:03 +00:00
Simon Larsen
8cb64fbe66 feat: add isSummaryStep property to BasicForm and FormStep interface 2025-01-24 19:11:49 +00:00
Simon Larsen
092b858873 fix: correct spelling of 'enabled' in BasicForm and update related components 2025-01-24 18:54:28 +00:00
Simon Larsen
81d19722f6 chore: update dependencies in test-release workflow to include infrastructure-agent-deploy 2025-01-24 18:39:11 +00:00
Simon Larsen
1f7b268875 feat: add summary step to BasicForm and implement detail display for form fields 2025-01-24 18:32:10 +00:00
Simon Larsen
38b32a6090 refactor: improve code formatting and consistency in IncidentService 2025-01-24 18:08:21 +00:00
Simon Larsen
373159cb29 feat: enhance incident update feed with detailed information including title, root cause, description, remediation notes, labels, and severity 2025-01-24 17:59:52 +00:00
Simon Larsen
ec86ef4c0e chore: update playwright to version 1.50.0 and adjust debugger port in launch configuration 2025-01-24 16:11:51 +00:00
Simon Larsen
270231374b refactor: clean up migration and improve formatting for subscriber email notification footer text 2025-01-24 10:48:31 +00:00
Simon Larsen
aac4281602 feat: update subscriber email notification footer text to support longer content and add migration 2025-01-24 10:45:51 +00:00
Simon Larsen
bdea1139a4 refactor: improve code formatting for subscriber email notification footer text 2025-01-24 10:36:02 +00:00
Simon Larsen
14fdfa6d17 feat: add subscriber email notification footer text to status page and update notification templates 2025-01-24 10:31:59 +00:00
Simon Larsen
3b22747dbf Merge branch 'release' 2025-01-23 21:51:08 +00:00
Simon Larsen
eb9e20dad5 fix: update OpenTelemetry configuration template to use index for environment variables 2025-01-23 21:31:58 +00:00
Simon Larsen
5aa4b883ad feat: add OpenTelemetry exporter configuration options in Helm chart templates 2025-01-23 21:28:11 +00:00
Simon Larsen
ea38e2621f refactor: clean up code formatting and remove unused props in Scheduled Maintenance components 2025-01-23 16:22:16 +00:00
Simon Larsen
b2cb95e1fc feat: enhance Scheduled Maintenance Table with template creation buttons and update description in create page 2025-01-23 16:17:26 +00:00
Simon Larsen
b174b9795a feat: add imports for form handling and recurring events in Scheduled Maintenance Create page 2025-01-23 16:10:19 +00:00
Simon Larsen
9d1caa8336 feat: add Scheduled Maintenance Event creation page and update routing and breadcrumbs 2025-01-23 16:07:35 +00:00
Simon Larsen
52e8669960 feat: remove unused createInitialValues prop from IncidentsTable component 2025-01-23 15:51:09 +00:00
Simon Larsen
f0505725a7 feat: refine query parameters handling in Route class and improve navigation logic 2025-01-23 15:49:33 +00:00
Simon Larsen
7897641ef7 feat: implement addQueryParams method in Route class and update incident navigation logic 2025-01-23 15:07:11 +00:00
Simon Larsen
761f5f35e9 feat: add query parameters support in navigation and update incident declaration flow 2025-01-23 14:56:59 +00:00
Simon Larsen
241586ff4a feat: add Incident creation page with routing and breadcrumbs integration 2025-01-23 14:39:15 +00:00
Simon Larsen
f8fc1a9dae feat: enhance Monitor layout with hideSideMenu prop and improve component styling 2025-01-23 13:59:24 +00:00
Simon Larsen
6bbcc0a301 feat: add hideSideMenu prop to Monitor layout and update routing logic 2025-01-23 13:43:58 +00:00
Simon Larsen
0e6604aa11 refactor: update description in Monitor creation component for clarity 2025-01-23 13:24:40 +00:00
Simon Larsen
ade84a23ff refactor: clean up Monitor creation component and improve button navigation 2025-01-23 13:10:20 +00:00
Simon Larsen
6ff883b54e feat: add Monitor creation page and update routing and breadcrumbs 2025-01-23 12:52:27 +00:00
Simon Larsen
3546d92143 refactor: update localRoot paths in launch.json and improve logging in CheckHeartbeat and UpdateConnectionStatus 2025-01-23 12:41:34 +00:00
Simon Larsen
e932eb1b1d feat: update DISABLE_TELEMETRY value to false in otel-collector.yaml 2025-01-22 17:49:30 +00:00
Simon Larsen
cbca712af8 feat: add OpenTelemetry exporter environment variables and disable telemetry in otel-collector.yaml 2025-01-22 17:49:00 +00:00
Simon Larsen
8490128833 feat: add DISABLE_TELEMETRY environment variable to otel-collector.yaml 2025-01-22 15:38:10 +00:00
Simon Larsen
b80e126540 chore: update Playwright and related dependencies to version 1.49.1 2025-01-22 13:53:30 +00:00
Simon Larsen
5494a2244e feat: update Dockerfile.tpl to use new OpenTelemetry Collector version and improve gomplate installation 2025-01-22 12:44:22 +00:00
Simon Larsen
23be5b1736 fix: downgrade collector version to 0.104.0 and enhance config output in Dockerfile.tpl 2025-01-22 12:12:15 +00:00
Simon Larsen
9f3a9bc915 fix: update download command in Dockerfile.tpl to use uname for architecture detection 2025-01-22 11:34:00 +00:00
Simon Larsen
84d322f476 fix: correct echo command syntax in OTelCollector Dockerfile.tpl 2025-01-22 11:15:23 +00:00
Simon Larsen
f94fbcc2ae feat: improve architecture detection and installation process in Dockerfile.tpl 2025-01-22 11:11:14 +00:00
Simon Larsen
0e85162b50 fix: update architecture detection syntax in Dockerfile.tpl for compatibility 2025-01-21 15:59:59 +00:00
Simon Larsen
a5927f3681 feat: refactor Dockerfile.tpl to streamline gomplate installation and architecture detection 2025-01-21 15:58:20 +00:00
Simon Larsen
0d37587199 feat: enhance OpenTelemetry Collector configuration with sending queue parameters 2025-01-21 15:20:50 +00:00
Simon Larsen
4674578c90 feat: update OTel Collector Dockerfile and configuration for gomplate integration 2025-01-21 15:10:44 +00:00
Simon Larsen
87d280edbd feat: use sudo for apt-get update in compile workflow 2025-01-21 13:26:03 +00:00
Simon Larsen
d44ddd6781 feat: extend hard delete retention period from 3 to 30 days in WorkflowLogService 2025-01-21 12:42:50 +00:00
Simon Larsen
7271481fb7 feat: add apt-get update step in compile workflow 2025-01-20 17:08:59 +00:00
Simon Larsen
7f05ae7415 feat: upgrade checkout action to v4 in GitHub workflows 2025-01-20 14:43:07 +00:00
Simon Larsen
1e84b3a0cb feat: upgrade Node.js setup action to v4 in GitHub workflows 2025-01-20 14:42:33 +00:00
Simon Larsen
20c7b11ecc feat: update Node.js version in GitHub workflows to latest 2025-01-20 14:42:06 +00:00
Simon Larsen
6666f6e817 Merge pull request #1807 from diabolocom/helm-clickhouse-update
Deps: Helm-chart: Update clickhouse chart v7.2.0
2025-01-20 14:23:34 +00:00
Simon Larsen
621e1ce207 feat: update Dockerfiles to replace libasound2t64 with libasound2 for playwright dependencies 2025-01-20 14:14:06 +00:00
Simon Larsen
1c42c58591 feat: update Dockerfiles to include libasound2t64 dependency for playwright 2025-01-20 14:09:41 +00:00
Jules Lefebvre
6a1b0d8718 deps(chart): update clickhouse chart
Update binami clickhouse helm chart to version 7.2.0 to support ipv6 by default
2025-01-20 15:07:28 +01:00
Simon Larsen
bc244bfde1 feat: rename notification rule type for clarity and update related migration 2025-01-20 13:55:56 +00:00
Simon Larsen
984cb41efc feat: update notification rule types to use ON_CALL_EXECUTED for incidents and alerts 2025-01-20 13:42:54 +00:00
Simon Larsen
076386f0d4 feat: update OnCallDutyPolicyExecutionLog and UserOnCallLog models to make Triggered By Incident and Alert IDs optional 2025-01-20 13:26:11 +00:00
Simon Larsen
cb11a46cc9 feat: enhance logging for on-call duty policy execution and improve user notification handling 2025-01-20 13:03:15 +00:00
Simon Larsen
6c7f1b5eb9 feat: update ExecutionLogsTable to display triggered by incident and alert details 2025-01-20 12:17:09 +00:00
Simon Larsen
95709f1996 feat: add support for displaying alerts in execution logs table 2025-01-20 12:12:31 +00:00
Simon Larsen
eaebcc748d fix: add missing newline for improved code readability in Alive job 2025-01-20 11:52:23 +00:00
Simon Larsen
13c2f6e73d feat: implement probe alive endpoint and enhance state change notification with project ID 2025-01-20 11:49:46 +00:00
Simon Larsen
f746d353a7 refactor: remove unnecessary whitespace and improve code formatting in Alert services and components 2025-01-20 11:08:23 +00:00
Simon Larsen
de1760bda7 feat: update alert services and components to support private notes and improve description handling 2025-01-20 10:56:54 +00:00
Simon Larsen
a28b870c23 feat: mark report fields as required for improved form validation 2025-01-20 09:58:03 +00:00
Simon Larsen
eb216e52cf feat: enhance alert notifications by integrating AlertFeedService for state change and note posting events 2025-01-17 21:50:31 +00:00
Simon Larsen
c19913ac58 refactor: clean up code formatting and improve readability in Alert components 2025-01-17 20:42:10 +00:00
Simon Larsen
b55bb4ceeb feat: simplify alert state management by consolidating ChangeAlertState usage and adding AlertFeedElement 2025-01-17 20:39:43 +00:00
Simon Larsen
26ec1aa5b2 feat: implement Alert Feed component with event handling and data fetching 2025-01-17 20:37:13 +00:00
Simon Larsen
7b733c32e9 feat: remove unused CardModelDetail components for Alert Description, Root Cause, and Remediation Notes 2025-01-17 20:27:34 +00:00
Simon Larsen
3d34118f9e feat: add new pages for Alert Description, Root Cause, and Remediation with routing and breadcrumbs 2025-01-17 20:26:49 +00:00
Simon Larsen
69a3a898f5 refactor: improve code formatting and readability in UserSettings components 2025-01-17 19:56:07 +00:00
Simon Larsen
74d21e7c33 feat: update alert and incident on-call rule titles to include severity information and change side menu icon 2025-01-17 19:53:55 +00:00
Simon Larsen
aecf1c38a6 feat: rename and add routes for Incident and Alert On-Call Rules in user settings 2025-01-17 19:47:02 +00:00
Simon Larsen
8b3041301a refactor: clean up whitespace and improve code readability in various models and services 2025-01-17 19:24:48 +00:00
Simon Larsen
af77d191e3 feat: update triggeredByIncidentId and triggeredByAlertId fields to be nullable in relevant models 2025-01-17 19:23:09 +00:00
Simon Larsen
ad58125663 feat: add alert severity handling and triggeredByAlertId support in notification and execution logs 2025-01-17 19:09:22 +00:00
Simon Larsen
63650ba791 feat: add support for triggeredByAlertId in OnCallDutyPolicyExecutionLogTimeline and related services 2025-01-17 18:42:20 +00:00
Simon Larsen
1c5a434ee3 feat: add triggeredByAlertId relation to OnCallDutyPolicyExecutionLogTimeline, UserOnCallLog, and UserOnCallLogTimeline 2025-01-17 15:58:27 +00:00
Simon Larsen
102e64224f fix: remove unnecessary whitespace and improve error logging in alert, billing, incident, and scheduled maintenance feed services 2025-01-17 15:41:07 +00:00
Simon Larsen
854fe3084a fix: refactor alert, incident, and scheduled maintenance feed services to improve error handling and logging 2025-01-17 15:39:51 +00:00
Simon Larsen
b6c6186625 fix: remove unnecessary trace logging in BillingService when changing plan 2025-01-17 15:18:23 +00:00
Simon Larsen
92bdd5cf03 fix: improve clarity of reminder notification message for scheduled maintenance events 2025-01-17 15:14:02 +00:00
Simon Larsen
c2e78d122a fix: update property name from 'id' to '_id' in incident and scheduled maintenance note services 2025-01-17 15:10:20 +00:00
Simon Larsen
bfc061ad47 feat: add isRoot property to props in incident and scheduled maintenance note services 2025-01-17 15:08:21 +00:00
Simon Larsen
98302a887a fix: correct spelling of "scheduled maintenance" in markdown logs and notifications 2025-01-17 15:01:44 +00:00
Simon Larsen
743db411d5 refactor: add type annotations for subscription status checks in BillingInvoiceService and ProjectUtil 2025-01-17 13:30:57 +00:00
Simon Larsen
9537a9a13a feat: implement subscription status refresh logic with mutex handling and logging enhancements 2025-01-17 13:17:44 +00:00
Simon Larsen
0931705d6a feat: implement subscription status refresh logic in BillingInvoiceService and UserAPI 2025-01-17 12:23:01 +00:00
Simon Larsen
6bfd9b657a refactor: improve logging formatting in SendSubscriberRemindersOnEventScheduled job 2025-01-16 22:53:17 +00:00
Simon Larsen
493aef5b05 feat: enhance subscriber notification system with reminder notifications and improved logging 2025-01-16 21:21:49 +00:00
Simon Larsen
185f70e893 refactor: clean up code formatting and improve readability in Scheduled Maintenance components 2025-01-16 21:06:26 +00:00
Simon Larsen
db2ecde486 feat: add notification logging for scheduled maintenance note postings 2025-01-16 20:45:16 +00:00
Simon Larsen
ff3b7edec8 feat: enhance Scheduled Maintenance feed with subscriber and owner notification events 2025-01-16 20:42:09 +00:00
Simon Larsen
968b050d13 feat: implement onUpdateSuccess for internal and public notes in scheduled maintenance services 2025-01-16 20:07:52 +00:00
Simon Larsen
4328f7fc40 feat: add Scheduled Maintenance Description page and update routing 2025-01-16 16:55:26 +00:00
Simon Larsen
6ae3c28b8b feat: update ScheduledMaintenanceFeed event types and integrate ScheduledMaintenanceFeedElement in view 2025-01-16 16:25:33 +00:00
Simon Larsen
8be022e34f refactor: clean up state initialization and formatting in IncidentFeed component 2025-01-16 13:27:31 +00:00
Simon Larsen
ce6938396a feat: add modals for creating public and private incident notes 2025-01-16 13:25:32 +00:00
Simon Larsen
537e2d02e7 feat: enhance incident update permissions and enable root cause editing 2025-01-16 13:07:27 +00:00
Simon Larsen
80b9e48771 fix: remove space before incident number in IncidentsTable and IncidentView components 2025-01-16 12:57:49 +00:00
Simon Larsen
e0c3437c45 feat: implement otel-collector deployment with configurable replica count 2025-01-16 12:54:43 +00:00
Simon Larsen
e5df15a53e test: update expected value for ColumnLength.Color to reflect changes 2025-01-15 21:09:53 +00:00
Simon Larsen
a0f6e979b8 refactor: enhance readability by restructuring Feed and FeedItem components 2025-01-15 20:36:18 +00:00
Simon Larsen
e20624a635 refactor: invert isLastItem condition for rendering FeedItem separator 2025-01-15 20:29:16 +00:00
Simon Larsen
800583ddde refactor: enforce isLastItem prop as required in FeedItem component 2025-01-15 20:29:02 +00:00
Simon Larsen
f0bc71bee4 refactor: improve code readability and structure in OnCallDutyPolicyExecutionLog services and Feed components 2025-01-15 20:26:30 +00:00
Simon Larsen
ba0dd4f2b0 refactor: add display color handling by OnCallDutyPolicy status and update notification displayColor logic 2025-01-15 20:23:11 +00:00
Simon Larsen
63b560ad93 refactor: improve markdown formatting in notifications and update query id handling 2025-01-15 20:20:36 +00:00
Simon Larsen
ae0553a1e5 refactor: update IncidentFeed and OnCallDutyPolicyExecutionLogTimeline services for improved type handling and logging 2025-01-15 19:48:00 +00:00
Simon Larsen
fd4e2737e5 refactor: enhance notification messages to include incident state details and public note content 2025-01-15 19:23:57 +00:00
Simon Larsen
15f18c6d4f refactor: enhance notification messages and add projectId to relevant data structures 2025-01-15 18:52:35 +00:00
Simon Larsen
a84e32fe1b refactor: enhance logging and improve incident feed notification messages across multiple services 2025-01-15 18:37:18 +00:00
Simon Larsen
c09d97310f refactor: update ProgressButtons and ChangeIncidentState components to support completedStepId and improve click handling 2025-01-15 17:35:33 +00:00
Simon Larsen
782eb45eb3 refactor: improve formatting and consistency in multiple components 2025-01-14 21:20:21 +00:00
Simon Larsen
fb37da0aca refactor: update ErrorMessage component to use 'message' prop instead of 'error' across multiple components 2025-01-14 21:16:17 +00:00
Simon Larsen
ae2608e66f refactor: update ErrorMessage component usage to use 'message' prop instead of 'error' across multiple files 2025-01-14 21:01:40 +00:00
Simon Larsen
29565bc24c refactor: clean up unnecessary whitespace and improve code formatting across multiple files 2025-01-14 19:35:54 +00:00
Simon Larsen
da7860fc3f feat: add new incident view pages for Root Cause and Description; update icon properties and breadcrumb links 2025-01-14 19:35:39 +00:00
Simon Larsen
0375e8c568 refactor: improve code formatting in ProgressButtonItem and IncidentFeed components for better readability 2025-01-14 19:22:09 +00:00
Simon Larsen
60c53b32e6 refactor: update ProgressButtonItem and ProgressButtons components for improved structure and readability; enhance error handling in IncidentFeed 2025-01-14 19:21:59 +00:00
Simon Larsen
4d1797e9fa refactor: clean up code formatting and remove unnecessary whitespace in various files 2025-01-14 18:16:51 +00:00
Simon Larsen
1ff4bde7b9 feat: enhance incident feed markdown for OnCallDutyPolicyExecutionLogTimeline with detailed alert information 2025-01-14 18:13:40 +00:00
Simon Larsen
fae6d89a18 feat: add OnCallNotification event type to IncidentFeed and implement related handling in OnCallDutyPolicyExecutionLogTimelineService 2025-01-14 18:09:30 +00:00
Simon Larsen
aa429abe01 feat: implement ProgressButtons and ProgressButtonItem components for enhanced step navigation 2025-01-14 16:01:56 +00:00
Simon Larsen
203763aa95 feat: add OnCallPolicy event type to IncidentFeed and implement related feed updates in OnCallDutyPolicyExecutionLogService 2025-01-14 15:38:05 +00:00
Simon Larsen
0b69ae195f feat: implement onBeforeDelete and onDeleteSuccess methods to handle OwnerTeamRemoved events in IncidentOwnerTeamService 2025-01-14 14:47:28 +00:00
Simon Larsen
0756a43d62 feat: add OwnerUserRemoved and OwnerTeamRemoved event types to IncidentFeed; update feedInfoInMarkdown and improve icon handling 2025-01-14 14:45:32 +00:00
Simon Larsen
13eb3205a2 feat: add RootCause and RemediationNotes event types to IncidentFeed; update feedInfoInMarkdown formatting and icons 2025-01-14 14:12:51 +00:00
Simon Larsen
9dcd295fd0 feat: update incident feed event types for owner additions and enhance related services 2025-01-14 13:59:24 +00:00
Simon Larsen
1fb84ea302 fix: update incidentId references and improve notification messages for clarity 2025-01-14 13:43:31 +00:00
Simon Larsen
53ea3d32dc feat: update incident feed colors and improve notification messages; add refresh button to IncidentFeedElement 2025-01-14 12:36:52 +00:00
Simon Larsen
5c9ec28a4e fix: format feedInfoInMarkdown for better readability in IncidentService 2025-01-14 12:26:30 +00:00
Simon Larsen
04c2293378 feat: add postedAt field to IncidentFeed, AlertFeed, and ScheduledMaintenanceFeed; update services to set postedAt on creation 2025-01-14 12:15:49 +00:00
Simon Larsen
6c672c541a feat: include createdByUserId in IncidentFeed creation for better tracking of incident authors 2025-01-14 11:04:21 +00:00
Simon Larsen
169db73704 fix: remove margin from no items message in Feed component for better layout 2025-01-14 11:01:10 +00:00
Simon Larsen
e980f00f1c feat: add noItemsMessage prop to Feed component and update IncidentFeedElement to display error message when no items are present 2025-01-14 11:00:07 +00:00
Simon Larsen
66a594ed99 feat: replace Feed component with IncidentFeedElement in IncidentView 2025-01-14 10:19:43 +00:00
Simon Larsen
52c35c1e4d feat: update userId handling in IncidentFeed and AlertFeed services; increase LIMIT_PER_PROJECT to 10000; refactor User class to UserUtil; add IncidentFeedElement component 2025-01-13 18:39:06 +00:00
Simon Larsen
caa4103b48 feat: add userId field to AlertFeed, IncidentFeed, and ScheduledMaintenanceFeed services 2025-01-13 17:28:44 +00:00
Simon Larsen
f6069ca4a7 feat: remove tls.verify option from Fluent Bit configuration 2025-01-13 17:22:48 +00:00
Simon Larsen
f519748c44 feat: add userId field and relationship to AlertFeed, IncidentFeed, and ScheduledMaintenanceFeed models 2025-01-13 17:19:37 +00:00
Simon Larsen
27de0f0ddb feat: update displayColor column length to 10 for AlertFeed, IncidentFeed, and ScheduledMaintenanceFeed 2025-01-13 17:14:36 +00:00
Simon Larsen
5426c22740 feat: update moreInformationInMarkdown fields to be optional in IncidentFeed, AlertFeed, and ScheduledMaintenanceFeed 2025-01-13 17:00:46 +00:00
Simon Larsen
a55d4d1e02 refactor: format migration name and clean up up/down methods for consistency 2025-01-13 16:20:51 +00:00
Simon Larsen
2f65b1ee82 feat: add migration to drop IncidentLog, AlertLog, and ScheduledMaintenanceLog tables 2025-01-13 15:04:00 +00:00
Simon Larsen
730dc56316 feat: add migration for IncidentFeed, AlertFeed, and ScheduledMaintenanceFeed tables 2025-01-13 14:59:13 +00:00
Simon Larsen
101e697a12 refactor: update BaseAPI instantiation for ScheduledMaintenanceFeed to improve type clarity 2025-01-13 14:56:18 +00:00
Simon Larsen
1c1488bca5 refactor: replace IncidentLogService with IncidentFeedService in various services 2025-01-13 14:52:55 +00:00
Simon Larsen
0e74adbd08 refactor: simplify FeedItem component and clean up IncidentView layout 2025-01-13 14:11:04 +00:00
Simon Larsen
35947b4010 fix: remove redundant empty line in IncidentView component 2025-01-13 13:27:06 +00:00
Simon Larsen
b304ceddbb feat: add Incident Feed component to display incident updates 2025-01-13 11:25:52 +00:00
Simon Larsen
cba6c48673 fix: update API request method from GET to POST in public-api documentation 2025-01-13 11:12:04 +00:00
Simon Larsen
63b40cde75 fix: update titles for subscription fields in EmailSubscribers component 2025-01-13 10:54:26 +00:00
Simon Larsen
439f2e87a2 feat: add subscription confirmation field to EmailSubscribers component 2025-01-13 10:53:18 +00:00
Simon Larsen
fc0869d9fe fix: correct query merging order in BaseModelTable component 2025-01-13 10:50:50 +00:00
Simon Larsen
fb5646e8c2 feat: update incident log event type and add logging for subscriber notifications in Incident services 2025-01-13 10:37:45 +00:00
Simon Larsen
7538a47be5 fix: update userName type to string and ensure proper string conversion in IncidentNote services 2025-01-13 08:50:31 +00:00
Simon Larsen
8568cc0c89 feat: implement logging for internal and public notes creation in IncidentNote services 2025-01-13 08:48:58 +00:00
Simon Larsen
2457de9757 feat: update IncidentLog and AlertLog models to use displayColor and event type enums 2025-01-12 18:21:08 +00:00
Simon Larsen
a6859631ae feat: add validation for required fields in AlertLogService, IncidentLogService, and ScheduledMaintenanceLogService 2025-01-12 17:50:45 +00:00
Simon Larsen
e737444c52 feat: add severity fields to AlertLog, IncidentLog, and ScheduledMaintenanceLog models 2025-01-12 17:40:25 +00:00
Simon Larsen
b4a2726c81 refactor: improve code formatting and readability in BaseAPI and IncidentView 2025-01-12 14:57:17 +00:00
Simon Larsen
5fc60491ff feat: reorder fields in IncidentView to improve layout and visibility of Incident ID 2025-01-12 14:53:12 +00:00
Simon Larsen
a7558535a6 feat: add IncidentLogService, AlertLogService, and ScheduledMaintenanceLogService to BaseAPI 2025-01-12 13:28:36 +00:00
Simon Larsen
408d06edb9 feat: add AlertLogService, IncidentLogService, and ScheduledMaintenanceLogService; update services index 2025-01-12 12:02:25 +00:00
Simon Larsen
87be913388 feat: enhance filtering logic to support numeric values in BaseModelTable 2025-01-12 11:52:33 +00:00
Simon Larsen
1a034abe96 feat: add NumberFilter component and integrate it into FiltersForm 2025-01-12 11:45:02 +00:00
Simon Larsen
19bdfd66b9 docs: update public API documentation to include overallStatus object details 2025-01-12 10:36:46 +00:00
Simon Larsen
982d051329 feat: implement mutex for incident creation and improve incident number handling 2025-01-12 10:35:04 +00:00
Simon Larsen
b66b1db2cb feat: add Incident Number column to IncidentsTable and IncidentView components 2025-01-12 10:19:38 +00:00
Simon Larsen
12e67a065d feat: add incidentNumber field to Incident model and implement data migration for existing incidents 2025-01-12 10:08:48 +00:00
Simon Larsen
1f3cdc08ac feat: add incidentNumber field to Incident model and implement logic for auto-incrementing incident numbers 2025-01-12 10:03:28 +00:00
Simon Larsen
5ebcba9f46 refactor: improve code readability in StatusPageAPI and Overview components 2025-01-10 14:44:31 +00:00
Simon Larsen
15e49c1b45 feat: implement overall monitor status calculation and update Overview component 2025-01-10 14:40:42 +00:00
Simon Larsen
b71a657dea feat: update API documentation to reflect POST method for status page endpoints 2025-01-09 18:38:38 +00:00
Simon Larsen
72e573bbc4 Merge branch 'release' 2025-01-09 14:32:47 +00:00
Simon Larsen
2113ffefd9 feat: refactor ScheduledMaintenanceLog model and migration for improved readability and structure 2025-01-09 14:32:43 +00:00
Simon Larsen
8da42884c2 feat: add documentation for using Monitor Secrets in custom and synthetic monitors 2025-01-09 14:30:24 +00:00
Simon Larsen
e14c54c6cc Merge branch 'release' 2025-01-08 19:48:16 +00:00
Simon Larsen
10a199f3f5 feat: add IncidentLog and ScheduledMaintenanceLog tables with migrations 2025-01-08 19:47:50 +00:00
Simon Larsen
2df97392b2 feat: enhance server monitor queries by integrating active project status checks 2025-01-08 18:54:06 +00:00
Simon Larsen
fcd2ecd118 feat: improve server monitor request handling by refining query and response logic 2025-01-08 18:41:41 +00:00
Simon Larsen
e2e5533229 Merge branch 'release' 2025-01-08 17:43:00 +00:00
Simon Larsen
cf01fce011 feat: add uninstall instructions for OneUptime in documentation 2025-01-08 17:18:51 +00:00
Simon Larsen
100152ecc1 feat: update API endpoint URLs in Public Status Page documentation 2025-01-08 17:12:45 +00:00
Simon Larsen
7b68c0b3c0 feat: refactor permission handling by extracting getFieldPermissions function 2025-01-07 18:59:34 +00:00
Simon Larsen
a7ad9b752b feat: fix Clickhouse configuration to use default port if not specified 2025-01-06 20:10:59 +00:00
496 changed files with 25416 additions and 3356 deletions

View File

@@ -16,7 +16,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -31,7 +31,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -46,7 +46,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -61,7 +61,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -76,7 +76,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -91,7 +91,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -106,7 +106,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -122,7 +122,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -137,7 +137,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -154,7 +154,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -169,7 +169,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -185,7 +185,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -200,7 +200,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -215,7 +215,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -231,7 +231,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -246,7 +246,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -261,7 +261,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -276,7 +276,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -291,7 +291,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -306,7 +306,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
@@ -321,7 +321,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun

View File

@@ -14,7 +14,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
@@ -28,7 +28,7 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: sudo apt-get update
- run: sudo apt-get install -y curl gcc
- run: sudo apt-get install -y build-essential

View File

@@ -15,10 +15,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Accounts && npm install && npm run compile && npm run dep-check
@@ -27,10 +27,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd IsolatedVM && npm install && npm run compile && npm run dep-check
@@ -39,10 +39,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install && npm run compile && npm run dep-check
compile-app:
@@ -50,10 +50,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd App && npm install && npm run compile && npm run dep-check
@@ -62,10 +62,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Home && npm install && npm run compile && npm run dep-check
@@ -74,10 +74,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Worker && npm install && npm run compile && npm run dep-check
@@ -86,10 +86,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Workflow && npm install && npm run compile && npm run dep-check
@@ -98,10 +98,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd APIReference && npm install && npm run compile && npm run dep-check
@@ -110,10 +110,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Docs && npm install && npm run compile && npm run dep-check
@@ -122,10 +122,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Copilot && npm install && npm run compile && npm run dep-check
@@ -134,10 +134,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Nginx && npm install && npm run compile && npm run dep-check
@@ -158,10 +158,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd AdminDashboard && npm install && npm run compile && npm run dep-check
@@ -171,10 +171,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Dashboard && npm install && npm run compile && npm run dep-check
@@ -185,10 +185,11 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: sudo apt-get update
- run: cd Common && npm install
- run: cd E2E && npm install && npm run compile && npm run dep-check
@@ -197,10 +198,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Probe && npm install && npm run compile && npm run dep-check
@@ -209,10 +210,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd ProbeIngest && npm install && npm run compile && npm run dep-check
@@ -221,10 +222,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd OpenTelemetryIngest && npm install && npm run compile && npm run dep-check
@@ -234,10 +235,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd IncomingRequestIngest && npm install && npm run compile && npm run dep-check
@@ -246,10 +247,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd FluentIngest && npm install && npm run compile && npm run dep-check
@@ -259,10 +260,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd StatusPage && npm install && npm run compile && npm run dep-check
@@ -272,9 +273,9 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd TestServer && npm install && npm run compile && npm run dep-check

View File

@@ -87,9 +87,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -147,9 +147,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -207,9 +207,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -267,9 +267,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -330,9 +330,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -390,9 +390,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -452,9 +452,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -512,9 +512,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -572,9 +572,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -632,9 +632,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -693,9 +693,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -753,9 +753,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -813,9 +813,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -874,9 +874,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -934,9 +934,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -995,9 +995,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1055,9 +1055,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1116,9 +1116,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1176,9 +1176,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1227,7 +1227,7 @@ jobs:
PACKAGE_VERSION: 7.0.${{needs.generate-build-number.outputs.build_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Preinstall
run: npm run prerun
- name: Publish NPM Packages
@@ -1271,9 +1271,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
# - name: Setup Git LFS
# run: git lfs install
@@ -1342,9 +1342,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1409,9 +1409,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1476,9 +1476,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1544,9 +1544,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1607,10 +1607,10 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: npm run prerun && bash ./Tests/Scripts/enable-billing-env-var.sh
- name: Start Server with release tag
run: npm run start
@@ -1660,10 +1660,10 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: npm run prerun
- name: Start Server with release tag
run: npm run start

View File

@@ -1,5 +1,9 @@
name: Push Test Images to Docker Hub and GitHub Container Registry
concurrency:
group: test-release
cancel-in-progress: true
on:
push:
branches:
@@ -56,9 +60,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
# - name: Setup Git LFS
# run: git lfs install
@@ -126,9 +130,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -188,9 +192,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -249,9 +253,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -310,9 +314,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -371,9 +375,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -432,9 +436,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -495,9 +499,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -558,9 +562,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -619,9 +623,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -680,9 +684,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -741,9 +745,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -802,9 +806,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -863,9 +867,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -924,9 +928,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -985,9 +989,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1046,9 +1050,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1107,9 +1111,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1171,9 +1175,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1234,9 +1238,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1295,9 +1299,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1356,9 +1360,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1418,9 +1422,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1480,9 +1484,9 @@ jobs:
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -1526,14 +1530,14 @@ jobs:
test-helm-chart:
runs-on: ubuntu-latest
needs: [llm-docker-image-deploy, open-telemetry-ingest-docker-image-deploy, copilot-docker-image-deploy, docs-docker-image-deploy, worker-docker-image-deploy, workflow-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, api-reference-docker-image-deploy, test-server-docker-image-deploy, test-docker-image-deploy, probe-ingest-docker-image-deploy, probe-docker-image-deploy, haraka-docker-image-deploy, dashboard-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, accounts-docker-image-deploy, otel-collector-docker-image-deploy, status-page-docker-image-deploy, nginx-docker-image-deploy, e2e-docker-image-deploy, fluent-ingest-docker-image-deploy, incoming-request-ingest-docker-image-deploy]
needs: [infrastructure-agent-deploy, llm-docker-image-deploy, open-telemetry-ingest-docker-image-deploy, copilot-docker-image-deploy, docs-docker-image-deploy, worker-docker-image-deploy, workflow-docker-image-deploy, isolated-vm-docker-image-deploy, home-docker-image-deploy, api-reference-docker-image-deploy, test-server-docker-image-deploy, test-docker-image-deploy, probe-ingest-docker-image-deploy, probe-docker-image-deploy, haraka-docker-image-deploy, dashboard-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, accounts-docker-image-deploy, otel-collector-docker-image-deploy, status-page-docker-image-deploy, nginx-docker-image-deploy, e2e-docker-image-deploy, fluent-ingest-docker-image-deploy, incoming-request-ingest-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd HelmChart && cd Tests && bash index.sh
test-e2e-test-saas:
@@ -1555,10 +1559,10 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: npm run prerun && bash ./Tests/Scripts/change-release-to-test-tag.sh
- name: Start Server with release tag
run: npm run start
@@ -1608,10 +1612,10 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: npm run prerun && bash ./Tests/Scripts/change-release-to-test-tag.sh
- name: Start Server with release tag
run: npm run start

View File

@@ -14,10 +14,10 @@ jobs:
CI_PIPELINE_ID: ${{github.run_number}}
BILLING_PRIVATE_KEY: ${{secrets.TEST_BILLING_PRIVATE_KEY}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && bash test-setup.sh
- run: cd Common && npm install && rm -rf build && npm run test

View File

@@ -1,58 +0,0 @@
name: E2E Tests
on:
pull_request:
push:
branches-ignore:
- 'hotfix-*' # excludes hotfix branches
- 'release'
jobs:
test:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: npm run prerun && bash ./Tests/Scripts/enable-billing-env-var.sh
- run: npm run dev
- name: Wait for server to start
run: bash ./Tests/Scripts/status-check.sh http://localhost
- name: Run E2E Tests. Run docker container e2e in docker compose file
run: export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker compose -f docker-compose.dev.yml logs e2e && exit 1)
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this on failure
if: failure()
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: test-results
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
./E2E
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 7

View File

@@ -13,8 +13,8 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd FluentIngest && npm install && npm run test

View File

@@ -13,9 +13,9 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd IncomingRequestIngest && npm install && npm run test

View File

@@ -13,9 +13,9 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd OpenTelemetryIngest && npm install && npm run test

View File

@@ -13,9 +13,9 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd ProbeIngest && npm install && npm run test

View File

@@ -13,10 +13,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Common && npm install
- run: cd Probe && npm install
- run: cd Probe && npm run test

View File

@@ -13,10 +13,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd App && npm install && npm run test
test-home:
@@ -24,10 +24,10 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Home && npm install && npm run test
test-worker:
@@ -35,8 +35,8 @@ jobs:
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.3.0
node-version: latest
- run: cd Worker && npm install && npm run test

22
.vscode/launch.json vendored
View File

@@ -93,7 +93,7 @@
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/Worker",
"localRoot": "${workspaceFolder}/Workflow",
"name": "Workflow: Debug with Docker",
"port": 8735,
"remoteRoot": "/usr/src/app",
@@ -107,7 +107,7 @@
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/Worker",
"localRoot": "${workspaceFolder}/Docs",
"name": "Docs: Debug with Docker",
"port": 8738,
"remoteRoot": "/usr/src/app",
@@ -121,7 +121,7 @@
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/Worker",
"localRoot": "${workspaceFolder}/APIReference",
"name": "API Reference: Debug with Docker",
"port": 8737,
"remoteRoot": "/usr/src/app",
@@ -151,7 +151,7 @@
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/Probe",
"name": "Probe: Debug with Docker",
"port": 9655,
"port": 9229,
"remoteRoot": "/usr/src/app",
"request": "attach",
"skipFiles": [
@@ -259,20 +259,6 @@
"restart": true,
"autoAttachChildProcesses": true
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/Workers",
"name": "Workers: Debug with Docker",
"port": 9654,
"remoteRoot": "/usr/src/app",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"restart": true,
"autoAttachChildProcesses": true
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/StatusPage",

View File

@@ -12,14 +12,14 @@
</h2>
<script>
function showPermissions(id){
var permissionsblock = document.getElementById(id+"-permissions");
var viewPermissionsBtn = document.getElementById(id+"-view-permissions");
function showPermissions(id) {
var permissionsblock = document.getElementById(id + "-permissions");
var viewPermissionsBtn = document.getElementById(id + "-view-permissions");
if(permissionsblock.style.display === "none"){
if (permissionsblock.style.display === "none") {
permissionsblock.style.display = "block";
viewPermissionsBtn.innerHTML = "Hide Permissions";
}else{
} else {
permissionsblock.style.display = "none";
viewPermissionsBtn.innerHTML = "View Permissions";
}
@@ -48,11 +48,16 @@
<dt class="sr-only">Description</dt>
<dd class="w-full flex-none text-sm [&amp;>:first-child]:mt-0 [&amp;>:last-child]:mb-0">
<p>
<%= pageData.columns[Object.keys(pageData.columns)[i]].description -%> <a class="text-gray-500 hover:underline cursor-pointer text-xs" id="<%= Object.keys(pageData.columns)[i] -%>-view-permissions" onclick="showPermissions('<%= Object.keys(pageData.columns)[i] -%>')">View Permissions</a>
<%= pageData.columns[Object.keys(pageData.columns)[i]].description -%> <a
class="text-gray-500 hover:underline cursor-pointer text-xs"
id="<%= Object.keys(pageData.columns)[i] -%>-view-permissions"
onclick="showPermissions('<%= Object.keys(pageData.columns)[i] -%>')">View
Permissions</a>
</p>
</dd>
<dd class="font-mono text-xs" style="display: none;" id="<%= Object.keys(pageData.columns)[i] -%>-permissions">
<dd class="font-mono text-xs" style="display: none;"
id="<%= Object.keys(pageData.columns)[i] -%>-permissions">
<div class="mb-3 mt-3">
<span class="text-gray-700 text-xs">Permissions to Create:&nbsp;</span>
@@ -319,8 +324,7 @@
<div class="[&amp;>:first-child]:mt-0 [&amp;>:last-child]:mb-0 xl:sticky xl:top-24">
<%- include('../partials/code', {title: "Example Item Request" , requestUrl:
pageData.apiPath+"/3599ee69-43a7-42d7/get-item", code: pageData.itemRequest, requestType: "POST" })
-%>
pageData.apiPath+"/:id/get-item", code: pageData.itemRequest, requestType: "POST" }) -%>
<%- include('../partials/code', {title: "Example Item Response" , code: pageData.itemResponse,
requestType: "" }) -%>
</div>
@@ -469,11 +473,34 @@
</ul>
</div>
<div class="border border-gray-100 bg-gray-50 rounded-md p-4 text-sm mt-10">
<h4 class="font-semibold text-gray-700 ">For clients that do not support PUT requests<h4>
<p class="text-gray-500 text-xs mt-4">
You can also update an object by sending a POST or GET request to these endpoints with the
same
request headers and body.
</p>
<div class="flex items-center gap-x-3 mt-10"><span
class="font-mono text-[0.625rem] font-semibold leading-6 rounded-lg px-1.5 ring-1 ring-inset ring-sky-300 bg-sky-400/10 text-sky-500 ">POST</span><span
class="h-0.5 w-0.5 rounded-full bg-zinc-300 "></span><span
class="font-mono text-xs text-zinc-400">
<%= pageData.apiPath -%>/:id/update-item
</span></div>
<div class="flex items-center gap-x-3 mt-10"><span
class="font-mono text-[0.625rem] font-semibold leading-6 rounded-lg px-1.5 ring-1 ring-inset ring-emerald-300 bg-emerald-400/10 text-emerald-500 ">GET</span><span
class="h-0.5 w-0.5 rounded-full bg-zinc-300 "></span><span
class="font-mono text-xs text-zinc-400">
<%= pageData.apiPath -%>/:id/update-item
</span></div>
</div>
</div>
<div class="[&amp;>:first-child]:mt-0 [&amp;>:last-child]:mb-0 xl:sticky xl:top-24">
<%- include('../partials/code', {title: "Example Update Request" , requestUrl:
pageData.apiPath+"/3599ee69-43a7-42d7", code: pageData.updateRequest, requestType: "PUT" }) -%>
pageData.apiPath+"/:id", code: pageData.updateRequest, requestType: "PUT" }) -%>
<%- include('../partials/code', {title: "Example Update Response" , code: pageData.updateResponse,
requestType: "" }) -%>
</div>
@@ -498,11 +525,34 @@
<p>This endpoint allows you to delete object by its ID. </p>
<div class="border border-gray-100 bg-gray-50 rounded-md p-4 text-sm mt-10">
<h4 class="font-semibold text-gray-700 ">For clients that do not support DELETE requests<h4>
<p class="text-gray-500 text-xs mt-4">
You can also delete an object by sending a POST or GET request to these endpoints with the
same
request headers and body.
</p>
<div class="flex items-center gap-x-3 mt-10"><span
class="font-mono text-[0.625rem] font-semibold leading-6 rounded-lg px-1.5 ring-1 ring-inset ring-sky-300 bg-sky-400/10 text-sky-500 ">POST</span><span
class="h-0.5 w-0.5 rounded-full bg-zinc-300 "></span><span
class="font-mono text-xs text-zinc-400">
<%= pageData.apiPath -%>/:id/delete-item
</span></div>
<div class="flex items-center gap-x-3 mt-10"><span
class="font-mono text-[0.625rem] font-semibold leading-6 rounded-lg px-1.5 ring-1 ring-inset ring-emerald-300 bg-emerald-400/10 text-emerald-500 ">GET</span><span
class="h-0.5 w-0.5 rounded-full bg-zinc-300 "></span><span
class="font-mono text-xs text-zinc-400">
<%= pageData.apiPath -%>/:id/delete-item
</span></div>
</div>
</div>
<div class="[&amp;>:first-child]:mt-0 [&amp;>:last-child]:mb-0 xl:sticky xl:top-24">
<%- include('../partials/code', {title: "Example Delete Request" , requestUrl:
pageData.apiPath+"/3599ee69-43a7-42d7", code: pageData.deleteRequest, requestType: "DELETE" }) -%>
pageData.apiPath+"/:id", code: pageData.deleteRequest, requestType: "DELETE" }) -%>
<%- include('../partials/code', {title: "Example Delete Response" , code: pageData.deleteResponse,
requestType: "" }) -%>
</div>

View File

@@ -179,7 +179,7 @@ const RegisterPage: () => JSX.Element = () => {
]);
if (error) {
return <ErrorMessage error={error} />;
return <ErrorMessage message={error} />;
}
if (isLoading) {

View File

@@ -137,7 +137,7 @@ const DashboardProjectPicker: FunctionComponent<ComponentProps> = (
minLength: 6,
},
footerElement: getFooter(),
fieldType: FormFieldSchemaType.RadioButton,
fieldType: FormFieldSchemaType.OptionChooserButton,
radioButtonOptions: SubscriptionPlan.getSubscriptionPlans(
getAllEnvVars(),
).map((plan: SubscriptionPlan): RadioButton => {

View File

@@ -41,7 +41,7 @@ const Logout: FunctionComponent = (): ReactElement => {
]}
>
{!error ? <PageLoader isVisible={true} /> : <></>}
{error ? <ErrorMessage error={error} /> : <></>}
{error ? <ErrorMessage message={error} /> : <></>}
</Page>
);
};

View File

@@ -75,7 +75,7 @@ const Projects: FunctionComponent = (): ReactElement => {
minLength: 6,
},
footerElement: getFooter(),
fieldType: FormFieldSchemaType.RadioButton,
fieldType: FormFieldSchemaType.OptionChooserButton,
radioButtonOptions: SubscriptionPlan.getSubscriptionPlans(
getAllEnvVars(),
).map((plan: SubscriptionPlan): RadioButton => {

View File

@@ -61,7 +61,7 @@ const Settings: FunctionComponent = (): ReactElement => {
}
if (error) {
return <ErrorMessage error={error} />;
return <ErrorMessage message={error} />;
}
return (

View File

@@ -496,6 +496,45 @@ import ScheduledMaintenanceTemplateOwnerUserService, {
} from "Common/Server/Services/ScheduledMaintenanceTemplateOwnerUserService";
import TableView from "Common/Models/DatabaseModels/TableView";
import IncidentFeed from "Common/Models/DatabaseModels/IncidentFeed";
import AlertFeed from "Common/Models/DatabaseModels/AlertFeed";
import ScheduledMaintenanceFeed from "Common/Models/DatabaseModels/ScheduledMaintenanceFeed";
import IncidentFeedService, {
Service as IncidentFeedServiceType,
} from "Common/Server/Services/IncidentFeedService";
import AlertFeedService, {
Service as AlertFeedServiceType,
} from "Common/Server/Services/AlertFeedService";
import ScheduledMaintenanceFeedService, {
Service as ScheduledMaintenanceFeedServiceType,
} from "Common/Server/Services/ScheduledMaintenanceFeedService";
import SlackAPI from "Common/Server/API/SlackAPI";
import WorkspaceProjectAuthToken from "Common/Models/DatabaseModels/WorkspaceProjectAuthToken";
import WorkspaceProjectAuthTokenService, {
Service as WorkspaceProjectAuthTokenServiceType,
} from "Common/Server/Services/WorkspaceProjectAuthTokenService";
import WorkspaceUserAuthToken from "Common/Models/DatabaseModels/WorkspaceUserAuthToken";
import WorkspaceUserAuthTokenService, {
Service as WorkspaceUserAuthTokenServiceType,
} from "Common/Server/Services/WorkspaceUserAuthTokenService";
import WorkspaceSetting from "Common/Models/DatabaseModels/WorkspaceSetting";
import WorkspaceSettingService, {
Service as WorkspaceSettingServiceType,
} from "Common/Server/Services/WorkspaceSettingService";
import WorkspaceNotificationRule from "Common/Models/DatabaseModels/WorkspaceNotificationRule";
import WorkspaceNotificationRuleService, {
Service as WorkspaceNotificationRuleServiceType,
} from "Common/Server/Services/WorkspaceNotificationRuleService";
const BaseAPIFeatureSet: FeatureSet = {
init: async (): Promise<void> => {
const app: ExpressApplication = Express.getExpressApp();
@@ -518,6 +557,19 @@ const BaseAPIFeatureSet: FeatureSet = {
).getRouter(),
);
// notification rule
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<
WorkspaceNotificationRule,
WorkspaceNotificationRuleServiceType
>(
WorkspaceNotificationRule,
WorkspaceNotificationRuleService,
).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<MonitorTest, MonitorTestServiceType>(
@@ -526,6 +578,39 @@ const BaseAPIFeatureSet: FeatureSet = {
).getRouter(),
);
//service provider setting
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<WorkspaceSetting, WorkspaceSettingServiceType>(
WorkspaceSetting,
WorkspaceSettingService,
).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<IncidentFeed, IncidentFeedServiceType>(
IncidentFeed,
IncidentFeedService,
).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<AlertFeed, AlertFeedServiceType>(
AlertFeed,
AlertFeedService,
).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<
ScheduledMaintenanceFeed,
ScheduledMaintenanceFeedServiceType
>(ScheduledMaintenanceFeed, ScheduledMaintenanceFeedService).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<AlertNoteTemplate, AlertNoteTemplateServiceType>(
@@ -534,6 +619,26 @@ const BaseAPIFeatureSet: FeatureSet = {
).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<
WorkspaceProjectAuthToken,
WorkspaceProjectAuthTokenServiceType
>(
WorkspaceProjectAuthToken,
WorkspaceProjectAuthTokenService,
).getRouter(),
);
// user auth token
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<WorkspaceUserAuthToken, WorkspaceUserAuthTokenServiceType>(
WorkspaceUserAuthToken,
WorkspaceUserAuthTokenService,
).getRouter(),
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<Alert, AlertServiceType>(Alert, AlertService).getRouter(),
@@ -1328,6 +1433,7 @@ const BaseAPIFeatureSet: FeatureSet = {
`/${APP_NAME.toLocaleLowerCase()}`,
new ResellerPlanAPI().getRouter(),
);
app.use(`/${APP_NAME.toLocaleLowerCase()}`, new SlackAPI().getRouter());
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new GlobalConfigAPI().getRouter(),

View File

@@ -36,6 +36,7 @@ import ProjectSSO from "Common/Models/DatabaseModels/ProjectSso";
import TeamMember from "Common/Models/DatabaseModels/TeamMember";
import User from "Common/Models/DatabaseModels/User";
import xml2js from "xml2js";
import Name from "Common/Types/Name";
const router: ExpressRouter = Express.getRouter();
@@ -283,6 +284,7 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
let issuerUrl: string = "";
let email: Email | null = null;
let fullName: Name | null = null;
if (!req.params["projectId"]) {
return Response.sendErrorResponse(
@@ -372,6 +374,7 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
issuerUrl = SSOUtil.getIssuer(response);
email = SSOUtil.getEmail(response);
fullName = SSOUtil.getUserFullName(response);
} catch (err: unknown) {
if (err instanceof Exception) {
return Response.sendErrorResponse(req, res, err);
@@ -420,6 +423,7 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
alreadySavedUser = await UserService.createByEmail({
email,
name: fullName || undefined,
isEmailVerified: true,
generateRandomPassword: true,
props: {

View File

@@ -8,6 +8,7 @@ import logger from "Common/Server/Utils/Logger";
import xmlCrypto, { FileKeyInfo } from "xml-crypto";
import xmldom from "xmldom";
import zlib from "zlib";
import Name from "Common/Types/Name";
export default class SSOUtil {
public static createSAMLRequestUrl(data: {
@@ -138,6 +139,88 @@ export default class SSOUtil {
}
}
public static getUserFullName(payload: JSONObject): Name | null {
if (!payload["saml2p:Response"] && !payload["samlp:Response"]) {
return null;
}
payload =
(payload["saml2p:Response"] as JSONObject) ||
(payload["samlp:Response"] as JSONObject) ||
(payload["Response"] as JSONObject);
const samlAssertion: JSONArray =
(payload["saml2:Assertion"] as JSONArray) ||
(payload["saml:Assertion"] as JSONArray) ||
(payload["Assertion"] as JSONArray);
if (!samlAssertion || samlAssertion.length === 0) {
return null;
}
const samlAttributeStatement: JSONArray =
((samlAssertion[0] as JSONObject)[
"saml2:AttributeStatement"
] as JSONArray) ||
((samlAssertion[0] as JSONObject)[
"saml:AttributeStatement"
] as JSONArray) ||
((samlAssertion[0] as JSONObject)["AttributeStatement"] as JSONArray);
if (!samlAttributeStatement || samlAttributeStatement.length === 0) {
return null;
}
const samlAttribute: JSONArray =
((samlAttributeStatement[0] as JSONObject)[
"saml2:Attribute"
] as JSONArray) ||
((samlAttributeStatement[0] as JSONObject)[
"saml:Attribute"
] as JSONArray) ||
((samlAttributeStatement[0] as JSONObject)["Attribute"] as JSONArray);
if (!samlAttribute || samlAttribute.length === 0) {
return null;
}
// get displayName attribute.
// {
// "$": {
// "Name": "http://schemas.microsoft.com/identity/claims/displayname"
// },
// "AttributeValue": [
// "Nawaz Dhandala"
// ]
// },
for (let i: number = 0; i < samlAttribute.length; i++) {
const attribute: JSONObject = samlAttribute[i] as JSONObject;
if (
attribute["$"] &&
(attribute["$"] as JSONObject)["Name"]?.toString()
) {
const name: string | undefined = (attribute["$"] as JSONObject)[
"Name"
]?.toString();
if (
name &&
name === "http://schemas.microsoft.com/identity/claims/displayname" &&
attribute["AttributeValue"] &&
Array.isArray(attribute["AttributeValue"]) &&
attribute["AttributeValue"].length > 0
) {
const fullName: Name = new Name(
attribute["AttributeValue"][0]!.toString() as string,
);
return fullName;
}
}
}
return null;
}
public static getEmail(payload: JSONObject): Email {
if (!payload["saml2p:Response"] && !payload["samlp:Response"]) {
throw new BadRequestException("SAML Response not found.");

View File

@@ -39,7 +39,7 @@
{{> InfoBlock info="No resources have been added to this status page yet."}}
{{/ifCond}}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

View File

@@ -10,7 +10,7 @@
{{> DetailBoxField title="" text=announcementDescription }}
{{> DetailBoxEnd this }}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

View File

@@ -17,7 +17,7 @@
{{> DetailBoxEnd this }}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

View File

@@ -14,7 +14,7 @@
{{> DetailBoxEnd this }}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

View File

@@ -14,7 +14,7 @@
{{> DetailBoxField title="" text=incidentDescription }}
{{> DetailBoxEnd this }}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}
{{> InfoBlock info=statusPageUrl}}

View File

@@ -21,7 +21,7 @@
{{> DetailBoxEnd this }}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

View File

@@ -22,7 +22,7 @@
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

View File

@@ -19,7 +19,7 @@
{{> DetailBoxField title="" text=eventDescription }}
{{> DetailBoxEnd this }}
{{> InfoBlock info=(concat "This is an automated email sent to you because you are subscribed to " statusPageName) }}
{{> InfoBlock info=(concat subscriberEmailNotificationFooterText "") }}
{{> InfoBlock info="You can visit the status page here:"}}

1778
Clickhouse/config.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -36,6 +36,7 @@ import {
ManyToOne,
} from "typeorm";
import { TelemetryQuery } from "../../Types/Telemetry/TelemetryQuery";
import { WorkspaceChannel } from "../../Server/Utils/Workspace/WorkspaceBase";
@EnableDocumentation()
@AccessControlColumn("labels")
@@ -1006,4 +1007,51 @@ export default class Alert extends BaseModel {
nullable: true,
})
public telemetryQuery?: TelemetryQuery = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlert,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlert,
],
update: [],
})
@Index()
@TableColumn({
isDefaultValueColumn: false,
required: false,
type: TableColumnType.Number,
title: "Alert Number",
description: "Alert Number",
})
@Column({
type: ColumnType.Number,
nullable: true,
})
public alertNumber?: number = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
isDefaultValueColumn: false,
required: false,
type: TableColumnType.JSON,
title: "Post Updates To Workspace Channel Name",
description: "Post Updates To Workspace Channel Name",
})
@Column({
type: ColumnType.JSON,
nullable: true,
})
public postUpdatesToWorkspaceChannels?: Array<WorkspaceChannel> = undefined;
}

View File

@@ -0,0 +1,526 @@
import Alert from "./Alert";
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import ColumnLength from "../../Types/Database/ColumnLength";
import Color from "../../Types/Color";
export enum AlertFeedEventType {
PublicNote = "PublicNote",
SubscriberNotificationSent = "SubscriberNotificationSent",
OwnerNotificationSent = "OwnerNotificationSent",
OwnerUserAdded = "OwnerUserAdded",
OwnerTeamAdded = "OwnerTeamAdded",
AlertCreated = "AlertCreated",
AlertStateChanged = "AlertStateChanged",
PrivateNote = "PrivateNote",
AlertUpdated = "AlertUpdated",
RootCause = "RootCause",
RemediationNotes = "RemediationNotes",
OwnerUserRemoved = "OwnerUserRemoved",
OwnerTeamRemoved = "OwnerTeamRemoved",
OnCallPolicy = "OnCallPolicy",
OnCallNotification = "OnCallNotification",
}
@EnableDocumentation()
@CanAccessIfCanReadOn("alert")
@TenantColumn("projectId")
@TableAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
delete: [],
update: [],
})
@EnableWorkflow({
create: true,
delete: true,
update: true,
read: true,
})
@CrudApiEndpoint(new Route("/alert-feed"))
@Entity({
name: "AlertFeed",
})
@TableMetadata({
tableName: "AlertFeed",
singularName: "Alert Feed",
pluralName: "Alert Feeds",
icon: IconProp.List,
tableDescription:
"Log of the entire alert state change. This is a log of all the alert state changes, public notes, more etc.",
})
export default class AlertFeed extends BaseModel {
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "alertId",
type: TableColumnType.Entity,
modelType: Alert,
title: "Alert",
description: "Relation to Alert in which this resource belongs",
})
@ManyToOne(
() => {
return Alert;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "alertId" })
public alert?: Alert = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
title: "Alert ID",
description: "Relation to Alert ID in which this resource belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public alertId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Markdown,
required: true,
title: "Log (in Markdown)",
description: "Log of the entire alert state change in Markdown",
})
@Column({
type: ColumnType.Markdown,
nullable: false,
unique: false,
})
public feedInfoInMarkdown?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Markdown,
required: false,
title: "More Information (in Markdown)",
description: "More information in Markdown",
})
@Column({
type: ColumnType.Markdown,
nullable: true,
unique: false,
})
public moreInformationInMarkdown?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ShortText,
required: true,
title: "Alert Feed Event",
description: "Alert Feed Event",
})
@Column({
type: ColumnType.ShortText,
nullable: false,
unique: false,
})
public alertFeedEventType?: AlertFeedEventType = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Color,
required: true,
title: "Color",
description: "Display color for the alert log",
})
@Column({
type: ColumnType.Color,
length: ColumnLength.Color,
nullable: false,
unique: false,
transformer: Color.getDatabaseTransformer(),
})
public displayColor?: Color = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "userId",
type: TableColumnType.Entity,
modelType: User,
title: "User",
description:
"Relation to User who this feed belongs to (if this feed belongs to a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "userId" })
public user?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "User ID",
description:
"User who this feed belongs to (if this feed belongs to a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public userId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateAlertFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadAlertFeed,
],
update: [],
})
@TableColumn({
title: "Feed Posted At",
description: "Date and time when the feed was posted",
type: TableColumnType.Date,
})
@Column({
type: ColumnType.Date,
nullable: true,
unique: false,
})
public postedAt?: Date = undefined;
}

View File

@@ -37,6 +37,7 @@ import {
ManyToOne,
} from "typeorm";
import { TelemetryQuery } from "../../Types/Telemetry/TelemetryQuery";
import { WorkspaceChannel } from "../../Server/Utils/Workspace/WorkspaceBase";
@EnableDocumentation()
@AccessControlColumn("labels")
@@ -853,7 +854,12 @@ export default class Incident extends BaseModel {
Permission.ProjectMember,
Permission.ReadProjectIncident,
],
update: [],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.EditProjectIncident,
],
})
@TableColumn({
type: TableColumnType.Markdown,
@@ -1086,4 +1092,51 @@ export default class Incident extends BaseModel {
nullable: true,
})
public telemetryQuery?: TelemetryQuery = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateProjectIncident,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadProjectIncident,
],
update: [],
})
@Index()
@TableColumn({
isDefaultValueColumn: false,
required: false,
type: TableColumnType.Number,
title: "Incident Number",
description: "Incident Number",
})
@Column({
type: ColumnType.Number,
nullable: true,
})
public incidentNumber?: number = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
isDefaultValueColumn: false,
required: false,
type: TableColumnType.JSON,
title: "Post Updates To Workspace Channel Name",
description: "Post Updates To Workspace Channel Name",
})
@Column({
type: ColumnType.JSON,
nullable: true,
})
public postUpdatesToWorkspaceChannels?: Array<WorkspaceChannel> = undefined;
}

View File

@@ -0,0 +1,526 @@
import Incident from "./Incident";
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import Color from "../../Types/Color";
import ColumnLength from "../../Types/Database/ColumnLength";
export enum IncidentFeedEventType {
PublicNote = "PublicNote",
SubscriberNotificationSent = "SubscriberNotificationSent",
OwnerNotificationSent = "OwnerNotificationSent",
OwnerUserAdded = "OwnerUserAdded",
OwnerTeamAdded = "OwnerTeamAdded",
IncidentCreated = "IncidentCreated",
IncidentStateChanged = "IncidentStateChanged",
PrivateNote = "PrivateNote",
IncidentUpdated = "IncidentUpdated",
RootCause = "RootCause",
RemediationNotes = "RemediationNotes",
OwnerUserRemoved = "OwnerUserRemoved",
OwnerTeamRemoved = "OwnerTeamRemoved",
OnCallPolicy = "OnCallPolicy",
OnCallNotification = "OnCallNotification",
}
@EnableDocumentation()
@CanAccessIfCanReadOn("incident")
@TenantColumn("projectId")
@TableAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
delete: [],
update: [],
})
@EnableWorkflow({
create: true,
delete: true,
update: true,
read: true,
})
@CrudApiEndpoint(new Route("/incident-feed"))
@Entity({
name: "IncidentFeed",
})
@TableMetadata({
tableName: "IncidentFeed",
singularName: "Incident Feed",
pluralName: "Incident Feeds",
icon: IconProp.List,
tableDescription:
"Log of the entire incident state change. This is a log of all the incident state changes, public notes, more etc.",
})
export default class IncidentFeed extends BaseModel {
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "incidentId",
type: TableColumnType.Entity,
modelType: Incident,
title: "Incident",
description: "Relation to Incident in which this resource belongs",
})
@ManyToOne(
() => {
return Incident;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "incidentId" })
public incident?: Incident = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
title: "Incident ID",
description: "Relation to Incident ID in which this resource belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public incidentId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Markdown,
required: true,
title: "Log (in Markdown)",
description: "Log of the entire incident state change in Markdown",
})
@Column({
type: ColumnType.Markdown,
nullable: false,
unique: false,
})
public feedInfoInMarkdown?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Markdown,
required: false,
title: "More Information (in Markdown)",
description: "More information in Markdown",
})
@Column({
type: ColumnType.Markdown,
nullable: true,
unique: false,
})
public moreInformationInMarkdown?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ShortText,
required: true,
title: "Incident Feed Event",
description: "Incident Feed Event",
})
@Column({
type: ColumnType.ShortText,
nullable: false,
unique: false,
})
public incidentFeedEventType?: IncidentFeedEventType = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateIncidentFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadIncidentFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Color,
required: true,
title: "Color",
description: "Display color for the incident log",
})
@Column({
type: ColumnType.Color,
length: ColumnLength.Color,
nullable: false,
unique: false,
transformer: Color.getDatabaseTransformer(),
})
public displayColor?: Color = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "userId",
type: TableColumnType.Entity,
modelType: User,
title: "User",
description:
"Relation to User who this feed belongs to (if this feed belongs to a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "userId" })
public user?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "User ID",
description:
"User who this feed belongs to (if this feed belongs to a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public userId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
title: "Feed Posted At",
description: "Date and time when the feed was posted",
type: TableColumnType.Date,
})
@Column({
type: ColumnType.Date,
nullable: true,
unique: false,
})
public postedAt?: Date = undefined;
}

View File

@@ -20,6 +20,7 @@ import GreenlockCertificate from "./GreenlockCertificate";
import GreenlockChallenge from "./GreenlockChallenge";
// Incidents
import Incident from "./Incident";
import IncidentFeed from "./IncidentFeed";
import IncidentCustomField from "./IncidentCustomField";
import IncidentInternalNote from "./IncidentInternalNote";
import IncidentNoteTemplate from "./IncidentNoteTemplate";
@@ -142,6 +143,7 @@ import ScheduledMaintenanceTemplateOwnerTeam from "./ScheduledMaintenanceTemplat
import ScheduledMaintenanceTemplateOwnerUser from "./ScheduledMaintenanceTemplateOwnerUser";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import AlertState from "./AlertState";
import Alert from "./Alert";
import AlertCustomField from "./AlertCustomField";
@@ -151,15 +153,25 @@ import AlertOwnerTeam from "./AlertOwnerTeam";
import AlertOwnerUser from "./AlertOwnerUser";
import AlertSeverity from "./AlertSeverity";
import AlertNoteTemplate from "./AlertNoteTemplate";
import AlertFeed from "./AlertFeed";
import TableView from "./TableView";
import Dashboard from "./Dashboard";
import MonitorTest from "./MonitorTest";
import ScheduledMaintenanceFeed from "./ScheduledMaintenanceFeed";
import WorkspaceUserAuthToken from "./WorkspaceUserAuthToken";
import WorkspaceProjectAuthToken from "./WorkspaceProjectAuthToken";
import WorkspaceSetting from "./WorkspaceSetting";
import WorkspaceNotificationRule from "./WorkspaceNotificationRule";
const AllModelTypes: Array<{
new (): BaseModel;
}> = [
User,
WorkspaceUserAuthToken,
WorkspaceProjectAuthToken,
Probe,
Project,
EmailVerificationToken,
@@ -187,6 +199,7 @@ const AllModelTypes: Array<{
IncidentState,
Incident,
IncidentFeed,
IncidentCustomField,
IncidentStateTimeline,
IncidentInternalNote,
@@ -201,6 +214,7 @@ const AllModelTypes: Array<{
AlertState,
Alert,
AlertFeed,
AlertCustomField,
AlertStateTimeline,
AlertInternalNote,
@@ -232,6 +246,7 @@ const AllModelTypes: Array<{
ScheduledMaintenancePublicNote,
ScheduledMaintenanceInternalNote,
ScheduledMaintenanceCustomField,
ScheduledMaintenanceFeed,
BillingPaymentMethods,
BillingInvoice,
@@ -335,6 +350,9 @@ const AllModelTypes: Array<{
Dashboard,
MonitorTest,
WorkspaceSetting,
WorkspaceNotificationRule,
];
const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};

View File

@@ -442,6 +442,7 @@ export default class MonitorTest extends BaseModel {
})
public monitorStepProbeResponse?: MonitorStepProbeResponse = undefined;
@Index()
@ColumnAccessControl({
create: [
Permission.ProjectOwner,

View File

@@ -216,6 +216,7 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
@TableColumn({
type: TableColumnType.ObjectID,
title: "Triggered By Incident ID",
required: false,
description:
"ID of the incident which triggered this on-call escalation policy.",
})
@@ -270,6 +271,7 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
@TableColumn({
type: TableColumnType.ObjectID,
title: "Triggered By Alert ID",
required: false,
description:
"ID of the incident which triggered this on-call escalation policy.",
})

View File

@@ -26,6 +26,7 @@ import OnCallDutyExecutionLogTimelineStatus from "../../Types/OnCallDutyPolicy/O
import Permission from "../../Types/Permission";
import UserNotificationEventType from "../../Types/UserNotification/UserNotificationEventType";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import Alert from "./Alert";
@TableBillingAccessControl({
create: PlanType.Growth,
@@ -216,18 +217,74 @@ export default class OnCallDutyPolicyExecutionLogTimeline extends BaseModel {
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
required: false,
canReadOnRelationQuery: true,
title: "Incident ID",
description: "ID of your OneUptime Incident in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public triggeredByIncidentId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadProjectOnCallDutyPolicyExecutionLogTimeline,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "triggeredByAlertId",
type: TableColumnType.Entity,
modelType: Alert,
title: "Alert",
description: "Relation to Alert Resource in which this object belongs",
})
@ManyToOne(
() => {
return Alert;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "triggeredByAlertId" })
public triggeredByAlert?: Alert = undefined;
@ColumnAccessControl({
create: [],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadProjectOnCallDutyPolicyExecutionLogTimeline,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: false,
canReadOnRelationQuery: true,
title: "Alert ID",
description: "ID of your OneUptime Alert in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public triggeredByAlertId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [

View File

@@ -35,6 +35,7 @@ import {
ManyToOne,
} from "typeorm";
import Recurring from "../../Types/Events/Recurring";
import { WorkspaceChannel } from "../../Server/Utils/Workspace/WorkspaceBase";
@EnableDocumentation()
@AccessControlColumn("labels")
@@ -950,4 +951,51 @@ export default class ScheduledMaintenance extends BaseModel {
nullable: true,
})
public nextSubscriberNotificationBeforeTheEventAt?: Date = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateProjectScheduledMaintenance,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadProjectScheduledMaintenance,
],
update: [],
})
@Index()
@TableColumn({
isDefaultValueColumn: false,
required: false,
type: TableColumnType.Number,
title: "Scheduled Maintenance Number",
description: "Scheduled Maintenance Number",
})
@Column({
type: ColumnType.Number,
nullable: true,
})
public scheduledMaintenanceNumber?: number = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
isDefaultValueColumn: false,
required: false,
type: TableColumnType.JSON,
title: "Post Updates To Workspace Channel Name",
description: "Post Updates To Workspace Channel Name",
})
@Column({
type: ColumnType.JSON,
nullable: true,
})
public postUpdatesToWorkspaceChannels?: Array<WorkspaceChannel> = undefined;
}

View File

@@ -0,0 +1,530 @@
import ScheduledMaintenance from "./ScheduledMaintenance";
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import ColumnLength from "../../Types/Database/ColumnLength";
import Color from "../../Types/Color";
export enum ScheduledMaintenanceFeedEventType {
PublicNote = "PublicNote",
SubscriberNotificationSent = "SubscriberNotificationSent",
OwnerNotificationSent = "OwnerNotificationSent",
OwnerUserAdded = "OwnerUserAdded",
OwnerTeamAdded = "OwnerTeamAdded",
ScheduledMaintenanceCreated = "ScheduledMaintenanceCreated",
ScheduledMaintenanceStateChanged = "ScheduledMaintenanceStateChanged",
PrivateNote = "PrivateNote",
ScheduledMaintenanceUpdated = "ScheduledMaintenanceUpdated",
RootCause = "RootCause",
RemediationNotes = "RemediationNotes",
OwnerUserRemoved = "OwnerUserRemoved",
OwnerTeamRemoved = "OwnerTeamRemoved",
OnCallPolicy = "OnCallPolicy",
OnCallNotification = "OnCallNotification",
}
@EnableDocumentation()
@CanAccessIfCanReadOn("scheduledMaintenance")
@TenantColumn("projectId")
@TableAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
delete: [],
update: [],
})
@EnableWorkflow({
create: true,
delete: true,
update: true,
read: true,
})
@CrudApiEndpoint(new Route("/scheduled-maintenance-feed"))
@Entity({
name: "ScheduledMaintenanceFeed",
})
@TableMetadata({
tableName: "ScheduledMaintenanceFeed",
singularName: "Scheduled Maintenance Feed",
pluralName: "Scheduled Maintenance Feed",
icon: IconProp.List,
tableDescription:
"Log of the entire scheduled maintenance state change. This is a log of all the scheduled maintenance state changes, public notes, more etc.",
})
export default class ScheduledMaintenanceFeed extends BaseModel {
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "scheduledMaintenanceId",
type: TableColumnType.Entity,
modelType: ScheduledMaintenance,
title: "ScheduledMaintenance",
description:
"Relation to ScheduledMaintenance in which this resource belongs",
})
@ManyToOne(
() => {
return ScheduledMaintenance;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "scheduledMaintenanceId" })
public scheduledMaintenance?: ScheduledMaintenance = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
title: "ScheduledMaintenance ID",
description:
"Relation to ScheduledMaintenance ID in which this resource belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public scheduledMaintenanceId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Markdown,
required: true,
title: "Log (in Markdown)",
description:
"Log of the entire scheduled maintenance state change in Markdown",
})
@Column({
type: ColumnType.Markdown,
nullable: false,
unique: false,
})
public feedInfoInMarkdown?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Markdown,
required: false,
title: "More Information (in Markdown)",
description: "More information in Markdown",
})
@Column({
type: ColumnType.Markdown,
nullable: true,
unique: false,
})
public moreInformationInMarkdown?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ShortText,
required: true,
title: "ScheduledMaintenance Log Event",
description: "ScheduledMaintenance Log Event",
})
@Column({
type: ColumnType.ShortText,
nullable: false,
unique: false,
})
public scheduledMaintenanceFeedEventType?: ScheduledMaintenanceFeedEventType =
undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.Color,
required: true,
title: "Color",
description: "Display color for this log",
})
@Column({
type: ColumnType.Color,
length: ColumnLength.Color,
nullable: false,
unique: false,
transformer: Color.getDatabaseTransformer(),
})
public displayColor?: Color = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "userId",
type: TableColumnType.Entity,
modelType: User,
title: "User",
description:
"Relation to User who this feed belongs to (if this feed belongs to a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "userId" })
public user?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "User ID",
description:
"User who this feed belongs to (if this feed belongs to a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public userId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateScheduledMaintenanceFeed,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadScheduledMaintenanceFeed,
],
update: [],
})
@TableColumn({
title: "Feed Posted At",
description: "Date and time when the feed was posted",
type: TableColumnType.Date,
})
@Column({
type: ColumnType.Date,
nullable: true,
unique: false,
})
public postedAt?: Date = undefined;
}

View File

@@ -1973,4 +1973,37 @@ export default class StatusPage extends BaseModel {
default: UptimePrecision.TWO_DECIMAL,
})
public overallUptimePercentPrecision?: UptimePrecision = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateProjectStatusPage,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadProjectStatusPage,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.EditProjectStatusPage,
],
})
@TableColumn({
required: false,
type: TableColumnType.VeryLongText,
title: "Subscriber Email Notification Footer Text",
description: "Text to send to subscribers in the footer of the email.",
canReadOnRelationQuery: true,
})
@Column({
nullable: true,
type: ColumnType.VeryLongText,
})
public subscriberEmailNotificationFooterText?: string = undefined;
}

View File

@@ -164,7 +164,12 @@ export default class StatusPageAnnouncement extends BaseModel {
Permission.ProjectMember,
Permission.ReadStatusPageAnnouncement,
],
update: [],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.EditStatusPageAnnouncement,
],
})
@TableColumn({
required: false,

View File

@@ -1,4 +1,5 @@
import IncidentSeverity from "./IncidentSeverity";
import AlertSeverity from "./AlertSeverity";
import Project from "./Project";
import User from "./User";
import UserCall from "./UserCall";
@@ -450,6 +451,55 @@ class UserNotificationRule extends BaseModel {
transformer: ObjectID.getDatabaseTransformer(),
})
public incidentSeverityId?: ObjectID = undefined;
// alert severity.
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "alertSeverityId",
type: TableColumnType.Entity,
modelType: AlertSeverity,
title: "Alert Severity",
description:
"Relation to Alert Severity Resource in which this object belongs",
})
@ManyToOne(
() => {
return AlertSeverity;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "alertSeverityId" })
public alertSeverity?: AlertSeverity = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: false,
canReadOnRelationQuery: true,
title: "Alert Severity ID",
description: "ID of Alert Severity in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public alertSeverityId?: ObjectID = undefined;
}
export default UserNotificationRule;

View File

@@ -28,6 +28,7 @@ import Permission from "../../Types/Permission";
import UserNotificationEventType from "../../Types/UserNotification/UserNotificationEventType";
import UserNotificationExecutionStatus from "../../Types/UserNotification/UserNotificationExecutionStatus";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import Alert from "./Alert";
@EnableDocumentation()
@TenantColumn("projectId")
@@ -368,16 +369,62 @@ export default class UserOnCallLog extends BaseModel {
@TableColumn({
type: TableColumnType.ObjectID,
title: "Triggered By Incident ID",
required: false,
description:
"ID of the incident which triggered this on-call escalation policy.",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public triggeredByIncidentId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "triggeredByAlertId",
type: TableColumnType.Entity,
modelType: Alert,
title: "Triggered By Alert",
description: "Relation to Alert which triggered this on-call duty policy.",
})
@ManyToOne(
() => {
return Alert;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "triggeredByAlertId" })
public triggeredByAlert?: Alert = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Triggered By Alert ID",
required: false,
description:
"ID of the Alert which triggered this on-call escalation policy.",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public triggeredByAlertId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],

View File

@@ -1,4 +1,5 @@
import Incident from "./Incident";
import Alert from "./Alert";
import OnCallDutyPolicy from "./OnCallDutyPolicy";
import OnCallDutyPolicyEscalationRule from "./OnCallDutyPolicyEscalationRule";
import OnCallDutyPolicyExecutionLog from "./OnCallDutyPolicyExecutionLog";
@@ -325,18 +326,64 @@ export default class UserOnCallLogTimeline extends BaseModel {
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
required: false,
canReadOnRelationQuery: true,
title: "Incident ID",
description: "ID of your OneUptime Incident in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public triggeredByIncidentId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "triggeredByAlertId",
type: TableColumnType.Entity,
modelType: Alert,
title: "Alert",
description: "Relation to Alert Resource in which this object belongs",
})
@ManyToOne(
() => {
return Alert;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "triggeredByAlertId" })
public triggeredByAlert?: Alert = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: false,
canReadOnRelationQuery: true,
title: "Alert ID",
description: "ID of your OneUptime Alert in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public triggeredByAlertId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],

View File

@@ -0,0 +1,461 @@
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
import BaseNotificationRule from "../../Types/Workspace/NotificationRules/BaseNotificationRule";
import NotificationRuleEventType from "../../Types/Workspace/NotificationRules/EventType";
import Permission from "../../Types/Permission";
@TenantColumn("projectId")
@AllowAccessIfSubscriptionIsUnpaid()
@TableAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
delete: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.DeleteWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@CrudApiEndpoint(new Route("/workspace-notification-rule"))
@Entity({
name: "WorkspaceNotificationRule",
})
@TableMetadata({
tableName: "WorkspaceNotificationRule",
singularName: "Workspace Notification Rule",
pluralName: "Workspace Notification Rules",
icon: IconProp.Logs,
tableDescription: "Notification Rule for Third Party Workspaces",
})
class WorkspaceNotificationRule extends BaseModel {
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
title: "Rule Name",
description: "Name of the Notification Rule",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public name?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
title: "Rule Description",
description: "Description of the Notification Rule",
required: false,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: true,
})
public description?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
title: "Workspace Notification Rules",
description: "Notification Rules for the Workspace",
required: true,
unique: false,
type: TableColumnType.JSON,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.JSON,
unique: false,
nullable: false,
})
public notificationRule?: BaseNotificationRule = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
title: "Workspace Event Type",
description:
"Event Type for the Workspace like Incident Created, Monitor Status Updated, etc.",
required: true,
unique: false,
type: TableColumnType.ShortText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.ShortText,
unique: false,
nullable: false,
})
public eventType?: NotificationRuleEventType = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
title: "Workspace Type",
description: "Type of Workspace - slack, microsoft teams etc.",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public workspaceType?: WorkspaceType = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
// deleted by userId
@ColumnAccessControl({
create: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.CreateWorkspaceNotificationRule,
],
read: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.ReadWorkspaceNotificationRule,
],
update: [
Permission.ProjectAdmin,
Permission.ProjectOwner,
Permission.ProjectMember,
Permission.EditWorkspaceNotificationRule,
],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
}
export default WorkspaceNotificationRule;

View File

@@ -0,0 +1,379 @@
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
import Permission from "../../Types/Permission";
export interface MiscData {
[key: string]: string;
}
export interface SlackMiscData extends MiscData {
teamId: string;
teamName: string;
botUserId: string;
}
@TenantColumn("projectId")
@AllowAccessIfSubscriptionIsUnpaid()
@TableAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
delete: [Permission.ProjectOwner, Permission.ProjectAdmin],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@CrudApiEndpoint(new Route("/workspace-project-auth-token"))
@Entity({
name: "WorkspaceProjectAuthToken",
})
@TableMetadata({
tableName: "WorkspaceProjectAuthToken",
singularName: "Workspace Project Auth Token",
pluralName: "Workspace Project Auth Tokens",
icon: IconProp.Lock,
tableDescription: "Third Party Auth Token for the Project",
})
class WorkspaceProjectAuthToken extends BaseModel {
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [],
update: [],
})
@TableColumn({
title: "Auth Token",
required: true,
unique: false,
type: TableColumnType.VeryLongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.VeryLongText,
unique: false,
nullable: false,
})
public authToken?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [],
})
@TableColumn({
title: "Workspace Type",
description: "Type of Workspace - slack, microsoft teams etc.",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public workspaceType?: WorkspaceType = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@TableColumn({
title: "Project ID in Workspace",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public workspaceProjectId?: string = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@TableColumn({
title: "Misc Data",
required: true,
unique: false,
type: TableColumnType.JSON,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.JSON,
unique: false,
nullable: false,
})
public miscData?: MiscData = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
}
export default WorkspaceProjectAuthToken;

View File

@@ -0,0 +1,230 @@
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
export interface Settings {
[key: string]: string;
}
export interface SlackSettings extends Settings {
teamId: string;
teamName: string;
botUserId: string;
}
@TenantColumn("projectId")
@AllowAccessIfSubscriptionIsUnpaid()
@TableAccessControl({
create: [],
read: [],
delete: [],
update: [],
})
@CrudApiEndpoint(new Route("/workspace-setting"))
@Entity({
name: "WorkspaceSetting",
})
@TableMetadata({
tableName: "WorkspaceSetting",
singularName: "Workspace Setting",
pluralName: "Workspace Settings",
icon: IconProp.Settings,
tableDescription: "Settings for Third Party Workspaces",
})
class WorkspaceSetting extends BaseModel {
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
title: "Workspace Settings",
description: "Settings for the Workspace",
required: true,
unique: false,
type: TableColumnType.JSON,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.JSON,
unique: false,
nullable: false,
})
public settings?: SlackSettings = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
title: "Workspace Type",
description: "Type of Workspace - slack, microsoft teams etc.",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public workspaceType?: WorkspaceType = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
// deleted by userId
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
}
export default WorkspaceSetting;

View File

@@ -0,0 +1,312 @@
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import CurrentUserCanAccessRecordBy from "../../Types/Database/CurrentUserCanAccessRecordBy";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
export interface MiscData {
[key: string]: any;
}
export interface SlackMiscData extends MiscData {
userId: string;
}
@TenantColumn("projectId")
@AllowAccessIfSubscriptionIsUnpaid()
@TableAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
delete: [Permission.CurrentUser],
update: [Permission.CurrentUser],
})
@CrudApiEndpoint(new Route("/workspace-user-auth-token"))
@Entity({
name: "WorkspaceUserAuthToken",
})
@TableMetadata({
tableName: "WorkspaceUserAuthToken",
singularName: "Workspace User Auth Token",
pluralName: "Workspace User Auth Tokens",
icon: IconProp.Lock,
tableDescription: "Third Party Auth Token for the User",
})
@CurrentUserCanAccessRecordBy("userId")
class WorkspaceUserAuthToken extends BaseModel {
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "projectId",
type: TableColumnType.Entity,
modelType: Project,
title: "Project",
description: "Relation to Project Resource in which this object belongs",
})
@ManyToOne(
() => {
return Project;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "projectId" })
public project?: Project = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@Index()
@TableColumn({
type: TableColumnType.ObjectID,
required: true,
canReadOnRelationQuery: true,
title: "Project ID",
description: "ID of your OneUptime Project in which this object belongs",
})
@Column({
type: ColumnType.ObjectID,
nullable: false,
transformer: ObjectID.getDatabaseTransformer(),
})
public projectId?: ObjectID = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [],
update: [],
})
@TableColumn({
title: "Auth Token",
required: true,
unique: false,
type: TableColumnType.VeryLongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.VeryLongText,
unique: false,
nullable: false,
})
public authToken?: string = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
title: "User ID in Service",
description: "User ID in the Workspace",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public workspaceUserId?: string = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
title: "Workspace Type",
description: "Type of Workspace - slack, microsoft teams etc.",
required: true,
unique: false,
type: TableColumnType.LongText,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.LongText,
length: ColumnLength.LongText,
unique: false,
nullable: false,
})
public workspaceType?: WorkspaceType = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
title: "Misc Data",
required: true,
unique: false,
type: TableColumnType.JSON,
canReadOnRelationQuery: true,
})
@Column({
type: ColumnType.JSON,
unique: false,
nullable: false,
})
public miscData?: MiscData = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "user",
type: TableColumnType.Entity,
modelType: User,
title: "User",
description: "Relation to User who this email belongs to",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "CASCADE",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "userId" })
public user?: User = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "User ID",
description: "User ID who this email belongs to",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
@Index()
public userId?: ObjectID = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "createdByUserId",
type: TableColumnType.Entity,
modelType: User,
title: "Created by User",
description:
"Relation to User who created this object (if this object was created by a User)",
})
@ManyToOne(
() => {
return User;
},
{
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "createdByUserId" })
public createdByUser?: User = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Created by User ID",
description:
"User ID who created this object (if this object was created by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public createdByUserId?: ObjectID = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
manyToOneRelationColumn: "deletedByUserId",
type: TableColumnType.Entity,
title: "Deleted by User",
description:
"Relation to User who deleted this object (if this object was deleted by a User)",
})
@ManyToOne(
() => {
return User;
},
{
cascade: false,
eager: false,
nullable: true,
onDelete: "SET NULL",
orphanedRowAction: "nullify",
},
)
@JoinColumn({ name: "deletedByUserId" })
public deletedByUser?: User = undefined;
@ColumnAccessControl({
create: [],
read: [],
update: [],
})
@TableColumn({
type: TableColumnType.ObjectID,
title: "Deleted by User ID",
description:
"User ID who deleted this object (if this object was deleted by a User)",
})
@Column({
type: ColumnType.ObjectID,
nullable: true,
transformer: ObjectID.getDatabaseTransformer(),
})
public deletedByUserId?: ObjectID = undefined;
}
export default WorkspaceUserAuthToken;

View File

@@ -131,6 +131,30 @@ export default class BaseAPI<
},
);
router.post(
`${new this.entityType().getCrudApiPath()?.toString()}/:id/update-item`,
UserMiddleware.getUserMiddleware,
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
try {
await this.updateItem(req, res);
} catch (err) {
next(err);
}
},
);
router.get(
`${new this.entityType().getCrudApiPath()?.toString()}/:id/update-item`,
UserMiddleware.getUserMiddleware,
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
try {
await this.updateItem(req, res);
} catch (err) {
next(err);
}
},
);
// Delete
router.delete(
`${new this.entityType().getCrudApiPath()?.toString()}/:id`,
@@ -144,6 +168,30 @@ export default class BaseAPI<
},
);
router.post(
`${new this.entityType().getCrudApiPath()?.toString()}/:id/delete-item`,
UserMiddleware.getUserMiddleware,
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
try {
await this.deleteItem(req, res);
} catch (err) {
next(err);
}
},
);
router.get(
`${new this.entityType().getCrudApiPath()?.toString()}/:id/delete-item`,
UserMiddleware.getUserMiddleware,
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
try {
await this.deleteItem(req, res);
} catch (err) {
next(err);
}
},
);
this.router = router;
this.service = service;
}

View File

@@ -14,7 +14,6 @@ import {
import Response from "../Utils/Response";
import BaseAPI from "./BaseAPI";
import BaseModel from "Common/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
import SubscriptionStatus from "Common/Types/Billing/SubscriptionStatus";
import BadDataException from "Common/Types/Exception/BadDataException";
import { JSONObject } from "Common/Types/JSON";
import Permission, { UserPermission } from "Common/Types/Permission";
@@ -127,37 +126,8 @@ export default class UserAPI extends BaseAPI<
},
});
// refresh subscription status.
const subscriptionState: SubscriptionStatus =
await BillingService.getSubscriptionStatus(
project.paymentProviderSubscriptionId as string,
);
const meteredSubscriptionState: SubscriptionStatus =
await BillingService.getSubscriptionStatus(
project.paymentProviderMeteredSubscriptionId as string,
);
// if subscription is cancelled, create a new subscription and update project.
if (
meteredSubscriptionState === SubscriptionStatus.Canceled ||
subscriptionState === SubscriptionStatus.Canceled
) {
await ProjectService.reactiveSubscription(project.id!);
}
await ProjectService.updateOneById({
id: project.id!,
data: {
paymentProviderSubscriptionStatus: subscriptionState,
paymentProviderMeteredSubscriptionStatus:
meteredSubscriptionState,
},
props: {
isRoot: true,
ignoreHooks: true,
},
await BillingInvoiceService.refreshSubscriptionStatus({
projectId: project.id!,
});
return Response.sendEmptySuccessResponse(req, res);

View File

@@ -0,0 +1,368 @@
import Express, {
ExpressRequest,
ExpressResponse,
ExpressRouter,
} from "../Utils/Express";
import Response from "../Utils/Response";
import SlackAuthorization from "../Middleware/SlackAuthorization";
import BadRequestException from "../../Types/Exception/BadRequestException";
import logger from "../Utils/Logger";
import { JSONObject } from "../../Types/JSON";
import BadDataException from "../../Types/Exception/BadDataException";
import {
AppApiClientUrl,
DashboardClientUrl,
SlackAppClientId,
SlackAppClientSecret,
} from "../EnvironmentConfig";
import SlackAppManifest from "../Utils/Workspace/Slack/app-manifest.json";
import URL from "../../Types/API/URL";
import HTTPErrorResponse from "../../Types/API/HTTPErrorResponse";
import HTTPResponse from "../../Types/API/HTTPResponse";
import API from "../../Utils/API";
import WorkspaceProjectAuthTokenService from "../Services/WorkspaceProjectAuthTokenService";
import ObjectID from "../../Types/ObjectID";
import WorkspaceUserAuthTokenService from "../Services/WorkspaceUserAuthTokenService";
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
export default class SlackAPI {
public getRouter(): ExpressRouter {
const router: ExpressRouter = Express.getRouter();
router.get(
"/slack/app-manifest",
(req: ExpressRequest, res: ExpressResponse) => {
// return app manifest for slack app
return Response.sendJsonObjectResponse(req, res, SlackAppManifest);
},
);
router.get(
"/slack/auth/:projectId/:userId",
async (req: ExpressRequest, res: ExpressResponse) => {
if (!SlackAppClientId) {
return Response.sendErrorResponse(
req,
res,
new BadDataException("Slack App Client ID is not set"),
);
}
if (!SlackAppClientSecret) {
return Response.sendErrorResponse(
req,
res,
new BadDataException("Slack App Client Secret is not set"),
);
}
const projectId: string | undefined =
req.params["projectId"]?.toString();
const userId: string | undefined = req.params["userId"]?.toString();
if (!projectId) {
return Response.sendErrorResponse(
req,
res,
new BadDataException("Invalid ProjectID in request"),
);
}
if (!userId) {
return Response.sendErrorResponse(
req,
res,
new BadDataException("Invalid UserID in request"),
);
}
// if there's an error query param.
const error: string | undefined = req.query["error"]?.toString();
const slackIntegrationPageUrl: URL = URL.fromString(
DashboardClientUrl.toString() +
`/${projectId.toString()}/settings/slack-integration`,
);
if (error) {
return Response.redirect(
req,
res,
slackIntegrationPageUrl.addQueryParam("error", error),
);
}
// slack returns the code on successful auth.
const code: string | undefined = req.query["code"]?.toString();
if (!code) {
return Response.sendErrorResponse(
req,
res,
new BadRequestException("Invalid request"),
);
}
// get access token from slack api.
const redirectUri: URL = URL.fromString(
`${AppApiClientUrl.toString()}/slack/auth/${projectId}/${userId}`,
);
const requestBody: JSONObject = {
code: code,
client_id: SlackAppClientId,
client_secret: SlackAppClientSecret,
redirect_uri: redirectUri.toString(),
};
logger.debug("Slack Auth Request Body: ");
logger.debug(requestBody);
// send the request to slack api to get the access token https://slack.com/api/oauth.v2.access
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
await API.post(
URL.fromString("https://slack.com/api/oauth.v2.access"),
requestBody,
{
"Content-Type": "application/x-www-form-urlencoded",
},
);
if (response instanceof HTTPErrorResponse) {
throw response;
}
const responseBody: JSONObject = response.data;
logger.debug("Slack Auth Request Body: ");
logger.debug(responseBody);
let slackTeamId: string | undefined = undefined;
let slackBotAccessToken: string | undefined = undefined;
let slackUserId: string | undefined = undefined;
let slackTeamName: string | undefined = undefined;
let botUserId: string | undefined = undefined;
let slackUserAccessToken: string | undefined = undefined;
// ReponseBody is in this format.
// {
// "ok": true,
// "access_token": "sample-token",
// "token_type": "bot",
// "scope": "commands,incoming-webhook",
// "bot_user_id": "U0KRQLJ9H",
// "app_id": "A0KRD7HC3",
// "team": {
// "name": "Slack Pickleball Team",
// "id": "T9TK3CUKW"
// },
// "enterprise": {
// "name": "slack-pickleball",
// "id": "E12345678"
// },
// "authed_user": {
// "id": "U1234",
// "scope": "chat:write",
// "access_token": "sample-token",
// "token_type": "user"
// }
// }
if (responseBody["ok"] !== true) {
return Response.sendErrorResponse(
req,
res,
new BadRequestException("Invalid request"),
);
}
if (
responseBody["team"] &&
(responseBody["team"] as JSONObject)["id"]
) {
slackTeamId = (responseBody["team"] as JSONObject)["id"]?.toString();
}
if (responseBody["access_token"]) {
slackBotAccessToken = responseBody["access_token"]?.toString();
}
if (
responseBody["authed_user"] &&
(responseBody["authed_user"] as JSONObject)["id"]
) {
slackUserId = (responseBody["authed_user"] as JSONObject)[
"id"
]?.toString();
}
if (
responseBody["authed_user"] &&
(responseBody["authed_user"] as JSONObject)["access_token"]
) {
slackUserAccessToken = (responseBody["authed_user"] as JSONObject)[
"access_token"
]?.toString();
}
if (
responseBody["team"] &&
(responseBody["team"] as JSONObject)["name"]
) {
slackTeamName = (responseBody["team"] as JSONObject)[
"name"
]?.toString();
}
if (responseBody["bot_user_id"]) {
botUserId = responseBody["bot_user_id"]?.toString();
}
await WorkspaceProjectAuthTokenService.refreshAuthToken({
projectId: new ObjectID(projectId),
workspaceType: WorkspaceType.Slack,
authToken: slackBotAccessToken || "",
workspaceProjectId: slackTeamId || "",
miscData: {
teamId: slackTeamId || "",
teamName: slackTeamName || "",
botUserId: botUserId || "",
},
});
await WorkspaceUserAuthTokenService.refreshAuthToken({
projectId: new ObjectID(projectId),
userId: new ObjectID(userId),
workspaceType: WorkspaceType.Slack,
authToken: slackUserAccessToken || "",
workspaceUserId: slackUserId || "",
miscData: {
userId: slackUserId || "",
},
});
// return back to dashboard after successful auth.
Response.redirect(req, res, slackIntegrationPageUrl);
},
);
router.post(
"/slack/interactive",
SlackAuthorization.isAuthorizedSlackRequest,
(req: ExpressRequest, res: ExpressResponse) => {
return Response.sendJsonObjectResponse(req, res, {
response_action: "clear",
});
},
);
// options load endpoint.
router.post(
"/slack/options-load",
SlackAuthorization.isAuthorizedSlackRequest,
(req: ExpressRequest, res: ExpressResponse) => {
return Response.sendJsonObjectResponse(req, res, {
response_action: "clear",
});
},
);
router.post(
"/slack/command",
SlackAuthorization.isAuthorizedSlackRequest,
(req: ExpressRequest, res: ExpressResponse) => {
return Response.sendJsonObjectResponse(req, res, {
response_action: "clear",
});
},
);
router.post(
"/slack/events",
SlackAuthorization.isAuthorizedSlackRequest,
(req: ExpressRequest, res: ExpressResponse) => {
// respond to slack challenge
const body: any = req.body;
if (body.challenge) {
return Response.sendJsonObjectResponse(req, res, {
challenge: body.challenge,
});
}
// if event is "create-incident" then show the incident create modal with title and description and add a button to submit the form.
if (body.event && body.event.type === "create-incident") {
return Response.sendJsonObjectResponse(req, res, {
type: "modal",
title: {
type: "plain_text",
text: "Create Incident",
},
blocks: [
{
type: "input",
block_id: "title",
element: {
type: "plain_text_input",
action_id: "title",
placeholder: {
type: "plain_text",
text: "Incident Title",
},
},
label: {
type: "plain_text",
text: "Title",
},
},
{
type: "input",
block_id: "description",
element: {
type: "plain_text_input",
action_id: "description",
placeholder: {
type: "plain_text",
text: "Incident Description",
},
},
label: {
type: "plain_text",
text: "Description",
},
},
// button
{
type: "actions",
elements: [
{
type: "button",
text: {
type: "plain_text",
text: "Submit",
},
style: "primary",
value: "submit",
},
],
},
],
});
}
return Response.sendErrorResponse(
req,
res,
new BadRequestException("Invalid request"),
);
},
);
return router;
}
}

View File

@@ -74,6 +74,8 @@ import StatusPageResource from "Common/Models/DatabaseModels/StatusPageResource"
import StatusPageSSO from "Common/Models/DatabaseModels/StatusPageSso";
import StatusPageSubscriber from "Common/Models/DatabaseModels/StatusPageSubscriber";
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
import StatusPageResourceUptimeUtil from "../../Utils/StatusPage/ResourceUptime";
import MonitorService from "../Services/MonitorService";
export default class StatusPageAPI extends BaseAPI<
StatusPage,
@@ -517,6 +519,128 @@ export default class StatusPageAPI extends BaseAPI<
},
);
this.router.post(
`${new this.entityType()
.getCrudApiPath()
?.toString()}/overview/:statusPageId/uptime-percent`,
UserMiddleware.getUserMiddleware,
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
try {
// This reosurce ID can be of a status page resource OR a status page group.
const statusPageResourceId: ObjectID = new ObjectID(
req.params["statusPageResourceId"] as string,
);
const statusPageId: ObjectID = new ObjectID(
req.params["statusPageId"] as string,
);
if(!statusPageId || !statusPageResourceId){
throw new BadDataException("Status Page or Resource not found");
}
// get start and end date from request body.
// if no end date is provided then it will be current date.
// if no start date is provided then it will be 14 days ago from end date.
let startDate: Date = OneUptimeDate.getSomeDaysAgo(14)
let endDate: Date = OneUptimeDate.getCurrentDate();
if(req.body["startDate"]){
startDate = OneUptimeDate.fromString(req.body["startDate"] as string);
}
if(req.body["endDate"]){
endDate = OneUptimeDate.fromString(req.body["endDate"] as string);
}
const monitorStatusTimelines: Array<MonitorStatusTimeline> = [];
// get monitor or group.
// get status page group.
const monitorsInResource: Array<ObjectID> = [];
const statusPageGroup: StatusPageGroup | null = await StatusPageGroupService.findOneBy({
query: {
_id: statusPageResourceId,
statusPageId: statusPageId,
},
select: {
_id: true,
statusPageId: true,
},
props: {
isRoot: true,
},
});
if(statusPageGroup){
// get all monitors in group.
const groupResources: Array<StatusPageResource> = await StatusPageResourceService.findBy({
query: {
statusPageGroupId: statusPageResourceId,
},
select: {
monitorId: true,
monitorGroupId: true,
},
props: {
isRoot: true,
},
limit: LIMIT_PER_PROJECT,
skip: 0,
});
monitorsInGroup.push(...groupResources.map((resource: StatusPageResource) => {
return resource.monitorId!;
}).filter((id: ObjectID) => {
return Boolean(id);
}));
}
const monitor: Monitor | null = await MonitorService.findOneBy({
query: {
_id: statusPageResourceId,
},
select: {
_id: true,
name: true,
monitorGroupId: true,
},
props: {
isRoot: true,
},
});
const uptimePercent: number | null = null;
StatusPageResourceUptimeUtil.calculateAvgUptimePercentOfStatusPageGroup(
{
statusPageGroup: data.group,
monitorStatusTimelines: monitorStatusTimelines,
precision:
data.group.uptimePercentPrecision ||
UptimePrecision.ONE_DECIMAL,
downtimeMonitorStatuses:
statusPage?.downtimeMonitorStatuses || [],
statusPageResources: statusPageResources,
monitorsInGroup: monitorsInGroup,
},
);
} catch (err) {
next(err);
}
});
this.router.post(
`${new this.entityType()
.getCrudApiPath()
@@ -1093,7 +1217,18 @@ export default class StatusPageAPI extends BaseAPI<
},
});
const overallStatus: MonitorStatus | null =
this.getOverallMonitorStatus(
statusPageResources,
monitorStatuses,
monitorGroupCurrentStatuses,
);
const response: JSONObject = {
overallStatus: overallStatus
? BaseModel.toJSON(overallStatus, MonitorStatus)
: null,
scheduledMaintenanceEventsPublicNotes: BaseModel.toJSONArray(
scheduledMaintenanceEventsPublicNotes,
ScheduledMaintenancePublicNote,
@@ -2284,4 +2419,54 @@ export default class StatusPageAPI extends BaseAPI<
return response;
}
public getOverallMonitorStatus(
statusPageResources: Array<StatusPageResource>,
monitorStatuses: Array<MonitorStatus>,
monitorGroupCurrentStatuses: Dictionary<ObjectID>,
): MonitorStatus | null {
let currentStatus: MonitorStatus | null =
monitorStatuses.length > 0 && monitorStatuses[0]
? monitorStatuses[0]
: null;
const dict: Dictionary<number> = {};
for (const resource of statusPageResources) {
if (resource.monitor?.currentMonitorStatusId) {
if (
!Object.keys(dict).includes(
resource.monitor?.currentMonitorStatusId.toString() || "",
)
) {
dict[resource.monitor?.currentMonitorStatusId?.toString()] = 1;
} else {
dict[resource.monitor!.currentMonitorStatusId!.toString()]!++;
}
}
}
// check status of monitor groups.
for (const groupId in monitorGroupCurrentStatuses) {
const statusId: ObjectID | undefined =
monitorGroupCurrentStatuses[groupId];
if (statusId) {
if (!Object.keys(dict).includes(statusId.toString() || "")) {
dict[statusId.toString()] = 1;
} else {
dict[statusId.toString()]!++;
}
}
}
for (const monitorStatus of monitorStatuses) {
if (monitorStatus._id && dict[monitorStatus._id]) {
currentStatus = monitorStatus;
}
}
return currentStatus;
}
}

View File

@@ -55,6 +55,7 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI<
_id: true,
projectId: true,
triggeredByIncidentId: true,
triggeredByAlertId: true,
},
props: {
isRoot: true,
@@ -115,6 +116,7 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI<
_id: true,
projectId: true,
triggeredByIncidentId: true,
triggeredByAlertId: true,
},
props: {
isRoot: true,
@@ -147,16 +149,38 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI<
const host: Hostname = await DatabaseConfig.getHost();
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
return Response.redirect(
if (timelineItem.triggeredByIncidentId) {
return Response.redirect(
req,
res,
new URL(
httpProtocol,
host,
DashboardRoute.addRoute(
`/${timelineItem.projectId?.toString()}/incidents/${timelineItem.triggeredByIncidentId!.toString()}`,
),
),
);
}
if (timelineItem.triggeredByAlertId) {
return Response.redirect(
req,
res,
new URL(
httpProtocol,
host,
DashboardRoute.addRoute(
`/${timelineItem.projectId?.toString()}/alerts/${timelineItem.triggeredByAlertId!.toString()}`,
),
),
);
}
return Response.sendErrorResponse(
req,
res,
new URL(
httpProtocol,
host,
DashboardRoute.addRoute(
`/${timelineItem.projectId?.toString()}/incidents/${timelineItem.triggeredByIncidentId!.toString()}`,
),
),
new BadDataException("Invalid item Id"),
);
},
);

View File

@@ -30,6 +30,14 @@ export default class DatabaseConfig {
return globalConfig.getColumnValue(key);
}
public static async getHomeUrl(): Promise<URL> {
const host: Hostname = await DatabaseConfig.getHost();
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
return new URL(httpProtocol, host);
}
public static async getHost(): Promise<Hostname> {
return Promise.resolve(new Hostname(process.env["HOST"] || "localhost"));
}

View File

@@ -2,6 +2,7 @@ import {
AccountsRoute,
AdminDashboardRoute,
DashboardRoute,
AppApiRoute,
} from "Common/ServiceRoute";
import BillingConfig from "./BillingConfig";
import Hostname from "Common/Types/API/Hostname";
@@ -259,6 +260,10 @@ export const WorkflowScriptTimeoutInMS: number = process.env[
? parseInt(process.env["WORKFLOW_SCRIPT_TIMEOUT_IN_MS"].toString())
: 5000;
export const WorkflowTimeoutInMs: number = process.env["WORKFLOW_TIMEOUT_IN_MS"]
? parseInt(process.env["WORKFLOW_TIMEOUT_IN_MS"].toString())
: 5000;
export const AllowedActiveMonitorCountInFreePlan: number = process.env[
"ALLOWED_ACTIVE_MONITOR_COUNT_IN_FREE_PLAN"
]
@@ -279,8 +284,19 @@ export const AllowedSubscribersCountInFreePlan: number = process.env[
? parseInt(process.env["ALLOWED_SUBSCRIBERS_COUNT_IN_FREE_PLAN"].toString())
: 100;
export const NotificationWebhookOnCreateUser: string =
process.env["NOTIFICATION_WEBHOOK_ON_CREATED_USER"] || "";
export const NotificationSlackWebhookOnCreateUser: string =
process.env["NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_USER"] || "";
export const NotificationSlackWebhookOnCreateProject: string =
process.env["NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_PROJECT"] || "";
// notification delete project
export const NotificationSlackWebhookOnDeleteProject: string =
process.env["NOTIFICATION_SLACK_WEBHOOK_ON_DELETED_PROJECT"] || "";
// notification subscripton update.
export const NotificationSlackWebhookOnSubscriptionUpdate: string =
process.env["NOTIFICATION_SLACK_WEBHOOK_ON_SUBSCRIPTION_UPDATE"] || "";
export const AdminDashboardClientURL: URL = new URL(
HttpProtocol,
@@ -288,6 +304,8 @@ export const AdminDashboardClientURL: URL = new URL(
AdminDashboardRoute,
);
export const AppApiClientUrl: URL = new URL(HttpProtocol, Host, AppApiRoute);
export const DashboardClientUrl: URL = new URL(
HttpProtocol,
Host,
@@ -302,3 +320,10 @@ export const AccountsClientUrl: URL = new URL(
export const DisableTelemetry: boolean =
process.env["DISABLE_TELEMETRY"] === "true";
export const SlackAppClientId: string | null =
process.env["SLACK_APP_CLIENT_ID"] || null;
export const SlackAppClientSecret: string | null =
process.env["SLACK_APP_CLIENT_SECRET"] || null;
export const SlackAppSigningSecret: string | null =
process.env["SLACK_APP_SIGNING_SECRET"] || null;

View File

@@ -18,9 +18,10 @@ export type ClickHouseClientConfigOptions = NodeClickHouseClientConfigOptions;
const hostProtocol: string = ClickHouseIsHostHttps ? "https" : "http";
const clickhouseHost: Hostname = ClickhouseHost || new Hostname("clickhouse");
const clickhousePort: string = (ClickhousePort || 8123).toString();
const options: ClickHouseClientConfigOptions = {
url: `${hostProtocol}://${clickhouseHost.toString()}:${ClickhousePort.toNumber()}`,
url: `${hostProtocol}://${clickhouseHost.toString()}:${clickhousePort}`,
username: ClickhouseUsername,
password: ClickhousePassword,
database: ClickhouseDatabase,

View File

@@ -0,0 +1,51 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736364478985 implements MigrationInterface {
public name = "MigrationName1736364478985";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "IncidentLog" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "incidentId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "logInMarkdown" text NOT NULL, "moreInformationInMarkdown" text NOT NULL, "incidentLogEvent" character varying NOT NULL, CONSTRAINT "PK_947cb9f32cf204561d10d64adeb" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_855797e41af7d35b18a7f3f97b" ON "IncidentLog" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_1eff2f3d075754ef9c16e8b962" ON "IncidentLog" ("incidentId") `,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" ADD CONSTRAINT "FK_855797e41af7d35b18a7f3f97bd" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" ADD CONSTRAINT "FK_1eff2f3d075754ef9c16e8b962c" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" ADD CONSTRAINT "FK_da6bb8bf63b18a7ddc35cc2901a" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" ADD CONSTRAINT "FK_bb1b8b83ffdfc702088b74f2e16" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "IncidentLog" DROP CONSTRAINT "FK_bb1b8b83ffdfc702088b74f2e16"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" DROP CONSTRAINT "FK_da6bb8bf63b18a7ddc35cc2901a"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" DROP CONSTRAINT "FK_1eff2f3d075754ef9c16e8b962c"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" DROP CONSTRAINT "FK_855797e41af7d35b18a7f3f97bd"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_1eff2f3d075754ef9c16e8b962"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_855797e41af7d35b18a7f3f97b"`,
);
await queryRunner.query(`DROP TABLE "IncidentLog"`);
}
}

View File

@@ -0,0 +1,63 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736364957990 implements MigrationInterface {
public name = "MigrationName1736364957990";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "AlertLog" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "alertId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "logInMarkdown" text NOT NULL, "moreInformationInMarkdown" text NOT NULL, "alertLogEvent" character varying NOT NULL, CONSTRAINT "PK_500826238fa54528b0026f55d47" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_d5d56f9ed2c4c72745372a1ac6" ON "AlertLog" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_52bbabed66e4e728441d49478f" ON "AlertLog" ("alertId") `,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" ADD CONSTRAINT "FK_d5d56f9ed2c4c72745372a1ac6f" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" ADD CONSTRAINT "FK_52bbabed66e4e728441d49478f8" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" ADD CONSTRAINT "FK_f5f832aad105579e95a09e1ddd0" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" ADD CONSTRAINT "FK_7ca9046915f6de6e7a199588d26" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "AlertLog" DROP CONSTRAINT "FK_7ca9046915f6de6e7a199588d26"`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" DROP CONSTRAINT "FK_f5f832aad105579e95a09e1ddd0"`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" DROP CONSTRAINT "FK_52bbabed66e4e728441d49478f8"`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" DROP CONSTRAINT "FK_d5d56f9ed2c4c72745372a1ac6f"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_52bbabed66e4e728441d49478f"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_d5d56f9ed2c4c72745372a1ac6"`,
);
await queryRunner.query(`DROP TABLE "AlertLog"`);
}
}

View File

@@ -0,0 +1,51 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736365532085 implements MigrationInterface {
public name = "MigrationName1736365532085";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "ScheduledMaintenanceLog" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "scheduledMaintenanceId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "logInMarkdown" text NOT NULL, "moreInformationInMarkdown" text NOT NULL, "scheduledMaintenanceLogEvent" character varying NOT NULL, CONSTRAINT "PK_27b89f28bf48418fabba9a1ea14" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_9239de1ee33f9505c30f255a99" ON "ScheduledMaintenanceLog" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_58e403ba261dfa94addb5f04d3" ON "ScheduledMaintenanceLog" ("scheduledMaintenanceId") `,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" ADD CONSTRAINT "FK_9239de1ee33f9505c30f255a994" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" ADD CONSTRAINT "FK_58e403ba261dfa94addb5f04d36" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" ADD CONSTRAINT "FK_9152528e4f7f59adaba3e9bc41f" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" ADD CONSTRAINT "FK_a957f435d1504f41808f20a2c45" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" DROP CONSTRAINT "FK_a957f435d1504f41808f20a2c45"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" DROP CONSTRAINT "FK_9152528e4f7f59adaba3e9bc41f"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" DROP CONSTRAINT "FK_58e403ba261dfa94addb5f04d36"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" DROP CONSTRAINT "FK_9239de1ee33f9505c30f255a994"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_58e403ba261dfa94addb5f04d3"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_9239de1ee33f9505c30f255a99"`,
);
await queryRunner.query(`DROP TABLE "ScheduledMaintenanceLog"`);
}
}

View File

@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736675947746 implements MigrationInterface {
public name = "MigrationName1736675947746";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "Incident" ADD "incidentNumber" integer`,
);
await queryRunner.query(
`CREATE INDEX "IDX_0eca9ce7d12a4c472386dfc781" ON "Incident" ("incidentNumber") `,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "public"."IDX_0eca9ce7d12a4c472386dfc781"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" DROP COLUMN "incidentNumber"`,
);
}
}

View File

@@ -0,0 +1,29 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736703138918 implements MigrationInterface {
public name = "MigrationName1736703138918";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "IncidentLog" ADD "incidentLogSeverity" character varying NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" ADD "alertLogSeverity" character varying NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" ADD "scheduledMaintenanceLogSeverity" character varying NOT NULL`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceLog" DROP COLUMN "scheduledMaintenanceLogSeverity"`,
);
await queryRunner.query(
`ALTER TABLE "AlertLog" DROP COLUMN "alertLogSeverity"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentLog" DROP COLUMN "incidentLogSeverity"`,
);
}
}

View File

@@ -0,0 +1,137 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736780194077 implements MigrationInterface {
public name = "MigrationName1736780194077";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "IncidentFeed" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "incidentId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "feedInfoInMarkdown" text NOT NULL, "moreInformationInMarkdown" text NOT NULL, "incidentFeedEventType" character varying NOT NULL, "displayColor" character varying(7) NOT NULL, CONSTRAINT "PK_8188c79d1ed22013205ff324dea" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_32ae47fa45018ecdb7f28c6468" ON "IncidentFeed" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_cf4aea7310bb855873fc40f244" ON "IncidentFeed" ("incidentId") `,
);
await queryRunner.query(
`CREATE TABLE "AlertFeed" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "alertId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "feedInfoInMarkdown" text NOT NULL, "moreInformationInMarkdown" text NOT NULL, "alertFeedEventType" character varying NOT NULL, "displayColor" character varying(7) NOT NULL, CONSTRAINT "PK_d5f629abd40a51d58a35423b361" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_f430519f21c327c14c12e4f106" ON "AlertFeed" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_f74177b6675d92243cc0794bd3" ON "AlertFeed" ("alertId") `,
);
await queryRunner.query(
`CREATE TABLE "ScheduledMaintenanceFeed" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "scheduledMaintenanceId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "feedInfoInMarkdown" text NOT NULL, "moreInformationInMarkdown" text NOT NULL, "scheduledMaintenanceFeedEventType" character varying NOT NULL, "displayColor" character varying(7) NOT NULL, CONSTRAINT "PK_ced33ccb5551624e432b2df6513" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_416c6ded7f17b15e9a83114740" ON "ScheduledMaintenanceFeed" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_ce3b353bbd3e1695c0ffb2d235" ON "ScheduledMaintenanceFeed" ("scheduledMaintenanceId") `,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ADD CONSTRAINT "FK_32ae47fa45018ecdb7f28c64685" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ADD CONSTRAINT "FK_cf4aea7310bb855873fc40f2441" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ADD CONSTRAINT "FK_4458fd00d52521ae4333e74ddbd" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ADD CONSTRAINT "FK_f1ee9faba64e96f91925247aae3" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ADD CONSTRAINT "FK_f430519f21c327c14c12e4f1063" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ADD CONSTRAINT "FK_f74177b6675d92243cc0794bd3f" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ADD CONSTRAINT "FK_2eda7dbbc78de28f653812b5e3d" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ADD CONSTRAINT "FK_f0e72673c38f18ed84f0e94a5a1" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD CONSTRAINT "FK_416c6ded7f17b15e9a831147403" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD CONSTRAINT "FK_ce3b353bbd3e1695c0ffb2d2354" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD CONSTRAINT "FK_fc34cf1a5eb488310bbe7c6a46a" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD CONSTRAINT "FK_8374052884c5d75f5018c1dc908" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP CONSTRAINT "FK_8374052884c5d75f5018c1dc908"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP CONSTRAINT "FK_fc34cf1a5eb488310bbe7c6a46a"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP CONSTRAINT "FK_ce3b353bbd3e1695c0ffb2d2354"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP CONSTRAINT "FK_416c6ded7f17b15e9a831147403"`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" DROP CONSTRAINT "FK_f0e72673c38f18ed84f0e94a5a1"`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" DROP CONSTRAINT "FK_2eda7dbbc78de28f653812b5e3d"`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" DROP CONSTRAINT "FK_f74177b6675d92243cc0794bd3f"`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" DROP CONSTRAINT "FK_f430519f21c327c14c12e4f1063"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" DROP CONSTRAINT "FK_f1ee9faba64e96f91925247aae3"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" DROP CONSTRAINT "FK_4458fd00d52521ae4333e74ddbd"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" DROP CONSTRAINT "FK_cf4aea7310bb855873fc40f2441"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" DROP CONSTRAINT "FK_32ae47fa45018ecdb7f28c64685"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_ce3b353bbd3e1695c0ffb2d235"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_416c6ded7f17b15e9a83114740"`,
);
await queryRunner.query(`DROP TABLE "ScheduledMaintenanceFeed"`);
await queryRunner.query(
`DROP INDEX "public"."IDX_f74177b6675d92243cc0794bd3"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_f430519f21c327c14c12e4f106"`,
);
await queryRunner.query(`DROP TABLE "AlertFeed"`);
await queryRunner.query(
`DROP INDEX "public"."IDX_cf4aea7310bb855873fc40f244"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_32ae47fa45018ecdb7f28c6468"`,
);
await queryRunner.query(`DROP TABLE "IncidentFeed"`);
}
}

View File

@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736780194078 implements MigrationInterface {
public name = "MigrationName1736780194078";
public async up(queryRunner: QueryRunner): Promise<void> {
// drop tables IncidentLog, AlertLog, ScheduledMaintenanceLog
await queryRunner.query(`DROP TABLE "IncidentLog"`);
await queryRunner.query(`DROP TABLE "AlertLog"`);
await queryRunner.query(`DROP TABLE "ScheduledMaintenanceLog"`);
}
public async down(_queryRunner: QueryRunner): Promise<void> {
// do nothing.
}
}

View File

@@ -0,0 +1,29 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736787495707 implements MigrationInterface {
public name = "MigrationName1736787495707";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ALTER COLUMN "moreInformationInMarkdown" DROP NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ALTER COLUMN "moreInformationInMarkdown" DROP NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ALTER COLUMN "moreInformationInMarkdown" DROP NOT NULL`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ALTER COLUMN "moreInformationInMarkdown" SET NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ALTER COLUMN "moreInformationInMarkdown" SET NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ALTER COLUMN "moreInformationInMarkdown" SET NOT NULL`,
);
}
}

View File

@@ -0,0 +1,83 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736787985322 implements MigrationInterface {
public name = "MigrationName1736787985322";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "Label" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "IncidentSeverity" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "IncidentState" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "MonitorStatus" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ALTER COLUMN "displayColor" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "AlertSeverity" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "AlertState" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceState" ALTER COLUMN "color" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "StatusPage" ALTER COLUMN "defaultBarColor" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "StatusPageHistoryChartBarColorRule" ALTER COLUMN "barColor" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ALTER COLUMN "displayColor" TYPE character varying(10)`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ALTER COLUMN "displayColor" TYPE character varying(10)`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "Label" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "IncidentSeverity" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "IncidentState" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "MonitorStatus" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ALTER COLUMN "displayColor" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "AlertSeverity" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "AlertState" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceState" ALTER COLUMN "color" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "StatusPage" ALTER COLUMN "defaultBarColor" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "StatusPageHistoryChartBarColorRule" ALTER COLUMN "barColor" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ALTER COLUMN "displayColor" TYPE character varying(7)`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ALTER COLUMN "displayColor" TYPE character varying(7)`,
);
}
}

View File

@@ -0,0 +1,39 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736788706141 implements MigrationInterface {
public name = "MigrationName1736788706141";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "IncidentFeed" ADD "userId" uuid`);
await queryRunner.query(`ALTER TABLE "AlertFeed" ADD "userId" uuid`);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD "userId" uuid`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ADD CONSTRAINT "FK_010577090e59583da93c867f541" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ADD CONSTRAINT "FK_97b19fbc90b6105614cc0cba300" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD CONSTRAINT "FK_541c2b40579cbf342c8850ced2b" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP CONSTRAINT "FK_541c2b40579cbf342c8850ced2b"`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" DROP CONSTRAINT "FK_97b19fbc90b6105614cc0cba300"`,
);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" DROP CONSTRAINT "FK_010577090e59583da93c867f541"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP COLUMN "userId"`,
);
await queryRunner.query(`ALTER TABLE "AlertFeed" DROP COLUMN "userId"`);
await queryRunner.query(`ALTER TABLE "IncidentFeed" DROP COLUMN "userId"`);
}
}

View File

@@ -0,0 +1,27 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1736856662868 implements MigrationInterface {
public name = "MigrationName1736856662868";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "IncidentFeed" ADD "postedAt" TIMESTAMP WITH TIME ZONE`,
);
await queryRunner.query(
`ALTER TABLE "AlertFeed" ADD "postedAt" TIMESTAMP WITH TIME ZONE`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" ADD "postedAt" TIMESTAMP WITH TIME ZONE`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenanceFeed" DROP COLUMN "postedAt"`,
);
await queryRunner.query(`ALTER TABLE "AlertFeed" DROP COLUMN "postedAt"`);
await queryRunner.query(
`ALTER TABLE "IncidentFeed" DROP COLUMN "postedAt"`,
);
}
}

View File

@@ -0,0 +1,131 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1737141420441 implements MigrationInterface {
public name = "MigrationName1737141420441";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD "triggeredByAlertId" uuid`,
);
await queryRunner.query(
`ALTER TABLE "UserNotificationRule" ADD "alertSeverityId" uuid`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" ADD "triggeredByAlertId" uuid`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" ADD "triggeredByAlertId" uuid`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP CONSTRAINT "FK_90119ec7f77fa2efd82261e0448"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ALTER COLUMN "triggeredByIncidentId" DROP NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" DROP CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" ALTER COLUMN "triggeredByIncidentId" DROP NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" DROP CONSTRAINT "FK_58a44736718a5ec4fe41526289a"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" ALTER COLUMN "triggeredByIncidentId" DROP NOT NULL`,
);
await queryRunner.query(
`CREATE INDEX "IDX_30358ab25e4c6c9ad72e74f201" ON "OnCallDutyPolicyExecutionLogTimeline" ("triggeredByAlertId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_d73339f6c26fd6ebd0326badcd" ON "UserNotificationRule" ("alertSeverityId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_42d9916277fcbefa0cdd3904c6" ON "UserOnCallLogTimeline" ("triggeredByAlertId") `,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD CONSTRAINT "FK_90119ec7f77fa2efd82261e0448" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD CONSTRAINT "FK_30358ab25e4c6c9ad72e74f201c" FOREIGN KEY ("triggeredByAlertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserNotificationRule" ADD CONSTRAINT "FK_d73339f6c26fd6ebd0326badcd7" FOREIGN KEY ("alertSeverityId") REFERENCES "AlertSeverity"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" ADD CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" ADD CONSTRAINT "FK_0ee3711cdc64957845d9d028c31" FOREIGN KEY ("triggeredByAlertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" ADD CONSTRAINT "FK_58a44736718a5ec4fe41526289a" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" ADD CONSTRAINT "FK_42d9916277fcbefa0cdd3904c63" FOREIGN KEY ("triggeredByAlertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" DROP CONSTRAINT "FK_42d9916277fcbefa0cdd3904c63"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" DROP CONSTRAINT "FK_58a44736718a5ec4fe41526289a"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" DROP CONSTRAINT "FK_0ee3711cdc64957845d9d028c31"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" DROP CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074"`,
);
await queryRunner.query(
`ALTER TABLE "UserNotificationRule" DROP CONSTRAINT "FK_d73339f6c26fd6ebd0326badcd7"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP CONSTRAINT "FK_30358ab25e4c6c9ad72e74f201c"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP CONSTRAINT "FK_90119ec7f77fa2efd82261e0448"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_42d9916277fcbefa0cdd3904c6"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_d73339f6c26fd6ebd0326badcd"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_30358ab25e4c6c9ad72e74f201"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" ALTER COLUMN "triggeredByIncidentId" SET NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" ADD CONSTRAINT "FK_58a44736718a5ec4fe41526289a" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" ALTER COLUMN "triggeredByIncidentId" SET NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" ADD CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ALTER COLUMN "triggeredByIncidentId" SET NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD CONSTRAINT "FK_90119ec7f77fa2efd82261e0448" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLogTimeline" DROP COLUMN "triggeredByAlertId"`,
);
await queryRunner.query(
`ALTER TABLE "UserOnCallLog" DROP COLUMN "triggeredByAlertId"`,
);
await queryRunner.query(
`ALTER TABLE "UserNotificationRule" DROP COLUMN "alertSeverityId"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP COLUMN "triggeredByAlertId"`,
);
}
}

View File

@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1737713529424 implements MigrationInterface {
public name = "MigrationName1737713529424";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "StatusPage" ADD "subscriberEmailNotificationFooterText" character varying(100)`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "StatusPage" DROP COLUMN "subscriberEmailNotificationFooterText"`,
);
}
}

View File

@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1737715240684 implements MigrationInterface {
public name = "MigrationName1737715240684";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "StatusPage" DROP COLUMN "subscriberEmailNotificationFooterText"`,
);
await queryRunner.query(
`ALTER TABLE "StatusPage" ADD "subscriberEmailNotificationFooterText" text`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "StatusPage" DROP COLUMN "subscriberEmailNotificationFooterText"`,
);
await queryRunner.query(
`ALTER TABLE "StatusPage" ADD "subscriberEmailNotificationFooterText" character varying(100)`,
);
}
}

View File

@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1737997557974 implements MigrationInterface {
public name = "MigrationName1737997557974";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IDX_4d5e62631b2b63aaecb00950ef" ON "MonitorTest" ("isInQueue") `,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "public"."IDX_4d5e62631b2b63aaecb00950ef"`,
);
}
}

View File

@@ -0,0 +1,147 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1739209832500 implements MigrationInterface {
public name = "MigrationName1739209832500";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "WorkspaceUserAuthToken" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "authToken" text NOT NULL, "workspaceUserId" character varying(500) NOT NULL, "workspaceType" character varying(500) NOT NULL, "miscData" jsonb NOT NULL, "userId" uuid, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_ae2f1b46b7e26f58a1f4a56b6ea" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_bee888f5782b9585e01f13455f" ON "WorkspaceUserAuthToken" ("projectId") `,
);
await queryRunner.query(
`CREATE INDEX "IDX_4b7c7d1a8b2259df8c790db094" ON "WorkspaceUserAuthToken" ("userId") `,
);
await queryRunner.query(
`CREATE TABLE "WorkspaceProjectAuthToken" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "authToken" text NOT NULL, "workspaceType" character varying(500) NOT NULL, "workspaceProjectId" character varying(500) NOT NULL, "miscData" jsonb NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_c0caa6a69da614ee74d8c1291da" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_73f5887268b09c0abccf04ef02" ON "WorkspaceProjectAuthToken" ("projectId") `,
);
await queryRunner.query(
`CREATE TABLE "WorkspaceSetting" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "settings" jsonb NOT NULL, "workspaceType" character varying(500) NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_eb98d42edd6489fbe1cf3f34515" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_c68f38e2b2b061c40209e85bf2" ON "WorkspaceSetting" ("projectId") `,
);
await queryRunner.query(
`CREATE TABLE "WorkspaceNotificationRule" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(500) NOT NULL, "description" character varying(500), "notificationRule" jsonb NOT NULL, "eventType" character varying NOT NULL, "workspaceType" character varying(500) NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_d1485681c7695ac9841dc52a451" PRIMARY KEY ("_id"))`,
);
await queryRunner.query(
`CREATE INDEX "IDX_349b022afa9a50a597d6c91ec9" ON "WorkspaceNotificationRule" ("projectId") `,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" ADD CONSTRAINT "FK_bee888f5782b9585e01f13455fb" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" ADD CONSTRAINT "FK_4b7c7d1a8b2259df8c790db0940" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" ADD CONSTRAINT "FK_ec5cbf4536681fe4bea883c98ea" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" ADD CONSTRAINT "FK_1b2cb71eaf9e665e4556d1b1263" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceProjectAuthToken" ADD CONSTRAINT "FK_73f5887268b09c0abccf04ef02e" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceProjectAuthToken" ADD CONSTRAINT "FK_8aa5804c7a728039564bf5d967d" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceProjectAuthToken" ADD CONSTRAINT "FK_6287095997a16f1cbdd4fb24b61" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceSetting" ADD CONSTRAINT "FK_c68f38e2b2b061c40209e85bf22" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceSetting" ADD CONSTRAINT "FK_c8fdd61b95bfd0a2ca268b8c602" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceSetting" ADD CONSTRAINT "FK_cb3b7931417a4b4ee05d487b614" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceNotificationRule" ADD CONSTRAINT "FK_349b022afa9a50a597d6c91ec95" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceNotificationRule" ADD CONSTRAINT "FK_55f4e43427fc217ed32cf640a28" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceNotificationRule" ADD CONSTRAINT "FK_65ac673d16286be2dcd5229fe24" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "WorkspaceNotificationRule" DROP CONSTRAINT "FK_65ac673d16286be2dcd5229fe24"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceNotificationRule" DROP CONSTRAINT "FK_55f4e43427fc217ed32cf640a28"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceNotificationRule" DROP CONSTRAINT "FK_349b022afa9a50a597d6c91ec95"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceSetting" DROP CONSTRAINT "FK_cb3b7931417a4b4ee05d487b614"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceSetting" DROP CONSTRAINT "FK_c8fdd61b95bfd0a2ca268b8c602"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceSetting" DROP CONSTRAINT "FK_c68f38e2b2b061c40209e85bf22"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceProjectAuthToken" DROP CONSTRAINT "FK_6287095997a16f1cbdd4fb24b61"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceProjectAuthToken" DROP CONSTRAINT "FK_8aa5804c7a728039564bf5d967d"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceProjectAuthToken" DROP CONSTRAINT "FK_73f5887268b09c0abccf04ef02e"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" DROP CONSTRAINT "FK_1b2cb71eaf9e665e4556d1b1263"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" DROP CONSTRAINT "FK_ec5cbf4536681fe4bea883c98ea"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" DROP CONSTRAINT "FK_4b7c7d1a8b2259df8c790db0940"`,
);
await queryRunner.query(
`ALTER TABLE "WorkspaceUserAuthToken" DROP CONSTRAINT "FK_bee888f5782b9585e01f13455fb"`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
);
await queryRunner.query(
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_349b022afa9a50a597d6c91ec9"`,
);
await queryRunner.query(`DROP TABLE "WorkspaceNotificationRule"`);
await queryRunner.query(
`DROP INDEX "public"."IDX_c68f38e2b2b061c40209e85bf2"`,
);
await queryRunner.query(`DROP TABLE "WorkspaceSetting"`);
await queryRunner.query(
`DROP INDEX "public"."IDX_73f5887268b09c0abccf04ef02"`,
);
await queryRunner.query(`DROP TABLE "WorkspaceProjectAuthToken"`);
await queryRunner.query(
`DROP INDEX "public"."IDX_4b7c7d1a8b2259df8c790db094"`,
);
await queryRunner.query(
`DROP INDEX "public"."IDX_bee888f5782b9585e01f13455f"`,
);
await queryRunner.query(`DROP TABLE "WorkspaceUserAuthToken"`);
}
}

View File

@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1739210586538 implements MigrationInterface {
public name = "MigrationName1739210586538";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "Alert" ADD "alertNumber" integer`);
await queryRunner.query(
`CREATE INDEX "IDX_aa91b2228a2b35424a3ae93fdc" ON "Alert" ("alertNumber") `,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "public"."IDX_aa91b2228a2b35424a3ae93fdc"`,
);
await queryRunner.query(`ALTER TABLE "Alert" DROP COLUMN "alertNumber"`);
}
}

View File

@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1739217257089 implements MigrationInterface {
public name = "MigrationName1739217257089";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" ADD "scheduledMaintenanceNumber" integer`,
);
await queryRunner.query(
`CREATE INDEX "IDX_207fe82fd8bdc67bbe1aa0ebf8" ON "ScheduledMaintenance" ("scheduledMaintenanceNumber") `,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "public"."IDX_207fe82fd8bdc67bbe1aa0ebf8"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" DROP COLUMN "scheduledMaintenanceNumber"`,
);
}
}

View File

@@ -0,0 +1,29 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1739282331053 implements MigrationInterface {
public name = "MigrationName1739282331053";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "Incident" ADD "postUpdatesToSlackChannelId" character varying(100)`,
);
await queryRunner.query(
`ALTER TABLE "Alert" ADD "postUpdatesToSlackChannelId" character varying(100)`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" ADD "postUpdatesToSlackChannelId" character varying(100)`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" DROP COLUMN "postUpdatesToSlackChannelId"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" DROP COLUMN "postUpdatesToSlackChannelId"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" DROP COLUMN "postUpdatesToSlackChannelId"`,
);
}
}

View File

@@ -0,0 +1,29 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1739374537088 implements MigrationInterface {
public name = "MigrationName1739374537088";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "Incident" RENAME COLUMN "postUpdatesToSlackChannelId" TO "postUpdatesToWorkspaceChannelName"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" RENAME COLUMN "postUpdatesToSlackChannelId" TO "postUpdatesToWorkspaceChannelName"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" RENAME COLUMN "postUpdatesToSlackChannelId" TO "postUpdatesToWorkspaceChannelName"`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToSlackChannelId"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToSlackChannelId"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToSlackChannelId"`,
);
}
}

View File

@@ -0,0 +1,65 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1739569321582 implements MigrationInterface {
public name = "MigrationName1739569321582";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "Incident" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" DROP COLUMN "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" ADD "postUpdatesToWorkspaceChannels" jsonb`,
);
await queryRunner.query(
`ALTER TABLE "Alert" DROP COLUMN "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" ADD "postUpdatesToWorkspaceChannels" jsonb`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" DROP COLUMN "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" ADD "postUpdatesToWorkspaceChannels" jsonb`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" DROP COLUMN "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" ADD "postUpdatesToWorkspaceChannels" character varying(100)`,
);
await queryRunner.query(
`ALTER TABLE "Alert" DROP COLUMN "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" ADD "postUpdatesToWorkspaceChannels" character varying(100)`,
);
await queryRunner.query(
`ALTER TABLE "Incident" DROP COLUMN "postUpdatesToWorkspaceChannels"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" ADD "postUpdatesToWorkspaceChannels" character varying(100)`,
);
await queryRunner.query(
`ALTER TABLE "ScheduledMaintenance" RENAME COLUMN "postUpdatesToWorkspaceChannels" TO "postUpdatesToWorkspaceChannelName"`,
);
await queryRunner.query(
`ALTER TABLE "Alert" RENAME COLUMN "postUpdatesToWorkspaceChannels" TO "postUpdatesToWorkspaceChannelName"`,
);
await queryRunner.query(
`ALTER TABLE "Incident" RENAME COLUMN "postUpdatesToWorkspaceChannels" TO "postUpdatesToWorkspaceChannelName"`,
);
}
}

View File

@@ -84,6 +84,27 @@ import { MigrationName1731435267537 } from "./1731435267537-MigrationName";
import { MigrationName1731435514287 } from "./1731435514287-MigrationName";
import { MigrationName1732553444010 } from "./1732553444010-MigrationName";
import { MigrationName1734435866602 } from "./1734435866602-MigrationName";
import { MigrationName1736364478985 } from "./1736364478985-MigrationName";
import { MigrationName1736364957990 } from "./1736364957990-MigrationName";
import { MigrationName1736365532085 } from "./1736365532085-MigrationName";
import { MigrationName1736675947746 } from "./1736675947746-MigrationName";
import { MigrationName1736703138918 } from "./1736703138918-MigrationName";
import { MigrationName1736780194077 } from "./1736780194077-MigrationName";
import { MigrationName1736780194078 } from "./1736780194078-MigrationName";
import { MigrationName1736787495707 } from "./1736787495707-MigrationName";
import { MigrationName1736787985322 } from "./1736787985322-MigrationName";
import { MigrationName1736788706141 } from "./1736788706141-MigrationName";
import { MigrationName1736856662868 } from "./1736856662868-MigrationName";
import { MigrationName1737141420441 } from "./1737141420441-MigrationName";
import { MigrationName1737713529424 } from "./1737713529424-MigrationName";
import { MigrationName1737715240684 } from "./1737715240684-MigrationName";
import { MigrationName1737997557974 } from "./1737997557974-MigrationName";
import { MigrationName1739209832500 } from "./1739209832500-MigrationName";
import { MigrationName1739210586538 } from "./1739210586538-MigrationName";
import { MigrationName1739217257089 } from "./1739217257089-MigrationName";
import { MigrationName1739282331053 } from "./1739282331053-MigrationName";
import { MigrationName1739374537088 } from "./1739374537088-MigrationName";
import { MigrationName1739569321582 } from "./1739569321582-MigrationName";
export default [
InitialMigration,
@@ -172,4 +193,25 @@ export default [
MigrationName1731435514287,
MigrationName1732553444010,
MigrationName1734435866602,
MigrationName1736364478985,
MigrationName1736364957990,
MigrationName1736365532085,
MigrationName1736675947746,
MigrationName1736703138918,
MigrationName1736780194077,
MigrationName1736780194078,
MigrationName1736787495707,
MigrationName1736787985322,
MigrationName1736788706141,
MigrationName1736856662868,
MigrationName1737141420441,
MigrationName1737713529424,
MigrationName1737715240684,
MigrationName1737997557974,
MigrationName1739209832500,
MigrationName1739210586538,
MigrationName1739217257089,
MigrationName1739282331053,
MigrationName1739374537088,
MigrationName1739569321582,
];

View File

@@ -0,0 +1,60 @@
import {
ExpressResponse,
NextFunction,
OneUptimeRequest,
} from "../Utils/Express";
import Response from "../Utils/Response";
import BadDataException from "Common/Types/Exception/BadDataException";
import { SlackAppSigningSecret } from "../EnvironmentConfig";
import crypto from "crypto";
import logger from "../Utils/Logger";
export default class SlackAuthorization {
public static async isAuthorizedSlackRequest(
req: OneUptimeRequest,
res: ExpressResponse,
next: NextFunction,
): Promise<void> {
if (!SlackAppSigningSecret) {
return Response.sendErrorResponse(
req,
res,
new BadDataException(
"SLACK_APP_SIGNING_SECRET env variable not found.",
),
);
}
// validate slack signing secret
const slackSigningSecret: string = SlackAppSigningSecret.toString();
const slackSignature: string = req.headers["x-slack-signature"] as string;
const timestamp: string = req.headers[
"x-slack-request-timestamp"
] as string;
const requestBody: string = req.body;
logger.debug(`slackSignature: ${slackSignature}`);
logger.debug(`timestamp: ${timestamp}`);
logger.debug(`requestBody: ${requestBody}`);
const baseString: string = `v0:${timestamp}:${requestBody}`;
const signature: string = `v0=${crypto.createHmac("sha256", slackSigningSecret).update(baseString).digest("hex")}`;
// check if the signature is valid
if (
!crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(slackSignature),
)
) {
return Response.sendErrorResponse(
req,
res,
new BadDataException("Slack Signature Verification Failed."),
);
}
next();
}
}

View File

@@ -8,6 +8,8 @@ import {
} from "../../Server/Utils/Express";
import TelemetryIngestionKeyService from "../../Server/Services/TelemetryIngestionKeyService";
import TelemetryIngestionKey from "../../Models/DatabaseModels/TelemetryIngestionKey";
import Response from "../Utils/Response";
import logger from "../Utils/Logger";
export interface TelemetryRequest extends ExpressRequest {
projectId: ObjectID; // Project ID
@@ -17,12 +19,14 @@ export interface TelemetryRequest extends ExpressRequest {
export default class TelemetryIngest {
public static async isAuthorizedServiceMiddleware(
req: ExpressRequest,
_res: ExpressResponse,
res: ExpressResponse,
next: NextFunction,
): Promise<void> {
try {
// check header.
const isOpenTelemetryAPI: boolean = req.path.includes("/otlp/v1");
let oneuptimeToken: string | undefined = req.headers[
"x-oneuptime-token"
] as string | undefined;
@@ -35,6 +39,14 @@ export default class TelemetryIngest {
}
if (!oneuptimeToken) {
logger.error("Missing header: x-oneuptime-token");
if (isOpenTelemetryAPI) {
// then accept the response and return success.
// do not return error because it causes Otel to retry the request.
return Response.sendEmptySuccessResponse(req, res);
}
throw new BadRequestException("Missing header: x-oneuptime-token");
}
@@ -54,6 +66,14 @@ export default class TelemetryIngest {
});
if (!token) {
logger.error("Invalid service token: " + oneuptimeToken);
if (isOpenTelemetryAPI) {
// then accept the response and return success.
// do not return error because it causes Otel to retry the request.
return Response.sendEmptySuccessResponse(req, res);
}
throw new BadRequestException(
"Invalid service token: " + oneuptimeToken,
);
@@ -62,6 +82,16 @@ export default class TelemetryIngest {
projectId = token.projectId as ObjectID;
if (!projectId) {
logger.error(
"Project ID not found for service token: " + oneuptimeToken,
);
if (isOpenTelemetryAPI) {
// then accept the response and return success.
// do not return error because it causes Otel to retry the request.
return Response.sendEmptySuccessResponse(req, res);
}
throw new BadRequestException(
"Project ID not found for service token: " + oneuptimeToken,
);

View File

@@ -0,0 +1,88 @@
import { Blue500 } from "../../Types/BrandColors";
import Color from "../../Types/Color";
import OneUptimeDate from "../../Types/Date";
import BadDataException from "../../Types/Exception/BadDataException";
import ObjectID from "../../Types/ObjectID";
import { IsBillingEnabled } from "../EnvironmentConfig";
import logger from "../Utils/Logger";
import DatabaseService from "./DatabaseService";
import Model, {
AlertFeedEventType,
} from "Common/Models/DatabaseModels/AlertFeed";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
if (IsBillingEnabled) {
this.hardDeleteItemsOlderThanInDays("createdAt", 120);
}
}
public async createAlertFeed(data: {
alertId: ObjectID;
feedInfoInMarkdown: string;
alertFeedEventType: AlertFeedEventType;
projectId: ObjectID;
moreInformationInMarkdown?: string | undefined;
displayColor?: Color | undefined;
userId?: ObjectID | undefined;
postedAt?: Date | undefined;
}): Promise<void> {
try {
if (!data.alertId) {
throw new BadDataException("Alert ID is required");
}
if (!data.feedInfoInMarkdown) {
throw new BadDataException("Log in markdown is required");
}
if (!data.alertFeedEventType) {
throw new BadDataException("Alert log event is required");
}
if (!data.projectId) {
throw new BadDataException("Project ID is required");
}
const alertFeed: Model = new Model();
if (!data.displayColor) {
data.displayColor = Blue500;
}
if (data.userId) {
alertFeed.userId = data.userId;
}
alertFeed.displayColor = data.displayColor;
alertFeed.alertId = data.alertId;
alertFeed.feedInfoInMarkdown = data.feedInfoInMarkdown;
alertFeed.alertFeedEventType = data.alertFeedEventType;
alertFeed.projectId = data.projectId;
if (!data.postedAt) {
alertFeed.postedAt = OneUptimeDate.getCurrentDate();
}
if (data.moreInformationInMarkdown) {
alertFeed.moreInformationInMarkdown = data.moreInformationInMarkdown;
}
await this.create({
data: alertFeed,
props: {
isRoot: true,
},
});
} catch (error) {
logger.error("AlertFeedService.createAlertFeed");
logger.error(error);
// we dont want to throw the error here, as this is a non-critical operation
}
}
}
export default new Service();

View File

@@ -1,10 +1,83 @@
import ObjectID from "../../Types/ObjectID";
import DatabaseService from "./DatabaseService";
import Model from "Common/Models/DatabaseModels/AlertInternalNote";
import { OnCreate, OnUpdate } from "../Types/Database/Hooks";
import AlertFeedService from "./AlertFeedService";
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
import { Blue500 } from "../../Types/BrandColors";
import { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
}
public override async onCreateSuccess(
_onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
const userId: ObjectID | null | undefined =
createdItem.createdByUserId || createdItem.createdByUser?.id;
await AlertFeedService.createAlertFeed({
alertId: createdItem.alertId!,
projectId: createdItem.projectId!,
alertFeedEventType: AlertFeedEventType.PrivateNote,
displayColor: Blue500,
userId: userId || undefined,
feedInfoInMarkdown: `**Posted Internal / Private Note**
${createdItem.note}
`,
});
return createdItem;
}
public override async onUpdateSuccess(
onUpdate: OnUpdate<Model>,
_updatedItemIds: Array<ObjectID>,
): Promise<OnUpdate<Model>> {
if (onUpdate.updateBy.data.note) {
const updatedItems: Array<Model> = await this.findBy({
query: onUpdate.updateBy.query,
limit: LIMIT_PER_PROJECT,
skip: 0,
props: {
isRoot: true,
},
select: {
alertId: true,
projectId: true,
note: true,
createdByUserId: true,
createdByUser: {
_id: true,
},
},
});
const userId: ObjectID | null | undefined =
onUpdate.updateBy.props.userId;
for (const updatedItem of updatedItems) {
await AlertFeedService.createAlertFeed({
alertId: updatedItem.alertId!,
projectId: updatedItem.projectId!,
alertFeedEventType: AlertFeedEventType.PrivateNote,
displayColor: Blue500,
userId: userId || undefined,
feedInfoInMarkdown: `**Updated Internal / Private Note**
${updatedItem.note}
`,
});
}
}
return onUpdate;
}
}
export default new Service();

View File

@@ -1,10 +1,122 @@
import Team from "../../Models/DatabaseModels/Team";
import ObjectID from "../../Types/ObjectID";
import DeleteBy from "../Types/Database/DeleteBy";
import { OnCreate, OnDelete } from "../Types/Database/Hooks";
import DatabaseService from "./DatabaseService";
import Model from "Common/Models/DatabaseModels/AlertOwnerTeam";
import TeamService from "./TeamService";
import AlertFeedService from "./AlertFeedService";
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
import { Gray500, Red500 } from "../../Types/BrandColors";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
}
protected override async onBeforeDelete(
deleteBy: DeleteBy<Model>,
): Promise<OnDelete<Model>> {
const itemsToDelete: Model[] = await this.findBy({
query: deleteBy.query,
limit: deleteBy.limit,
skip: deleteBy.skip,
props: {
isRoot: true,
},
select: {
alertId: true,
projectId: true,
teamId: true,
},
});
return {
carryForward: {
itemsToDelete: itemsToDelete,
},
deleteBy: deleteBy,
};
}
protected override async onDeleteSuccess(
onDelete: OnDelete<Model>,
_itemIdsBeforeDelete: Array<ObjectID>,
): Promise<OnDelete<Model>> {
const deleteByUserId: ObjectID | undefined =
onDelete.deleteBy.deletedByUser?.id || onDelete.deleteBy.props.userId;
const itemsToDelete: Model[] = onDelete.carryForward.itemsToDelete;
for (const item of itemsToDelete) {
const alertId: ObjectID | undefined = item.alertId;
const projectId: ObjectID | undefined = item.projectId;
const teamId: ObjectID | undefined = item.teamId;
if (alertId && teamId && projectId) {
const team: Team | null = await TeamService.findOneById({
id: teamId,
select: {
name: true,
},
props: {
isRoot: true,
},
});
if (team && team.name) {
await AlertFeedService.createAlertFeed({
alertId: alertId,
projectId: projectId,
alertFeedEventType: AlertFeedEventType.OwnerTeamRemoved,
displayColor: Red500,
feedInfoInMarkdown: `**Team ${team.name}** was removed from the alert as the owner.`,
userId: deleteByUserId || undefined,
});
}
}
}
return onDelete;
}
public override async onCreateSuccess(
onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
// add alert feed.
const alertId: ObjectID | undefined = createdItem.alertId;
const projectId: ObjectID | undefined = createdItem.projectId;
const teamId: ObjectID | undefined = createdItem.teamId;
const createdByUserId: ObjectID | undefined =
createdItem.createdByUserId || onCreate.createBy.props.userId;
if (alertId && teamId && projectId) {
const team: Team | null = await TeamService.findOneById({
id: teamId,
select: {
name: true,
},
props: {
isRoot: true,
},
});
if (team && team.name) {
await AlertFeedService.createAlertFeed({
alertId: alertId,
projectId: projectId,
alertFeedEventType: AlertFeedEventType.OwnerTeamAdded,
displayColor: Gray500,
feedInfoInMarkdown: `**Team ${team.name}** was added to the alert as the owner.`,
userId: createdByUserId || undefined,
});
}
}
return createdItem;
}
}
export default new Service();

View File

@@ -1,10 +1,124 @@
import User from "../../Models/DatabaseModels/User";
import ObjectID from "../../Types/ObjectID";
import DeleteBy from "../Types/Database/DeleteBy";
import { OnCreate, OnDelete } from "../Types/Database/Hooks";
import DatabaseService from "./DatabaseService";
import Model from "Common/Models/DatabaseModels/AlertOwnerUser";
import UserService from "./UserService";
import AlertFeedService from "./AlertFeedService";
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
import { Gray500, Red500 } from "../../Types/BrandColors";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
}
protected override async onBeforeDelete(
deleteBy: DeleteBy<Model>,
): Promise<OnDelete<Model>> {
const itemsToDelete: Model[] = await this.findBy({
query: deleteBy.query,
limit: deleteBy.limit,
skip: deleteBy.skip,
props: {
isRoot: true,
},
select: {
alertId: true,
projectId: true,
userId: true,
},
});
return {
carryForward: {
itemsToDelete: itemsToDelete,
},
deleteBy: deleteBy,
};
}
protected override async onDeleteSuccess(
onDelete: OnDelete<Model>,
_itemIdsBeforeDelete: Array<ObjectID>,
): Promise<OnDelete<Model>> {
const deleteByUserId: ObjectID | undefined =
onDelete.deleteBy.deletedByUser?.id || onDelete.deleteBy.props.userId;
const itemsToDelete: Model[] = onDelete.carryForward.itemsToDelete;
for (const item of itemsToDelete) {
const alertId: ObjectID | undefined = item.alertId;
const projectId: ObjectID | undefined = item.projectId;
const userId: ObjectID | undefined = item.userId;
if (alertId && userId && projectId) {
const user: User | null = await UserService.findOneById({
id: userId,
select: {
name: true,
email: true,
},
props: {
isRoot: true,
},
});
if (user && user.name) {
await AlertFeedService.createAlertFeed({
alertId: alertId,
projectId: projectId,
alertFeedEventType: AlertFeedEventType.OwnerUserRemoved,
displayColor: Red500,
feedInfoInMarkdown: `**${user.name.toString()}** (${user.email?.toString()}) was removed from the alert as the owner.`,
userId: deleteByUserId || undefined,
});
}
}
}
return onDelete;
}
public override async onCreateSuccess(
onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
// add alert feed.
const alertId: ObjectID | undefined = createdItem.alertId;
const projectId: ObjectID | undefined = createdItem.projectId;
const userId: ObjectID | undefined = createdItem.userId;
const createdByUserId: ObjectID | undefined =
createdItem.createdByUserId || onCreate.createBy.props.userId;
if (alertId && userId && projectId) {
const user: User | null = await UserService.findOneById({
id: userId,
select: {
name: true,
email: true,
},
props: {
isRoot: true,
},
});
if (user && user.name) {
await AlertFeedService.createAlertFeed({
alertId: alertId,
projectId: projectId,
alertFeedEventType: AlertFeedEventType.OwnerUserAdded,
displayColor: Gray500,
feedInfoInMarkdown: `**${user.name.toString()}** (${user.email?.toString()}) was added to the alert as the owner.`,
userId: createdByUserId || undefined,
});
}
}
return createdItem;
}
}
export default new Service();

View File

@@ -38,6 +38,13 @@ import Metric, {
ServiceType,
} from "../../Models/AnalyticsModels/Metric";
import AlertMetricType from "../../Types/Alerts/AlertMetricType";
import AlertFeedService from "./AlertFeedService";
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
import { Gray500, Red500 } from "../../Types/BrandColors";
import Label from "../../Models/DatabaseModels/Label";
import LabelService from "./LabelService";
import AlertSeverity from "../../Models/DatabaseModels/AlertSeverity";
import AlertSeverityService from "./AlertSeverityService";
export class Service extends DatabaseService<Model> {
public constructor() {
@@ -91,6 +98,32 @@ export class Service extends DatabaseService<Model> {
return false;
}
public async getExistingAlertNumberForProject(data: {
projectId: ObjectID;
}): Promise<number> {
// get last alert number.
const lastAlert: Model | null = await this.findOneBy({
query: {
projectId: data.projectId,
},
select: {
alertNumber: true,
},
sort: {
createdAt: SortOrder.Descending,
},
props: {
isRoot: true,
},
});
if (!lastAlert) {
return 0;
}
return lastAlert.alertNumber || 0;
}
public async acknowledgeAlert(
alertId: ObjectID,
acknowledgedByUserId: ObjectID,
@@ -149,9 +182,12 @@ export class Service extends DatabaseService<Model> {
throw new BadDataException("ProjectId required to create alert.");
}
const projectId: ObjectID =
createBy.props.tenantId || createBy.data.projectId!;
const alertState: AlertState | null = await AlertStateService.findOneBy({
query: {
projectId: createBy.props.tenantId || createBy.data.projectId!,
projectId: projectId,
isCreatedState: true,
},
select: {
@@ -170,6 +206,13 @@ export class Service extends DatabaseService<Model> {
createBy.data.currentAlertStateId = alertState.id;
const alertNumberForThisAlert: number =
(await this.getExistingAlertNumberForProject({
projectId: projectId,
})) + 1;
createBy.data.alertNumber = alertNumberForThisAlert;
if (
(createBy.data.createdByUserId ||
createBy.data.createdByUser ||
@@ -224,6 +267,48 @@ export class Service extends DatabaseService<Model> {
throw new BadDataException("currentAlertStateId is required");
}
const createdByUserId: ObjectID | undefined | null =
createdItem.createdByUserId || createdItem.createdByUser?.id;
await AlertFeedService.createAlertFeed({
alertId: createdItem.id!,
projectId: createdItem.projectId!,
alertFeedEventType: AlertFeedEventType.AlertCreated,
displayColor: Red500,
feedInfoInMarkdown: `**Alert #${createdItem.alertNumber?.toString()} Created**:
**Alert Title**:
${createdItem.title || "No title provided."}
**Description**:
${createdItem.description || "No description provided."}
`,
userId: createdByUserId || undefined,
});
await AlertFeedService.createAlertFeed({
alertId: createdItem.id!,
projectId: createdItem.projectId!,
alertFeedEventType: AlertFeedEventType.RootCause,
displayColor: Red500,
feedInfoInMarkdown: `**Root Cause**
${createdItem.rootCause || "No root cause provided."}`,
});
await AlertFeedService.createAlertFeed({
alertId: createdItem.id!,
projectId: createdItem.projectId!,
alertFeedEventType: AlertFeedEventType.RemediationNotes,
displayColor: Red500,
feedInfoInMarkdown: `**Remediation Notes**
${createdItem.remediationNotes || "No remediation notes provided."}`,
});
await this.changeAlertState({
projectId: createdItem.projectId,
alertId: createdItem.id,
@@ -445,6 +530,140 @@ export class Service extends DatabaseService<Model> {
}
}
if (updatedItemIds.length > 0) {
for (const alertId of updatedItemIds) {
let shouldAddAlertFeed: boolean = false;
let feedInfoInMarkdown: string = "**Alert was updated.**";
const createdByUserId: ObjectID | undefined | null =
onUpdate.updateBy.props.userId;
if (onUpdate.updateBy.data.title) {
// add alert feed.
feedInfoInMarkdown += `\n\n**Title**:
${onUpdate.updateBy.data.title || "No title provided."}
`;
shouldAddAlertFeed = true;
}
if (onUpdate.updateBy.data.rootCause) {
if (onUpdate.updateBy.data.title) {
// add alert feed.
feedInfoInMarkdown += `\n\n**Root Cause**:
${onUpdate.updateBy.data.rootCause || "No root cause provided."}
`;
shouldAddAlertFeed = true;
}
}
if (onUpdate.updateBy.data.description) {
// add alert feed.
feedInfoInMarkdown += `\n\n**Alert Description**:
${onUpdate.updateBy.data.description || "No description provided."}
`;
shouldAddAlertFeed = true;
}
if (onUpdate.updateBy.data.remediationNotes) {
// add alert feed.
feedInfoInMarkdown += `\n\n**Remediation Notes**:
${onUpdate.updateBy.data.remediationNotes || "No remediation notes provided."}
`;
shouldAddAlertFeed = true;
}
if (
onUpdate.updateBy.data.labels &&
onUpdate.updateBy.data.labels.length > 0 &&
Array.isArray(onUpdate.updateBy.data.labels)
) {
const labelIds: Array<ObjectID> = (
onUpdate.updateBy.data.labels as any
)
.map((label: Label) => {
if (label._id) {
return new ObjectID(label._id?.toString());
}
return null;
})
.filter((labelId: ObjectID | null) => {
return labelId !== null;
});
const labels: Array<Label> = await LabelService.findBy({
query: {
_id: QueryHelper.any(labelIds),
},
select: {
name: true,
},
limit: LIMIT_PER_PROJECT,
skip: 0,
props: {
isRoot: true,
},
});
if (labels.length > 0) {
feedInfoInMarkdown += `\n\n**Labels**:
${labels
.map((label: Label) => {
return `- ${label.name}`;
})
.join("\n")}
`;
shouldAddAlertFeed = true;
}
}
if (
onUpdate.updateBy.data.alertSeverity &&
(onUpdate.updateBy.data.alertSeverity as any)._id
) {
const alertSeverity: AlertSeverity | null =
await AlertSeverityService.findOneBy({
query: {
_id: new ObjectID(
(onUpdate.updateBy.data.alertSeverity as any)?._id.toString(),
),
},
select: {
name: true,
},
props: {
isRoot: true,
},
});
if (alertSeverity) {
feedInfoInMarkdown += `\n\n**Alert Severity**:
${alertSeverity.name}
`;
shouldAddAlertFeed = true;
}
}
if (shouldAddAlertFeed) {
await AlertFeedService.createAlertFeed({
alertId: alertId,
projectId: onUpdate.updateBy.props.tenantId as ObjectID,
alertFeedEventType: AlertFeedEventType.AlertUpdated,
displayColor: Gray500,
feedInfoInMarkdown: feedInfoInMarkdown,
userId: createdByUserId || undefined,
});
}
}
}
return onUpdate;
}

View File

@@ -19,6 +19,8 @@ import { JSONObject } from "../../Types/JSON";
import AlertInternalNote from "../../Models/DatabaseModels/AlertInternalNote";
import AlertInternalNoteService from "./AlertInternalNoteService";
import logger from "../Utils/Logger";
import AlertFeedService from "./AlertFeedService";
import { AlertFeedEventType } from "../../Models/DatabaseModels/AlertFeed";
export class Service extends DatabaseService<AlertStateTimeline> {
public constructor() {
@@ -130,10 +132,15 @@ export class Service extends DatabaseService<AlertStateTimeline> {
});
}
const privateNote: string | undefined = (
createBy.miscDataProps as JSONObject | undefined
)?.["privateNote"] as string | undefined;
return {
createBy,
carryForward: {
lastAlertStateTimelineId: lastAlertStateTimeline?.id || null,
privateNote: privateNote,
},
};
}
@@ -164,6 +171,36 @@ export class Service extends DatabaseService<AlertStateTimeline> {
});
}
const alertState: AlertState | null = await AlertStateService.findOneBy({
query: {
_id: createdItem.alertStateId.toString()!,
},
props: {
isRoot: true,
},
select: {
_id: true,
isResolvedState: true,
isAcknowledgedState: true,
isCreatedState: true,
color: true,
name: true,
},
});
const stateName: string = alertState?.name || "";
await AlertFeedService.createAlertFeed({
alertId: createdItem.alertId!,
projectId: createdItem.projectId!,
alertFeedEventType: AlertFeedEventType.AlertStateChanged,
displayColor: alertState?.color,
feedInfoInMarkdown: "**Alert State** changed to **" + stateName + "**",
moreInformationInMarkdown: `**Cause:**
${createdItem.rootCause}`,
userId: createdItem.createdByUserId || onCreate.createBy.props.userId,
});
await AlertService.updateOneBy({
query: {
_id: createdItem.alertId?.toString(),
@@ -174,6 +211,21 @@ export class Service extends DatabaseService<AlertStateTimeline> {
props: onCreate.createBy.props,
});
if (onCreate.carryForward.privateNote) {
const privateNote: string = onCreate.carryForward.privateNote;
const alertInternalNote: AlertInternalNote = new AlertInternalNote();
alertInternalNote.alertId = createdItem.alertId;
alertInternalNote.note = privateNote;
alertInternalNote.createdAt = createdItem.startsAt!;
alertInternalNote.projectId = createdItem.projectId!;
await AlertInternalNoteService.create({
data: alertInternalNote,
props: onCreate.createBy.props,
});
}
AlertService.refreshAlertMetrics({
alertId: createdItem.alertId,
}).catch((error: Error) => {

View File

@@ -29,7 +29,7 @@ import logger from "../Utils/Logger";
import Realtime from "../Utils/Realtime";
import StreamUtil from "../Utils/Stream";
import BaseService from "./BaseService";
import { ExecResult } from "@clickhouse/client";
import { ExecResult, ResponseJSON, ResultSet } from "@clickhouse/client";
import AnalyticsBaseModel from "Common/Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel";
import { WorkflowRoute } from "Common/ServiceRoute";
import Protocol from "../../Types/API/Protocol";
@@ -148,19 +148,29 @@ export default class AnalyticsDatabaseService<
const countStatement: Statement = this.toCountStatement(countBy);
const dbResult: ExecResult<Stream> = await this.execute(countStatement);
const dbResult: ResultSet<"JSON"> =
await this.executeQuery(countStatement);
const strResult: string = await StreamUtil.convertStreamToText(
dbResult.stream,
);
logger.debug(`${this.model.tableName} Count Statement executed`);
logger.debug(countStatement);
let countPositive: PositiveNumber = new PositiveNumber(strResult || 0);
if (countBy.groupBy && Object.keys(countBy.groupBy).length > 0) {
// this usually happens when group by is used. In this case we count the total number of groups and not rows in those groups.
countPositive = new PositiveNumber(strResult.split("\n").length - 1); // -1 because the last line is empty.
const resultInJSON: ResponseJSON<JSONObject> =
await dbResult.json<JSONObject>();
let countPositive: PositiveNumber = new PositiveNumber(0);
if (
resultInJSON.data &&
resultInJSON.data[0] &&
resultInJSON.data[0]["count()"] &&
typeof resultInJSON.data[0]["count()"] === "string"
) {
countPositive = new PositiveNumber(
resultInJSON.data[0]["count()"] as string,
);
}
logger.debug(`Result: `);
logger.debug(countPositive.toNumber());
countPositive = await this.onCountSuccess(countPositive);
return countPositive;
} catch (error) {
@@ -240,20 +250,18 @@ export default class AnalyticsDatabaseService<
columns: Array<string>;
} = this.toAggregateStatement(aggregateBy);
const dbResult: ExecResult<Stream> = await this.execute(
const dbResult: ResultSet<"JSON"> = await this.executeQuery(
findStatement.statement,
);
const strResult: string = await StreamUtil.convertStreamToText(
dbResult.stream,
);
logger.debug(`${this.model.tableName} Aggregate Statement executed`);
const jsonItems: Array<JSONObject> = this.convertSelectReturnedDataToJson(
strResult,
findStatement.columns,
);
const responseJSON: ResponseJSON<JSONObject> =
await dbResult.json<JSONObject>();
const items: Array<JSONObject> = jsonItems as any;
const items: Array<JSONObject> = responseJSON.data
? responseJSON.data
: [];
const aggregatedItems: Array<AggregatedModel> = [];
@@ -314,16 +322,6 @@ export default class AnalyticsDatabaseService<
}
}
public async executeQuery(query: string): Promise<string> {
const dbResult: ExecResult<Stream> = await this.execute(query);
const strResult: string = await StreamUtil.convertStreamToText(
dbResult.stream,
);
return strResult;
}
private async _findBy(
findBy: FindBy<TBaseModel>,
): Promise<Array<TBaseModel>> {
@@ -379,21 +377,17 @@ export default class AnalyticsDatabaseService<
columns: Array<string>;
} = this.toFindStatement(onBeforeFind);
const dbResult: ExecResult<Stream> = await this.execute(
const dbResult: ResultSet<"JSON"> = await this.executeQuery(
findStatement.statement,
);
logger.debug(`${this.model.tableName} Find Statement executed`);
logger.debug(findStatement.statement);
const strResult: string = await StreamUtil.convertStreamToText(
dbResult.stream,
);
const responseJSON: ResponseJSON<JSONObject> =
await dbResult.json<JSONObject>();
const jsonItems: Array<JSONObject> = this.convertSelectReturnedDataToJson(
strResult,
findStatement.columns,
);
const jsonItems: Array<JSONObject> = responseJSON.data;
let items: Array<TBaseModel> =
AnalyticsBaseModel.fromJSONArray<TBaseModel>(jsonItems, this.modelType);
@@ -411,7 +405,7 @@ export default class AnalyticsDatabaseService<
}
}
private convertSelectReturnedDataToJson(
public convertSelectReturnedDataToJson(
strResult: string,
columns: string[],
): JSONObject[] {
@@ -815,6 +809,24 @@ export default class AnalyticsDatabaseService<
) as ExecResult<Stream>;
}
public async executeQuery(
statement: Statement | string,
): Promise<ResultSet<"JSON">> {
if (!this.databaseClient) {
this.useDefaultDatabase();
}
const query: string = statement instanceof Statement ? statement.query : statement;
const queryParams: Record<string, unknown> | undefined = statement instanceof Statement ? statement.query_params : undefined;
return await this.databaseClient.query({
query: query,
format: "JSON",
query_params: queryParams || undefined as any, // undefined is not specified in the type for query_params, but its ok to pass undefined.
})
}
protected async onUpdateSuccess(
onUpdate: OnUpdate<TBaseModel>,
_updatedItemIds: Array<ObjectID>,

View File

@@ -10,6 +10,11 @@ import Model, {
InvoiceStatus,
} from "Common/Models/DatabaseModels/BillingInvoice";
import Project from "Common/Models/DatabaseModels/Project";
import SubscriptionStatus from "../../Types/Billing/SubscriptionStatus";
import ObjectID from "../../Types/ObjectID";
import Semaphore, { SemaphoreMutex } from "../Infrastructure/Semaphore";
import logger from "../Utils/Logger";
import OneUptimeDate from "../../Types/Date";
export class Service extends DatabaseService<Model> {
public constructor() {
@@ -17,6 +22,166 @@ export class Service extends DatabaseService<Model> {
this.setDoNotAllowDelete(true);
}
public async refreshSubscriptionStatus(data: {
projectId: ObjectID;
}): Promise<void> {
let mutex: SemaphoreMutex | null = null;
try {
mutex = await Semaphore.lock({
key: data.projectId.toString(),
namespace: "BillingInoviceService.refreshSubscriptionStatus",
lockTimeout: 15000,
acquireTimeout: 20000,
});
logger.debug(
"Mutex acquired - " +
data.projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
} catch (err) {
logger.debug(
"Mutex acquire failed - " +
data.projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
logger.error(err);
}
let project: Project | null = await ProjectService.findOneById({
id: data.projectId,
props: {
isRoot: true,
},
select: {
_id: true,
paymentProviderCustomerId: true,
paymentProviderSubscriptionId: true,
paymentProviderMeteredSubscriptionId: true,
},
});
// refresh the subscription status. This is a hack to ensure that the subscription status is always up to date.
// This is because the subscription status can change at any time and we need to ensure that the subscription status is always up to date.
if (!project) {
throw new BadDataException("Project not found");
}
if (!project.paymentProviderCustomerId) {
throw new BadDataException("Payment provider customer id not found.");
}
let subscriptionState: SubscriptionStatus =
await BillingService.getSubscriptionStatus(
project.paymentProviderSubscriptionId as string,
);
let meteredSubscriptionState: SubscriptionStatus =
await BillingService.getSubscriptionStatus(
project.paymentProviderMeteredSubscriptionId as string,
);
// update the project.
await ProjectService.updateOneById({
id: project.id!,
data: {
paymentProviderSubscriptionStatus: subscriptionState,
paymentProviderMeteredSubscriptionStatus: meteredSubscriptionState,
},
props: {
isRoot: true,
ignoreHooks: true,
},
});
if (
meteredSubscriptionState === SubscriptionStatus.Canceled ||
subscriptionState === SubscriptionStatus.Canceled
) {
// check if all invoices are paid. If yes, then reactivate the subscription.
const invoices: Array<Invoice> = await BillingService.getInvoices(
project.paymentProviderCustomerId,
);
let allInvoicesPaid: boolean = true;
for (const invoice of invoices) {
if (
invoice.status === InvoiceStatus.Open ||
invoice.status === InvoiceStatus.Uncollectible
) {
allInvoicesPaid = false;
break;
}
}
if (allInvoicesPaid) {
await ProjectService.reactiveSubscription(project.id!);
project = await ProjectService.findOneById({
id: data.projectId,
props: {
isRoot: true,
},
select: {
_id: true,
paymentProviderCustomerId: true,
paymentProviderSubscriptionId: true,
paymentProviderMeteredSubscriptionId: true,
},
});
if (!project) {
throw new BadDataException("Project not found");
}
subscriptionState = await BillingService.getSubscriptionStatus(
project.paymentProviderSubscriptionId as string,
);
meteredSubscriptionState = await BillingService.getSubscriptionStatus(
project.paymentProviderMeteredSubscriptionId as string,
);
await ProjectService.updateOneById({
id: project.id!,
data: {
paymentProviderSubscriptionStatus: subscriptionState,
paymentProviderMeteredSubscriptionStatus: meteredSubscriptionState,
},
props: {
isRoot: true,
ignoreHooks: true,
},
});
}
}
if (mutex) {
try {
await Semaphore.release(mutex);
logger.debug(
"Mutex released - " +
data.projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
} catch (err) {
logger.debug(
"Mutex release failed - " +
data.projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
logger.error(err);
}
}
}
protected override async onBeforeFind(
findBy: FindBy<Model>,
): Promise<OnFind<Model>> {
@@ -37,6 +202,11 @@ export class Service extends DatabaseService<Model> {
},
});
// refresh the subscription status. This is a hack to ensure that the subscription status is always up to date.
// This is because the subscription status can change at any time and we need to ensure that the subscription status is always up to date.
await this.refreshSubscriptionStatus({ projectId: findBy.props.tenantId! });
if (!project) {
throw new BadDataException("Project not found");
}

View File

@@ -0,0 +1,94 @@
import { Blue500 } from "../../Types/BrandColors";
import Color from "../../Types/Color";
import OneUptimeDate from "../../Types/Date";
import BadDataException from "../../Types/Exception/BadDataException";
import ObjectID from "../../Types/ObjectID";
import { IsBillingEnabled } from "../EnvironmentConfig";
import logger from "../Utils/Logger";
import DatabaseService from "./DatabaseService";
import IncidentFeed, {
IncidentFeedEventType,
} from "Common/Models/DatabaseModels/IncidentFeed";
export class Service extends DatabaseService<IncidentFeed> {
public constructor() {
super(IncidentFeed);
if (IsBillingEnabled) {
this.hardDeleteItemsOlderThanInDays("createdAt", 120);
}
}
public async createIncidentFeed(data: {
incidentId: ObjectID;
feedInfoInMarkdown: string;
incidentFeedEventType: IncidentFeedEventType;
projectId: ObjectID;
moreInformationInMarkdown?: string | undefined;
displayColor?: Color | undefined;
userId?: ObjectID | undefined;
postedAt?: Date | undefined;
}): Promise<void> {
try {
logger.debug("IncidentFeedService.createIncidentFeed");
logger.debug(data);
const incidentFeed: IncidentFeed = new IncidentFeed();
if (!data.incidentId) {
throw new BadDataException("Incident ID is required");
}
if (!data.feedInfoInMarkdown) {
throw new BadDataException("Log in markdown is required");
}
if (!data.incidentFeedEventType) {
throw new BadDataException("Incident log event is required");
}
if (!data.projectId) {
throw new BadDataException("Project ID is required");
}
if (!data.displayColor) {
data.displayColor = Blue500;
}
incidentFeed.displayColor = data.displayColor;
incidentFeed.incidentId = data.incidentId;
incidentFeed.feedInfoInMarkdown = data.feedInfoInMarkdown;
incidentFeed.incidentFeedEventType = data.incidentFeedEventType;
incidentFeed.projectId = data.projectId;
if (!data.postedAt) {
incidentFeed.postedAt = OneUptimeDate.getCurrentDate();
}
if (data.userId) {
incidentFeed.userId = data.userId;
}
if (data.moreInformationInMarkdown) {
incidentFeed.moreInformationInMarkdown = data.moreInformationInMarkdown;
}
const createdIncidentFeed: IncidentFeed = await this.create({
data: incidentFeed,
props: {
isRoot: true,
},
});
logger.debug("Incident Feed created");
logger.debug(createdIncidentFeed);
} catch (e) {
logger.error("Error in creating incident feed");
logger.error(e);
// we dont throw this error as it is not a critical error
}
}
}
export default new Service();

View File

@@ -1,10 +1,83 @@
import ObjectID from "../../Types/ObjectID";
import DatabaseService from "./DatabaseService";
import Model from "Common/Models/DatabaseModels/IncidentInternalNote";
import { OnCreate, OnUpdate } from "../Types/Database/Hooks";
import IncidentFeedService from "./IncidentFeedService";
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
import { Blue500 } from "../../Types/BrandColors";
import { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
}
public override async onCreateSuccess(
_onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
const userId: ObjectID | null | undefined =
createdItem.createdByUserId || createdItem.createdByUser?.id;
await IncidentFeedService.createIncidentFeed({
incidentId: createdItem.incidentId!,
projectId: createdItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.PrivateNote,
displayColor: Blue500,
userId: userId || undefined,
feedInfoInMarkdown: `**Posted Internal / Private Note**
${createdItem.note}
`,
});
return createdItem;
}
public override async onUpdateSuccess(
onUpdate: OnUpdate<Model>,
_updatedItemIds: Array<ObjectID>,
): Promise<OnUpdate<Model>> {
if (onUpdate.updateBy.data.note) {
const updatedItems: Array<Model> = await this.findBy({
query: onUpdate.updateBy.query,
limit: LIMIT_PER_PROJECT,
skip: 0,
props: {
isRoot: true,
},
select: {
incidentId: true,
projectId: true,
note: true,
createdByUserId: true,
createdByUser: {
_id: true,
},
},
});
const userId: ObjectID | null | undefined =
onUpdate.updateBy.props.userId;
for (const updatedItem of updatedItems) {
await IncidentFeedService.createIncidentFeed({
incidentId: updatedItem.incidentId!,
projectId: updatedItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.PrivateNote,
displayColor: Blue500,
userId: userId || undefined,
feedInfoInMarkdown: `**Updated Internal / Private Note**
${updatedItem.note}
`,
});
}
}
return onUpdate;
}
}
export default new Service();

View File

@@ -1,10 +1,122 @@
import ObjectID from "../../Types/ObjectID";
import { OnCreate, OnDelete } from "../Types/Database/Hooks";
import DatabaseService from "./DatabaseService";
import Model from "Common/Models/DatabaseModels/IncidentOwnerTeam";
import IncidentFeedService from "./IncidentFeedService";
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
import { Gray500, Red500 } from "../../Types/BrandColors";
import TeamService from "./TeamService";
import Team from "../../Models/DatabaseModels/Team";
import DeleteBy from "../Types/Database/DeleteBy";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
}
protected override async onBeforeDelete(
deleteBy: DeleteBy<Model>,
): Promise<OnDelete<Model>> {
const itemsToDelete: Model[] = await this.findBy({
query: deleteBy.query,
limit: deleteBy.limit,
skip: deleteBy.skip,
props: {
isRoot: true,
},
select: {
incidentId: true,
projectId: true,
teamId: true,
},
});
return {
carryForward: {
itemsToDelete: itemsToDelete,
},
deleteBy: deleteBy,
};
}
protected override async onDeleteSuccess(
onDelete: OnDelete<Model>,
_itemIdsBeforeDelete: Array<ObjectID>,
): Promise<OnDelete<Model>> {
const deleteByUserId: ObjectID | undefined =
onDelete.deleteBy.deletedByUser?.id || onDelete.deleteBy.props.userId;
const itemsToDelete: Model[] = onDelete.carryForward.itemsToDelete;
for (const item of itemsToDelete) {
const incidentId: ObjectID | undefined = item.incidentId;
const projectId: ObjectID | undefined = item.projectId;
const teamId: ObjectID | undefined = item.teamId;
if (incidentId && teamId && projectId) {
const team: Team | null = await TeamService.findOneById({
id: teamId,
select: {
name: true,
},
props: {
isRoot: true,
},
});
if (team && team.name) {
await IncidentFeedService.createIncidentFeed({
incidentId: incidentId,
projectId: projectId,
incidentFeedEventType: IncidentFeedEventType.OwnerTeamRemoved,
displayColor: Red500,
feedInfoInMarkdown: `**Team ${team.name}** was removed from the incident as the owner.`,
userId: deleteByUserId || undefined,
});
}
}
}
return onDelete;
}
public override async onCreateSuccess(
onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
// add incident feed.
const incidentId: ObjectID | undefined = createdItem.incidentId;
const projectId: ObjectID | undefined = createdItem.projectId;
const teamId: ObjectID | undefined = createdItem.teamId;
const createdByUserId: ObjectID | undefined =
createdItem.createdByUserId || onCreate.createBy.props.userId;
if (incidentId && teamId && projectId) {
const team: Team | null = await TeamService.findOneById({
id: teamId,
select: {
name: true,
},
props: {
isRoot: true,
},
});
if (team && team.name) {
await IncidentFeedService.createIncidentFeed({
incidentId: incidentId,
projectId: projectId,
incidentFeedEventType: IncidentFeedEventType.OwnerTeamAdded,
displayColor: Gray500,
feedInfoInMarkdown: `**Team ${team.name}** was added to the incident as the owner.`,
userId: createdByUserId || undefined,
});
}
}
return createdItem;
}
}
export default new Service();

View File

@@ -1,10 +1,124 @@
import ObjectID from "../../Types/ObjectID";
import DatabaseService from "./DatabaseService";
import Model from "Common/Models/DatabaseModels/IncidentOwnerUser";
import IncidentFeedService from "./IncidentFeedService";
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
import { Gray500, Red500 } from "../../Types/BrandColors";
import User from "../../Models/DatabaseModels/User";
import UserService from "./UserService";
import { OnCreate, OnDelete } from "../Types/Database/Hooks";
import DeleteBy from "../Types/Database/DeleteBy";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
}
protected override async onBeforeDelete(
deleteBy: DeleteBy<Model>,
): Promise<OnDelete<Model>> {
const itemsToDelete: Model[] = await this.findBy({
query: deleteBy.query,
limit: deleteBy.limit,
skip: deleteBy.skip,
props: {
isRoot: true,
},
select: {
incidentId: true,
projectId: true,
userId: true,
},
});
return {
carryForward: {
itemsToDelete: itemsToDelete,
},
deleteBy: deleteBy,
};
}
protected override async onDeleteSuccess(
onDelete: OnDelete<Model>,
_itemIdsBeforeDelete: Array<ObjectID>,
): Promise<OnDelete<Model>> {
const deleteByUserId: ObjectID | undefined =
onDelete.deleteBy.deletedByUser?.id || onDelete.deleteBy.props.userId;
const itemsToDelete: Model[] = onDelete.carryForward.itemsToDelete;
for (const item of itemsToDelete) {
const incidentId: ObjectID | undefined = item.incidentId;
const projectId: ObjectID | undefined = item.projectId;
const userId: ObjectID | undefined = item.userId;
if (incidentId && userId && projectId) {
const user: User | null = await UserService.findOneById({
id: userId,
select: {
name: true,
email: true,
},
props: {
isRoot: true,
},
});
if (user && user.name) {
await IncidentFeedService.createIncidentFeed({
incidentId: incidentId,
projectId: projectId,
incidentFeedEventType: IncidentFeedEventType.OwnerUserRemoved,
displayColor: Red500,
feedInfoInMarkdown: `**${user.name.toString()}** (${user.email?.toString()}) was removed from the incident as the owner.`,
userId: deleteByUserId || undefined,
});
}
}
}
return onDelete;
}
public override async onCreateSuccess(
onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
// add incident feed.
const incidentId: ObjectID | undefined = createdItem.incidentId;
const projectId: ObjectID | undefined = createdItem.projectId;
const userId: ObjectID | undefined = createdItem.userId;
const createdByUserId: ObjectID | undefined =
createdItem.createdByUserId || onCreate.createBy.props.userId;
if (incidentId && userId && projectId) {
const user: User | null = await UserService.findOneById({
id: userId,
select: {
name: true,
email: true,
},
props: {
isRoot: true,
},
});
if (user && user.name) {
await IncidentFeedService.createIncidentFeed({
incidentId: incidentId,
projectId: projectId,
incidentFeedEventType: IncidentFeedEventType.OwnerUserAdded,
displayColor: Gray500,
feedInfoInMarkdown: `**${user.name.toString()}** (${user.email?.toString()}) was added to the incident as the owner.`,
userId: createdByUserId || undefined,
});
}
}
return createdItem;
}
}
export default new Service();

View File

@@ -1,8 +1,13 @@
import CreateBy from "../Types/Database/CreateBy";
import { OnCreate } from "../Types/Database/Hooks";
import { OnCreate, OnUpdate } from "../Types/Database/Hooks";
import DatabaseService from "./DatabaseService";
import OneUptimeDate from "../../Types/Date";
import Model from "Common/Models/DatabaseModels/IncidentPublicNote";
import IncidentFeedService from "./IncidentFeedService";
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
import { Blue500, Indigo500 } from "../../Types/BrandColors";
import ObjectID from "../../Types/ObjectID";
import { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
export class Service extends DatabaseService<Model> {
public constructor() {
@@ -21,6 +26,72 @@ export class Service extends DatabaseService<Model> {
carryForward: null,
};
}
public override async onCreateSuccess(
_onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
const userId: ObjectID | null | undefined =
createdItem.createdByUserId || createdItem.createdByUser?.id;
await IncidentFeedService.createIncidentFeed({
incidentId: createdItem.incidentId!,
projectId: createdItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.PublicNote,
displayColor: Indigo500,
userId: userId || undefined,
feedInfoInMarkdown: `**Posted public note for this incident on status page**
${createdItem.note}
`,
});
return createdItem;
}
public override async onUpdateSuccess(
onUpdate: OnUpdate<Model>,
_updatedItemIds: Array<ObjectID>,
): Promise<OnUpdate<Model>> {
if (onUpdate.updateBy.data.note) {
const updatedItems: Array<Model> = await this.findBy({
query: onUpdate.updateBy.query,
limit: LIMIT_PER_PROJECT,
skip: 0,
props: {
isRoot: true,
},
select: {
incidentId: true,
projectId: true,
note: true,
createdByUserId: true,
createdByUser: {
_id: true,
},
},
});
const userId: ObjectID | null | undefined =
onUpdate.updateBy.props.userId;
for (const updatedItem of updatedItems) {
await IncidentFeedService.createIncidentFeed({
incidentId: updatedItem.incidentId!,
projectId: updatedItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.PublicNote,
displayColor: Blue500,
userId: userId || undefined,
feedInfoInMarkdown: `**Updated Public Note**
${updatedItem.note}
`,
});
}
}
return onUpdate;
}
}
export default new Service();

View File

@@ -44,6 +44,23 @@ import OneUptimeDate from "../../Types/Date";
import TelemetryUtil from "../Utils/Telemetry/Telemetry";
import TelemetryType from "../../Types/Telemetry/TelemetryType";
import logger from "../Utils/Logger";
import Semaphore, {
SemaphoreMutex,
} from "Common/Server/Infrastructure/Semaphore";
import IncidentFeedService from "./IncidentFeedService";
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
import { Gray500, Red500 } from "../../Types/BrandColors";
import Label from "../../Models/DatabaseModels/Label";
import LabelService from "./LabelService";
import IncidentSeverity from "../../Models/DatabaseModels/IncidentSeverity";
import IncidentSeverityService from "./IncidentSeverityService";
import {
WorkspaceMessageBlock,
WorkspacePayloadMarkdown,
} from "../../Types/Workspace/WorkspaceMessagePayload";
import WorkspaceNotificationRuleService from "./WorkspaceNotificationRuleService";
import NotificationRuleEventType from "../../Types/Workspace/NotificationRules/EventType";
import { WorkspaceChannel } from "../Utils/Workspace/WorkspaceBase";
export class Service extends DatabaseService<Model> {
public constructor() {
@@ -153,6 +170,32 @@ export class Service extends DatabaseService<Model> {
// store incident metric
}
public async getExistingIncidentNumberForProject(data: {
projectId: ObjectID;
}): Promise<number> {
// get last incident number.
const lastIncident: Model | null = await this.findOneBy({
query: {
projectId: data.projectId,
},
select: {
incidentNumber: true,
},
sort: {
createdAt: SortOrder.Descending,
},
props: {
isRoot: true,
},
});
if (!lastIncident) {
return 0;
}
return lastIncident.incidentNumber || 0;
}
protected override async onBeforeCreate(
createBy: CreateBy<Model>,
): Promise<OnCreate<Model>> {
@@ -160,10 +203,13 @@ export class Service extends DatabaseService<Model> {
throw new BadDataException("ProjectId required to create incident.");
}
const projectId: ObjectID =
createBy.props.tenantId || createBy.data.projectId!;
const incidentState: IncidentState | null =
await IncidentStateService.findOneBy({
query: {
projectId: createBy.props.tenantId || createBy.data.projectId!,
projectId: projectId,
isCreatedState: true,
},
select: {
@@ -180,7 +226,39 @@ export class Service extends DatabaseService<Model> {
);
}
let mutex: SemaphoreMutex | null = null;
try {
mutex = await Semaphore.lock({
key: projectId.toString(),
namespace: "IncidentService.incident-create",
lockTimeout: 15000,
acquireTimeout: 20000,
});
logger.debug(
"Mutex acquired - IncidentService.incident-create " +
projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
} catch (err) {
logger.debug(
"Mutex acquire failed - IncidentService.incident-create " +
projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
logger.error(err);
}
const incidentNumberForThisIncident: number =
(await this.getExistingIncidentNumberForProject({
projectId: projectId,
})) + 1;
createBy.data.currentIncidentStateId = incidentState.id;
createBy.data.incidentNumber = incidentNumberForThisIncident;
if (
(createBy.data.createdByUserId ||
@@ -217,13 +295,19 @@ export class Service extends DatabaseService<Model> {
}
}
return { createBy, carryForward: null };
return {
createBy,
carryForward: {
mutex: mutex,
},
};
}
protected override async onCreateSuccess(
onCreate: OnCreate<Model>,
createdItem: Model,
): Promise<Model> {
// these should never be null.
if (!createdItem.projectId) {
throw new BadDataException("projectId is required");
}
@@ -232,6 +316,52 @@ export class Service extends DatabaseService<Model> {
throw new BadDataException("id is required");
}
// release the mutex.
if (onCreate.carryForward && onCreate.carryForward.mutex) {
const mutex: SemaphoreMutex = onCreate.carryForward.mutex;
const projectId: ObjectID = createdItem.projectId!;
try {
await Semaphore.release(mutex);
logger.debug(
"Mutex released - IncidentService.incident-create " +
projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
} catch (err) {
logger.debug(
"Mutex release failed - IncidentService.incident-create " +
projectId.toString() +
" at " +
OneUptimeDate.getCurrentDateAsFormattedString(),
);
logger.error(err);
}
}
const createdByUserId: ObjectID | undefined | null =
createdItem.createdByUserId || createdItem.createdByUser?.id;
await IncidentFeedService.createIncidentFeed({
incidentId: createdItem.id!,
projectId: createdItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.IncidentCreated,
displayColor: Red500,
feedInfoInMarkdown: `**Incident #${createdItem.incidentNumber?.toString()} Created**:
**Incident Title**:
${createdItem.title || "No title provided."}
**Description**:
${createdItem.description || "No description provided."}
`,
userId: createdByUserId || undefined,
});
if (!createdItem.currentIncidentStateId) {
throw new BadDataException("currentIncidentStateId is required");
}
@@ -272,6 +402,26 @@ export class Service extends DatabaseService<Model> {
},
});
await IncidentFeedService.createIncidentFeed({
incidentId: createdItem.id!,
projectId: createdItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.RootCause,
displayColor: Red500,
feedInfoInMarkdown: `**Root Cause**
${createdItem.rootCause || "No root cause provided."}`,
});
await IncidentFeedService.createIncidentFeed({
incidentId: createdItem.id!,
projectId: createdItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.RemediationNotes,
displayColor: Red500,
feedInfoInMarkdown: `**Remediation Notes**
${createdItem.remediationNotes || "No remediation notes provided."}`,
});
// add owners.
if (
@@ -325,6 +475,32 @@ export class Service extends DatabaseService<Model> {
}
}
// // send message to workspaces - slack, teams, etc.
// const createdChannels: {
// channelsCreated: Array<WorkspaceChannel>;
// } | null = await this.notifyWorkspaceOnIncidentCreate({
// projectId: createdItem.projectId,
// incidentId: createdItem.id!,
// incidentNumber: createdItem.incidentNumber!,
// });
// if (
// createdChannels &&
// createdChannels.channelsCreated &&
// createdChannels.channelsCreated.length > 0
// ) {
// // update incident with these channels.
// await this.updateOneById({
// id: createdItem.id!,
// data: {
// postUpdatesToWorkspaceChannels: createdChannels.channelsCreated,
// },
// props: {
// isRoot: true,
// },
// });
// }
return createdItem;
}
@@ -503,6 +679,142 @@ export class Service extends DatabaseService<Model> {
}
}
if (updatedItemIds.length > 0) {
for (const incidentId of updatedItemIds) {
let shouldAddIncidentFeed: boolean = false;
let feedInfoInMarkdown: string = "**Incident was updated.**";
const createdByUserId: ObjectID | undefined | null =
onUpdate.updateBy.props.userId;
if (onUpdate.updateBy.data.title) {
// add incident feed.
feedInfoInMarkdown += `\n\n**Title**:
${onUpdate.updateBy.data.title || "No title provided."}
`;
shouldAddIncidentFeed = true;
}
if (onUpdate.updateBy.data.rootCause) {
if (onUpdate.updateBy.data.title) {
// add incident feed.
feedInfoInMarkdown += `\n\n**Root Cause**:
${onUpdate.updateBy.data.rootCause || "No root cause provided."}
`;
shouldAddIncidentFeed = true;
}
}
if (onUpdate.updateBy.data.description) {
// add incident feed.
feedInfoInMarkdown += `\n\n**Incident Description**:
${onUpdate.updateBy.data.description || "No description provided."}
`;
shouldAddIncidentFeed = true;
}
if (onUpdate.updateBy.data.remediationNotes) {
// add incident feed.
feedInfoInMarkdown += `\n\n**Remediation Notes**:
${onUpdate.updateBy.data.remediationNotes || "No remediation notes provided."}
`;
shouldAddIncidentFeed = true;
}
if (
onUpdate.updateBy.data.labels &&
onUpdate.updateBy.data.labels.length > 0 &&
Array.isArray(onUpdate.updateBy.data.labels)
) {
const labelIds: Array<ObjectID> = (
onUpdate.updateBy.data.labels as any
)
.map((label: Label) => {
if (label._id) {
return new ObjectID(label._id?.toString());
}
return null;
})
.filter((labelId: ObjectID | null) => {
return labelId !== null;
});
const labels: Array<Label> = await LabelService.findBy({
query: {
_id: QueryHelper.any(labelIds),
},
select: {
name: true,
},
limit: LIMIT_PER_PROJECT,
skip: 0,
props: {
isRoot: true,
},
});
if (labels.length > 0) {
feedInfoInMarkdown += `\n\n**Labels**:
${labels
.map((label: Label) => {
return `- ${label.name}`;
})
.join("\n")}
`;
shouldAddIncidentFeed = true;
}
}
if (
onUpdate.updateBy.data.incidentSeverity &&
(onUpdate.updateBy.data.incidentSeverity as any)._id
) {
const incidentSeverity: IncidentSeverity | null =
await IncidentSeverityService.findOneBy({
query: {
_id: new ObjectID(
(
onUpdate.updateBy.data.incidentSeverity as any
)?._id.toString(),
),
},
select: {
name: true,
},
props: {
isRoot: true,
},
});
if (incidentSeverity) {
feedInfoInMarkdown += `\n\n**Incident Severity**:
${incidentSeverity.name}
`;
shouldAddIncidentFeed = true;
}
}
if (shouldAddIncidentFeed) {
await IncidentFeedService.createIncidentFeed({
incidentId: incidentId,
projectId: onUpdate.updateBy.props.tenantId as ObjectID,
incidentFeedEventType: IncidentFeedEventType.IncidentUpdated,
displayColor: Gray500,
feedInfoInMarkdown: feedInfoInMarkdown,
userId: createdByUserId || undefined,
});
}
}
}
return onUpdate;
}
@@ -1035,5 +1347,131 @@ export class Service extends DatabaseService<Model> {
logger.error(err);
});
}
public async notifyWorkspaceOnIncidentCreate(data: {
projectId: ObjectID;
incidentId: ObjectID;
incidentNumber: number;
}): Promise<{
channelsCreated: WorkspaceChannel[];
} | null> {
try {
// we will notify the workspace about the incident creation with the bot tokken which is in WorkspaceProjectAuth Table.
return await WorkspaceNotificationRuleService.createInviteAndPostToChannelsBasedOnRules(
{
projectId: data.projectId,
notificationFor: {
incidentId: data.incidentId,
},
notificationRuleEventType: NotificationRuleEventType.Incident,
channelNameSiffix: data.incidentNumber.toString(),
messageBlocks: await this.getWorkspaceMessageBlocksForIncidentCreate({
incidentId: data.incidentId,
}),
},
);
} catch (err) {
// log the error and continue.
logger.error(err);
return null;
}
}
public async getWorkspaceMessageBlocksForIncidentCreate(data: {
incidentId: ObjectID;
}): Promise<Array<WorkspaceMessageBlock>> {
const incident: Model | null = await this.findOneById({
id: data.incidentId,
select: {
projectId: true,
incidentNumber: true,
title: true,
description: true,
incidentSeverity: {
name: true,
},
rootCause: true,
remediationNotes: true,
currentIncidentState: {
name: true,
},
},
props: {
isRoot: true,
},
});
if (!incident) {
throw new BadDataException("Incident not found");
}
const blocks: Array<WorkspaceMessageBlock> = [];
if (incident.incidentNumber) {
const markdownBlock1: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Incident #${incident.incidentNumber} Created**`,
};
blocks.push(markdownBlock1);
}
if (incident.title) {
const markdownBlock2: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Incident Title**:
${incident.title}`,
};
blocks.push(markdownBlock2);
}
if (incident.description) {
const markdownBlock3: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Description**:
${incident.description}`,
};
blocks.push(markdownBlock3);
}
if (incident.incidentSeverity?.name) {
const markdownBlock4: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Severity**:
${incident.incidentSeverity.name}`,
};
blocks.push(markdownBlock4);
}
if (incident.rootCause) {
const markdownBlock5: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Root Cause**:
${incident.rootCause}`,
};
blocks.push(markdownBlock5);
}
if (incident.remediationNotes) {
const markdownBlock6: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Remediation Notes**:
${incident.remediationNotes}`,
};
blocks.push(markdownBlock6);
}
if (incident.currentIncidentState?.name) {
const markdownBlock7: WorkspacePayloadMarkdown = {
_type: "WorkspacePayloadMarkdown",
text: `**Incident State**:
${incident.currentIncidentState.name}`,
};
blocks.push(markdownBlock7);
}
// TODO: Add buttons to Post Private Note, Ack Incident, Resolve Incident. etc.
return blocks as Array<WorkspaceMessageBlock>;
}
}
export default new Service();

View File

@@ -20,6 +20,8 @@ import IncidentStateTimeline from "Common/Models/DatabaseModels/IncidentStateTim
import User from "Common/Models/DatabaseModels/User";
import { IsBillingEnabled } from "../EnvironmentConfig";
import logger from "../Utils/Logger";
import IncidentFeedService from "./IncidentFeedService";
import { IncidentFeedEventType } from "../../Models/DatabaseModels/IncidentFeed";
export class Service extends DatabaseService<IncidentStateTimeline> {
public constructor() {
@@ -120,32 +122,17 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
)?.["publicNote"] as string | undefined;
if (publicNote) {
const incidentPublicNote: IncidentPublicNote = new IncidentPublicNote();
incidentPublicNote.incidentId = createBy.data.incidentId;
incidentPublicNote.note = publicNote;
incidentPublicNote.postedAt = createBy.data.startsAt;
incidentPublicNote.createdAt = createBy.data.startsAt;
incidentPublicNote.projectId = createBy.data.projectId!;
incidentPublicNote.shouldStatusPageSubscribersBeNotifiedOnNoteCreated =
Boolean(createBy.data.shouldStatusPageSubscribersBeNotified);
// mark status page subscribers as notified for this state change because we dont want to send duplicate (two) emails one for public note and one for state change.
if (
incidentPublicNote.shouldStatusPageSubscribersBeNotifiedOnNoteCreated
) {
if (createBy.data.shouldStatusPageSubscribersBeNotified) {
createBy.data.isStatusPageSubscribersNotified = true;
}
await IncidentPublicNoteService.create({
data: incidentPublicNote,
props: createBy.props,
});
}
return {
createBy,
carryForward: {
lastIncidentStateTimelineId: lastIncidentStateTimeline?.id || null,
publicNote: publicNote,
},
};
}
@@ -189,20 +176,39 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
// TODO: DELETE THIS WHEN WORKFLOW IS IMPLEMENMTED.
// check if this is resolved state, and if it is then resolve all the monitors.
const isResolvedState: IncidentState | null =
const incidentState: IncidentState | null =
await IncidentStateService.findOneBy({
query: {
_id: createdItem.incidentStateId.toString()!,
isResolvedState: true,
},
props: {
isRoot: true,
},
select: {
_id: true,
isResolvedState: true,
isAcknowledgedState: true,
isCreatedState: true,
color: true,
name: true,
},
});
const stateName: string = incidentState?.name || "";
await IncidentFeedService.createIncidentFeed({
incidentId: createdItem.incidentId!,
projectId: createdItem.projectId!,
incidentFeedEventType: IncidentFeedEventType.IncidentStateChanged,
displayColor: incidentState?.color,
feedInfoInMarkdown: "**Incident State** changed to **" + stateName + "**",
moreInformationInMarkdown: `**Cause:**
${createdItem.rootCause}`,
userId: createdItem.createdByUserId || onCreate.createBy.props.userId,
});
const isResolvedState: boolean = incidentState?.isResolvedState || false;
if (isResolvedState) {
const incident: Incident | null = await IncidentService.findOneBy({
query: {
@@ -228,6 +234,24 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
}
}
if (onCreate.carryForward.publicNote) {
const publicNote: string = onCreate.carryForward.publicNote;
const incidentPublicNote: IncidentPublicNote = new IncidentPublicNote();
incidentPublicNote.incidentId = createdItem.incidentId;
incidentPublicNote.note = publicNote;
incidentPublicNote.postedAt = createdItem.startsAt!;
incidentPublicNote.createdAt = createdItem.startsAt!;
incidentPublicNote.projectId = createdItem.projectId!;
incidentPublicNote.shouldStatusPageSubscribersBeNotifiedOnNoteCreated =
Boolean(createdItem.shouldStatusPageSubscribersBeNotified);
await IncidentPublicNoteService.create({
data: incidentPublicNote,
props: onCreate.createBy.props,
});
}
IncidentService.refreshIncidentMetrics({
incidentId: createdItem.incidentId,
}).catch((error: Error) => {

View File

@@ -147,6 +147,15 @@ import AlertOwnerUserService from "./AlertOwnerUserService";
import AlertSeverityService from "./AlertSeverityService";
import AlertNoteTemplateService from "./AlertNoteTemplateService";
import TableViewService from "./TableViewService";
import ScheduledMaintenanceFeedService from "./ScheduledMaintenanceFeedService";
import AlertFeedService from "./AlertFeedService";
import IncidentFeedService from "./IncidentFeedService";
import MonitorTestService from "./MonitorTestService";
import WorkspaceProjectAuthTokenService from "./WorkspaceProjectAuthTokenService";
import WorkspaceUserAuthTokenService from "./WorkspaceUserAuthTokenService";
import WorkspaceSettingService from "./WorkspaceSettingService";
import WorkspaceNotificationRuleService from "./WorkspaceNotificationRuleService";
const services: Array<BaseService> = [
AcmeCertificateService,
@@ -186,6 +195,7 @@ const services: Array<BaseService> = [
IncidentSeverityService,
IncidentStateService,
IncidentStateTimelineService,
IncidentFeedService,
LabelService,
@@ -222,6 +232,7 @@ const services: Array<BaseService> = [
ScheduledMaintenanceService,
ScheduledMaintenanceStateService,
ScheduledMaintenanceStateTimelineService,
ScheduledMaintenanceFeedService,
ShortLinkService,
SmsLogService,
@@ -306,7 +317,15 @@ const services: Array<BaseService> = [
AlertOwnerUserService,
AlertSeverityService,
AlertNoteTemplateService,
AlertFeedService,
TableViewService,
MonitorTestService,
WorkspaceProjectAuthTokenService,
WorkspaceUserAuthTokenService,
WorkspaceSettingService,
WorkspaceNotificationRuleService,
];
export const AnalyticsServices: Array<

View File

@@ -52,6 +52,7 @@ import NotificationSettingEventType from "../../Types/NotificationSetting/Notifi
import Query from "../Types/Database/Query";
import DeleteBy from "../Types/Database/DeleteBy";
import StatusPageResourceService from "./StatusPageResourceService";
import Label from "../../Models/DatabaseModels/Label";
export class Service extends DatabaseService<Model> {
public constructor() {
@@ -643,6 +644,48 @@ export class Service extends DatabaseService<Model> {
}
}
public async getLabelsForMonitors(data: {
monitorIds: Array<ObjectID>;
}): Promise<Array<Label>> {
if (data.monitorIds.length === 0) {
return [];
}
const monitors: Array<Model> = await this.findBy({
query: {
_id: QueryHelper.any(data.monitorIds),
},
select: {
_id: true,
name: true,
labels: true,
},
props: {
isRoot: true,
},
skip: 0,
limit: LIMIT_PER_PROJECT,
});
const labels: Array<Label> = [];
for (const monitor of monitors) {
if (monitor.labels) {
for (const label of monitor.labels) {
const isLabelAlreadyAdded: boolean = labels.some((l: Label) => {
return l.id!.toString() === label.id!.toString();
});
if (!isLabelAlreadyAdded) {
labels.push(label);
}
}
}
}
return labels;
}
public async notifyOwnersWhenNoProbeIsEnabled(data: {
monitorId: ObjectID;
isNoProbesEnabled: boolean;

Some files were not shown because too many files have changed in this diff Show More