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:
Grace Guo 2022-02-02 17:00:05 -08:00 committed by GitHub
parent 9c3205b573
commit a80efa609c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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
? {}
@ -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);
};