From c887c7cc25f79972a7e0d35262623b116ea19e2c Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Wed, 26 Jan 2022 12:07:56 -0800 Subject: [PATCH 1/2] fix: new alert should have force_screenshot be true --- superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 65020aeabf1c9..7d58b97269022 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -516,10 +516,12 @@ const AlertReportModal: FunctionComponent = ({ } }); + const shouldEnableForceScreenshot = contentType === 'chart' && !isReport; const data: any = { ...currentAlert, type: isReport ? 'Report' : 'Alert', - force_screenshot: forceScreenshot ? 'true' : 'false', + force_screenshot: + shouldEnableForceScreenshot || forceScreenshot ? 'true' : 'false', validator_type: conditionNotNull ? 'not null' : 'operator', validator_config_json: conditionNotNull ? {} @@ -862,6 +864,8 @@ const AlertReportModal: FunctionComponent = ({ const onContentTypeChange = (event: any) => { const { target } = event; + // When switch content type, reset force_screenshot to false + setForceScreenshot(false); // Gives time to close the select before changing the type setTimeout(() => setContentType(target.value), 200); }; From 4bb4ccbe0768de2a7fe1691709ddae69eab91151 Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Wed, 2 Feb 2022 15:43:55 -0800 Subject: [PATCH 2/2] fix comments --- superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 7d58b97269022..416f47a4ab9f6 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -520,8 +520,7 @@ const AlertReportModal: FunctionComponent = ({ const data: any = { ...currentAlert, type: isReport ? 'Report' : 'Alert', - force_screenshot: - shouldEnableForceScreenshot || forceScreenshot ? 'true' : 'false', + force_screenshot: shouldEnableForceScreenshot || forceScreenshot, validator_type: conditionNotNull ? 'not null' : 'operator', validator_config_json: conditionNotNull ? {}