Skip to content

Commit

Permalink
fix: new alert should have force_screenshot be true (#18182)
Browse files Browse the repository at this point in the history
* fix: new alert should have force_screenshot be true

* fix comments
  • Loading branch information
Grace Guo authored Feb 3, 2022
1 parent 9c3205b commit a80efa6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,11 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
}
});

const shouldEnableForceScreenshot = contentType === 'chart' && !isReport;
const data: any = {
...currentAlert,
type: isReport ? 'Report' : 'Alert',
force_screenshot: forceScreenshot ? 'true' : 'false',
force_screenshot: shouldEnableForceScreenshot || forceScreenshot,
validator_type: conditionNotNull ? 'not null' : 'operator',
validator_config_json: conditionNotNull
? {}
Expand Down Expand Up @@ -862,6 +863,8 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({

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);
};
Expand Down

0 comments on commit a80efa6

Please sign in to comment.