From 65423540fa4aaf96ae5ba175ecc5a7c0d41fd269 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Tue, 17 Aug 2021 10:21:17 -0700 Subject: [PATCH] Revert "fix: disable text reports for now (#16257)" This reverts commit ee9a384758790ffa7f216231a7751bc0c2970752. --- .../src/components/ReportModal/index.tsx | 7 ++++++- .../views/CRUD/alert/AlertReportModal.test.jsx | 16 ++++++++++++++++ .../src/views/CRUD/alert/AlertReportModal.tsx | 7 ++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/components/ReportModal/index.tsx b/superset-frontend/src/components/ReportModal/index.tsx index dd2771c62f632..7ec4681912c43 100644 --- a/superset-frontend/src/components/ReportModal/index.tsx +++ b/superset-frontend/src/components/ReportModal/index.tsx @@ -126,7 +126,12 @@ type ReportActionType = }; const DEFAULT_NOTIFICATION_FORMAT = 'TEXT'; -const TEXT_BASED_VISUALIZATION_TYPES: string[] = []; +const TEXT_BASED_VISUALIZATION_TYPES = [ + 'pivot_table', + 'pivot_table_v2', + 'table', + 'paired_ttest', +]; const reportReducer = ( state: Partial | null, diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx index cc9bdc0a0eef3..8575a526a3754 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx @@ -260,6 +260,22 @@ describe('AlertReportModal', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); + it('renders text option for text-based charts', async () => { + const props = { + ...mockedProps, + alert: mockData, + }; + const textWrapper = await mountAndWait(props); + + const chartOption = textWrapper.find('input[value="chart"]'); + act(() => { + chartOption.props().onChange({ target: { value: 'chart' } }); + }); + await waitForComponentToPaint(textWrapper); + + expect(textWrapper.find('input[value="TEXT"]')).toExist(); + }); + it('renders input element for working timeout', () => { expect(wrapper.find('input[name="working_timeout"]')).toExist(); }); diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index f4ff05bfb0713..c39783ebbeaa3 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -52,7 +52,12 @@ import { const SELECT_PAGE_SIZE = 2000; // temporary fix for paginated query const TIMEOUT_MIN = 1; -const TEXT_BASED_VISUALIZATION_TYPES: string[] = []; +const TEXT_BASED_VISUALIZATION_TYPES = [ + 'pivot_table', + 'pivot_table_v2', + 'table', + 'paired_ttest', +]; type SelectValue = { value: string;