Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: new alert should have force_screenshot be true #18182

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 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,12 @@ 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 ? 'true' : 'false',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to boolean and update line 520 to const data: AlertObject while we are here?

cc @betodealmeida @lyndsiWilliams

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i fixed force_screenshot to be boolean type. But data is not AlertObject, see line 553 ~ 559, it is temporary object carried a lot of extra fields.

validator_type: conditionNotNull ? 'not null' : 'operator',
validator_config_json: conditionNotNull
? {}
Expand Down Expand Up @@ -862,6 +864,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