From 2bd532b2481034fce52072ab278fd8a2b2d58111 Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Thu, 31 Mar 2022 23:50:38 -0700 Subject: [PATCH 1/3] feat: add success toast to alerts and reports --- .../src/views/CRUD/alert/AlertReportModal.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 6323edf3a0ca..2e2d9f61a26e 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -73,6 +73,7 @@ type SelectValue = { }; interface AlertReportModalProps { + addSuccessToast: (msg: string) => void; addDangerToast: (msg: string) => void; alert?: AlertObject | null; isReport?: boolean; @@ -402,7 +403,9 @@ const AlertReportModal: FunctionComponent = ({ show, alert = null, isReport = false, + addSuccessToast, }) => { + // console.log('onAdd', onAdd) const conf = useCommonConf(); const allowedNotificationMethods: NotificationMethodOption[] = conf?.ALERT_REPORTS_NOTIFICATION_METHODS || DEFAULT_NOTIFICATION_METHODS; @@ -555,6 +558,9 @@ const AlertReportModal: FunctionComponent = ({ return; } + if (data.type === 'Alert') addSuccessToast(t('Alert updated')); + else addSuccessToast('Report updated'); + if (onAdd) { onAdd(); } @@ -569,6 +575,9 @@ const AlertReportModal: FunctionComponent = ({ return; } + if (data.type === 'Alert') addSuccessToast(t('Alert created')); + else addSuccessToast('Report created'); + if (onAdd) { onAdd(response); } From 9060756866b7c32f7f169135c56108cdd69fea92 Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Fri, 1 Apr 2022 00:03:19 -0700 Subject: [PATCH 2/3] remove console --- superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 2e2d9f61a26e..8cb012f7022b 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -405,7 +405,6 @@ const AlertReportModal: FunctionComponent = ({ isReport = false, addSuccessToast, }) => { - // console.log('onAdd', onAdd) const conf = useCommonConf(); const allowedNotificationMethods: NotificationMethodOption[] = conf?.ALERT_REPORTS_NOTIFICATION_METHODS || DEFAULT_NOTIFICATION_METHODS; From b2ff8ee9e1f3c21d0292c9880c4c0d79d490c716 Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Tue, 5 Apr 2022 09:18:08 -0700 Subject: [PATCH 3/3] add suggestions --- superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 8cb012f7022b..7a68b2663fe0 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -557,8 +557,7 @@ const AlertReportModal: FunctionComponent = ({ return; } - if (data.type === 'Alert') addSuccessToast(t('Alert updated')); - else addSuccessToast('Report updated'); + addSuccessToast(t(`${data.type} updated`)); if (onAdd) { onAdd(); @@ -574,8 +573,7 @@ const AlertReportModal: FunctionComponent = ({ return; } - if (data.type === 'Alert') addSuccessToast(t('Alert created')); - else addSuccessToast('Report created'); + addSuccessToast(t(`${data.type} updated`)); if (onAdd) { onAdd(response);