Browse Source

feat(discord): Implement Discord metric alerts (frontend) (#55930)

Frontend part of discord metric alerts

<img width="1042" alt="Screenshot 2023-09-26 at 11 32 38 AM"
src="https://github.com/getsentry/sentry/assets/22582037/7b6b1853-ef26-48cd-9b0e-88419ea8eed3">

<img width="1042" alt="Screenshot 2023-09-26 at 11 32 44 AM"
src="https://github.com/getsentry/sentry/assets/22582037/447cd6d1-bcd3-4cfa-ab23-66ca287486ab">

<img width="1243" alt="Screenshot 2023-09-26 at 11 34 02 AM"
src="https://github.com/getsentry/sentry/assets/22582037/457e0f14-bd0d-4777-b118-5b60b2be16fb">


<img width="608" alt="Screenshot 2023-09-25 at 10 30 09 PM"
src="https://github.com/getsentry/sentry/assets/22582037/fa39d884-95bd-4446-8e89-3aaa7f736944">

---------

Co-authored-by: Spencer Murray <spencer.murray@sentry.io>
Julia Hoge 1 year ago
parent
commit
e7480da83f

+ 2 - 0
static/app/components/notificationActions/notificationActionManager.tsx

@@ -81,6 +81,7 @@ function NotificationActionManager({
       [NotificationActionService.MSTEAMS]: [],
       [NotificationActionService.SENTRY_APP]: [],
       [NotificationActionService.OPSGENIE]: [],
+      [NotificationActionService.DISCORD]: [],
     };
     availableActions.forEach(a => {
       availableServicesMap[a.action.serviceType as NotificationActionService].push(a);
@@ -105,6 +106,7 @@ function NotificationActionManager({
       [NotificationActionService.MSTEAMS]: [],
       [NotificationActionService.SENTRY_APP]: [],
       [NotificationActionService.OPSGENIE]: [],
+      [NotificationActionService.DISCORD]: [],
     };
     notificationActions.forEach((action, index) => {
       if (action.serviceType) {

+ 1 - 0
static/app/types/notificationActions.tsx

@@ -4,6 +4,7 @@ export enum NotificationActionService {
   SLACK = 'slack',
   MSTEAMS = 'msteams',
   OPSGENIE = 'opsgenie',
+  DISCORD = 'discord',
   SENTRY_APP = 'sentry_app',
   SENTRY_NOTIFICATION = 'sentry_notification',
 }

+ 2 - 0
static/app/views/alerts/rules/metric/triggers/actionsPanel/actionTargetSelector.tsx

@@ -17,6 +17,8 @@ const getPlaceholderForType = (type: ActionType) => {
     case ActionType.MSTEAMS:
       // no prefixes for msteams
       return 'username or channel';
+    case ActionType.DISCORD:
+      return 'Discord channel ID';
     case ActionType.PAGERDUTY:
       return 'service';
     case ActionType.OPSGENIE:

+ 2 - 0
static/app/views/alerts/rules/metric/types.tsx

@@ -146,6 +146,7 @@ export enum ActionType {
   PAGERDUTY = 'pagerduty',
   MSTEAMS = 'msteams',
   OPSGENIE = 'opsgenie',
+  DISCORD = 'discord',
   SENTRY_APP = 'sentry_app',
 }
 
@@ -157,6 +158,7 @@ export const ActionLabel = {
   [ActionType.PAGERDUTY]: t('Pagerduty'),
   [ActionType.MSTEAMS]: t('MS Teams'),
   [ActionType.OPSGENIE]: t('Opsgenie'),
+  [ActionType.DISCORD]: t('Discord'),
   [ActionType.SENTRY_APP]: t('Notification'),
 };