mirror of https://github.com/apache/superset.git
fix: new alert should have force_screenshot be true (#18182)
* fix: new alert should have force_screenshot be true * fix comments
This commit is contained in:
parent
9c3205b573
commit
a80efa609c
|
@ -516,10 +516,11 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const shouldEnableForceScreenshot = contentType === 'chart' && !isReport;
|
||||||
const data: any = {
|
const data: any = {
|
||||||
...currentAlert,
|
...currentAlert,
|
||||||
type: isReport ? 'Report' : 'Alert',
|
type: isReport ? 'Report' : 'Alert',
|
||||||
force_screenshot: forceScreenshot ? 'true' : 'false',
|
force_screenshot: shouldEnableForceScreenshot || forceScreenshot,
|
||||||
validator_type: conditionNotNull ? 'not null' : 'operator',
|
validator_type: conditionNotNull ? 'not null' : 'operator',
|
||||||
validator_config_json: conditionNotNull
|
validator_config_json: conditionNotNull
|
||||||
? {}
|
? {}
|
||||||
|
@ -862,6 +863,8 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
|
||||||
|
|
||||||
const onContentTypeChange = (event: any) => {
|
const onContentTypeChange = (event: any) => {
|
||||||
const { target } = event;
|
const { target } = event;
|
||||||
|
// When switch content type, reset force_screenshot to false
|
||||||
|
setForceScreenshot(false);
|
||||||
// Gives time to close the select before changing the type
|
// Gives time to close the select before changing the type
|
||||||
setTimeout(() => setContentType(target.value), 200);
|
setTimeout(() => setContentType(target.value), 200);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue