codeant-ai-for-open-source[bot] commented on code in PR #43755:
URL: https://github.com/apache/superset/pull/43755#discussion_r3903973942
##########
superset-frontend/src/features/alerts/AlertReportModal.tsx:
##########
@@ -890,6 +893,91 @@ const AlertReportModal:
FunctionComponent<AlertReportModalProps> = ({
});
};
+ const updatePdfOrientationState = (
+ value: 'portrait' | 'landscape' | 'auto',
+ ) => {
+ setCurrentAlert(currentAlertData => {
+ const dashboardState = currentAlertData?.extra?.dashboard;
+ const extra = {
+ dashboard: {
+ ...dashboardState,
+ pdf_orientation: value,
+ },
+ };
+ return {
+ ...currentAlertData,
+ extra,
+ };
+ });
+ };
+
+ const updatePdfFontSizeState = (value: 'small' | 'medium' | 'large') => {
+ setCurrentAlert(currentAlertData => {
+ const dashboardState = currentAlertData?.extra?.dashboard;
+ const extra = {
+ dashboard: {
+ ...dashboardState,
+ pdf_font_size: value,
+ },
+ };
+ return {
+ ...currentAlertData,
+ extra,
+ };
+ });
+ };
+
+ const updatePdfLayoutState = (twoCol: boolean) => {
+ setCurrentAlert(currentAlertData => {
+ const dashboardState = currentAlertData?.extra?.dashboard;
+ const extra = {
+ dashboard: {
+ ...dashboardState,
+ pdf_layout: twoCol ? ('2col' as const) : ('1col' as const),
+ },
+ };
+ return {
+ ...currentAlertData,
+ extra,
+ };
+ });
+ };
+
+ const updatePdfHeaderState = (
+ slot: 'left' | 'center' | 'right',
+ value: string,
+ ) => {
+ setCurrentAlert(currentAlertData => {
Review Comment:
**Suggestion:** The modal exposes no input for the `center` header slot, so
users cannot configure a header value supported by the saved schema and PDF
renderer. [incomplete implementation]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8275adcd53a448469b17e96f47cedad6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8275adcd53a448469b17e96f47cedad6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/features/alerts/AlertReportModal.tsx
**Line:** 946:950
**Comment:**
*Incomplete Implementation: The modal exposes no input for the `center`
header slot, so users cannot configure a header value supported by the saved
schema and PDF renderer.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43755&comment_hash=cff85cb4b02ec28befcdfef12a4ebd1934453e0dc35257a8030aef8ce3da2f86&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43755&comment_hash=cff85cb4b02ec28befcdfef12a4ebd1934453e0dc35257a8030aef8ce3da2f86&reaction=dislike'>๐</a>
##########
superset-frontend/src/features/alerts/AlertReportModal.tsx:
##########
@@ -2460,6 +2548,150 @@ const AlertReportModal:
FunctionComponent<AlertReportModalProps> = ({
</>
)}
</StyledInputContainer>
+ {browserPrintPdfEnabled &&
+ reportFormat === 'PDF' &&
+ contentType === ContentType.Dashboard && (
+ <>
+ <StyledInputContainer>
+ <div className="control-label">
+ {t('PDF font size')}
+ </div>
+ <Select
+ ariaLabel={t('Select PDF font size')}
+ value={
+ currentAlert?.extra?.dashboard?.pdf_font_size ||
+ 'small'
+ }
+ onChange={(value: string) =>
+ updatePdfFontSizeState(
+ value as 'small' | 'medium' | 'large',
+ )
+ }
+ options={[
+ { label: t('Small (default)'), value: 'small' },
+ { label: t('Medium'), value: 'medium' },
+ { label: t('Large'), value: 'large' },
+ ]}
+ />
+ </StyledInputContainer>
+ <StyledInputContainer>
+ <div className="control-label">
+ {t('PDF orientation')}
+ </div>
+ <Select
+ ariaLabel={t('Select PDF orientation')}
+ value={
+ currentAlert?.extra?.dashboard?.pdf_orientation
||
+ 'portrait'
+ }
Review Comment:
**Suggestion:** When no per-report orientation is saved, this displays
`portrait` even though the backend may apply a configured global orientation
such as `landscape` or `auto`. [api mismatch]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=00474317d3514f3cbbaa6fa31686bbf7&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=00474317d3514f3cbbaa6fa31686bbf7&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/features/alerts/AlertReportModal.tsx
**Line:** 2583:2586
**Comment:**
*Api Mismatch: When no per-report orientation is saved, this displays
`portrait` even though the backend may apply a configured global orientation
such as `landscape` or `auto`.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43755&comment_hash=18401b6ef4bbef0f09fa2f852a5e7a5ae5c330fa3b989af30d916876e54af767&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43755&comment_hash=18401b6ef4bbef0f09fa2f852a5e7a5ae5c330fa3b989af30d916876e54af767&reaction=dislike'>๐</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]