diff --git a/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx b/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx index a079b54c16d..6f9222470c9 100644 --- a/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx +++ b/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx @@ -149,6 +149,7 @@ import { CompressOutlined, HistoryOutlined, SlackOutlined, + ApiOutlined, } from '@ant-design/icons'; import { FC } from 'react'; import { IconType } from './types'; @@ -287,6 +288,7 @@ const AntdIcons = { CompressOutlined, HistoryOutlined, SlackOutlined, + ApiOutlined, } as const; type AntdIconNames = keyof typeof AntdIcons; diff --git a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts index fb3ec30d8c5..f5e38905ad5 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts @@ -26,6 +26,7 @@ export enum FeatureFlag { AlertReports = 'ALERT_REPORTS', AlertReportTabs = 'ALERT_REPORT_TABS', AlertReportSlackV2 = 'ALERT_REPORT_SLACK_V2', + AlertReportWebhook = 'ALERT_REPORT_WEBHOOK', AlertReportsFilter = 'ALERT_REPORTS_FILTER', AllowFullCsvExport = 'ALLOW_FULL_CSV_EXPORT', AvoidColorsCollision = 'AVOID_COLORS_COLLISION', diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index 8e2a356eab5..bb85bc12ff1 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -123,6 +123,7 @@ const EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; const DEFAULT_NOTIFICATION_METHODS: NotificationMethodOption[] = [ NotificationMethodOption.Email, + NotificationMethodOption.Webhook, ]; const DEFAULT_NOTIFICATION_FORMAT = 'PNG'; const DEFAULT_EXTRA_DASHBOARD_OPTIONS: Extra = { diff --git a/superset-frontend/src/features/alerts/components/NotificationMethod.tsx b/superset-frontend/src/features/alerts/components/NotificationMethod.tsx index 228130b32e5..f9c3c75f65d 100644 --- a/superset-frontend/src/features/alerts/components/NotificationMethod.tsx +++ b/superset-frontend/src/features/alerts/components/NotificationMethod.tsx @@ -338,6 +338,8 @@ export const NotificationMethod: FunctionComponent = ({ ((!isFeatureEnabled(FeatureFlag.AlertReportSlackV2) || useSlackV1) && method === NotificationMethodOption.Slack) || + (isFeatureEnabled(FeatureFlag.AlertReportWebhook) && + method === NotificationMethodOption.Webhook) || method === NotificationMethodOption.Email, ) .map(method => ({ @@ -354,7 +356,9 @@ export const NotificationMethod: FunctionComponent = ({ return null; } - const onRecipientsChange = (event: ChangeEvent) => { + const onRecipientsChange = ( + event: ChangeEvent, + ) => { const { target } = event; setRecipientValue(target.value); @@ -476,9 +480,9 @@ export const NotificationMethod: FunctionComponent = ({ {method !== undefined ? ( <> -
- - {method === NotificationMethodOption.Email ? ( + {method === NotificationMethodOption.Email ? ( +
+ <>
{TRANSLATIONS.EMAIL_SUBJECT_NAME} @@ -503,66 +507,87 @@ export const NotificationMethod: FunctionComponent = ({
)} - ) : null} -
-
-
- -
- {t( - '%s recipients', - method === NotificationMethodOption.SlackV2 - ? NotificationMethodOption.Slack - : method, - )} - * -
-
- {[ - NotificationMethodOption.Email, - NotificationMethodOption.Slack, - ].includes(method) ? ( - <> + +
+ ) : null} + {method !== NotificationMethodOption.Webhook ? ( +
+ +
+ {t( + '%s recipients', + method === NotificationMethodOption.SlackV2 + ? NotificationMethodOption.Slack + : method, + )} + * +
+
+ {[ + NotificationMethodOption.Email, + NotificationMethodOption.Slack, + ].includes(method) ? ( + <> +
+ +
+
+
+ {t('Recipients are separated by "," or ";"')} +
+
+ + ) : ( + // for SlackV2
- + updateSlackOptions({ force: true })} + tooltipContent={t('Force refresh Slack channels list')} + disabled={isSlackChannelsLoading} />
-
-
- {t('Recipients are separated by "," or ";"')} -
-
- - ) : ( - // for SlackV2 + )} +
+
+
+ ) : ( +
+ +
+ {t('%s URL', method)} + * +
+
-