codeant-ai-for-open-source[bot] commented on code in PR #43762:
URL: https://github.com/apache/superset/pull/43762#discussion_r3904446457


##########
superset-frontend/src/features/alerts/AlertReportModal.tsx:
##########
@@ -2764,7 +2976,7 @@ const AlertReportModal: 
FunctionComponent<AlertReportModalProps> = ({
                 </>
               ),
             },
-            ...(isReport && isFeatureEnabled(FeatureFlag.AlertReportsRetry)
+            ...(isReport

Review Comment:
   **Suggestion:** The retry panel is rendered for every report without 
checking `AlertReportsRetry`, so disabled retry functionality still exposes 
controls and submits settings the backend ignores. [logic error]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Often`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e4463a4d76fd465db8c263a644155499&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=e4463a4d76fd465db8c263a644155499&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:** 2979:2979
   **Comment:**
        *Logic Error: The retry panel is rendered for every report without 
checking `AlertReportsRetry`, so disabled retry functionality still exposes 
controls and submits settings the backend ignores.
   
   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%2F43762&comment_hash=4743168243ab6b586c4a97b9aed6176dca9ebd9e5586e16281846b141ebb876e&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43762&comment_hash=4743168243ab6b586c4a97b9aed6176dca9ebd9e5586e16281846b141ebb876e&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/features/alerts/AlertReportModal.tsx:
##########
@@ -2464,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'
+                            }
+                            onChange={(value: string) =>
+                              updatePdfOrientationState(
+                                value as 'portrait' | 'landscape' | 'auto',
+                              )
+                            }
+                            options={[
+                              { label: t('Portrait'), value: 'portrait' },
+                              { label: t('Landscape'), value: 'landscape' },
+                              {
+                                label: t('Auto (wide tables use landscape)'),
+                                value: 'auto',
+                              },
+                            ]}
+                          />
+                        </StyledInputContainer>
+                        <div className="inline-container">
+                          <Checkbox
+                            checked={
+                              currentAlert?.extra?.dashboard?.pdf_layout ===
+                              '2col'
+                            }
+                            onChange={(e: CheckboxChangeEvent) =>
+                              updatePdfLayoutState(e.target.checked)
+                            }
+                          >
+                            {t('Use 2-column adaptive layout')}
+                          </Checkbox>
+                        </div>
+                        <StyledInputContainer>
+                          <div className="control-label">
+                            {t('PDF header (left slot)')}
+                          </div>
+                          <div className="input-container">
+                            <Input
+                              placeholder={t(
+                                'e.g. {title} or ACME Corp',
+                              )}
+                              value={
+                                currentAlert?.extra?.dashboard?.pdf_header
+                                  ?.left ?? ''
+                              }
+                              onChange={(
+                                e: ChangeEvent<HTMLInputElement>,
+                              ) => updatePdfHeaderState('left', 
e.target.value)}
+                            />
+                          </div>
+                        </StyledInputContainer>
+                        <StyledInputContainer>
+                          <div className="control-label">
+                            {t('PDF header (right slot)')}
+                          </div>
+                          <div className="input-container">
+                            <Input
+                              placeholder={t(
+                                'e.g. Apache Superset | {date}',
+                              )}
+                              value={
+                                currentAlert?.extra?.dashboard?.pdf_header
+                                  ?.right ?? ''
+                              }
+                              onChange={(
+                                e: ChangeEvent<HTMLInputElement>,
+                              ) =>
+                                updatePdfHeaderState('right', e.target.value)
+                              }
+                            />
+                          </div>

Review Comment:
   **Suggestion:** The PDF header type supports a center override, but the 
modal only renders left and right inputs, making the center slot impossible to 
configure. [incomplete implementation]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=99987a2c6c7f4121a8363a324624f10d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=99987a2c6c7f4121a8363a324624f10d&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:** 2635:2653
   **Comment:**
        *Incomplete Implementation: The PDF header type supports a center 
override, but the modal only renders left and right inputs, making the center 
slot impossible to configure.
   
   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%2F43762&comment_hash=c70c2a0900a18c34dd8005cbc4ff2ae1bb280227006e70d3b107930cf39c0f4a&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43762&comment_hash=c70c2a0900a18c34dd8005cbc4ff2ae1bb280227006e70d3b107930cf39c0f4a&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/constants.ts:
##########
@@ -115,6 +115,22 @@ export const URL_PARAMS = {
     name: 'version_history',
     type: 'boolean',
   },
+  print: {
+    name: 'print',
+    type: 'number',
+  },
+  printFontSize: {
+    name: 'print_font_size',
+    type: 'string',
+  },
+  printLayout: {
+    name: 'print_layout',
+    type: 'string',
+  },
+  printOrientation: {
+    name: 'print_orientation',
+    type: 'string',
+  },

Review Comment:
   **Suggestion:** These new print parameters are not reserved, so dashboard 
and chart permalink builders copy `print` settings into generated URLs and 
unexpectedly reopen them in print mode. [api mismatch]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=c8c3046d22ed43eeb677dd126502d760&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=c8c3046d22ed43eeb677dd126502d760&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/constants.ts
   **Line:** 118:133
   **Comment:**
        *Api Mismatch: These new print parameters are not reserved, so 
dashboard and chart permalink builders copy `print` settings into generated 
URLs and unexpectedly reopen them in print mode.
   
   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%2F43762&comment_hash=ce8e95e11dee3cb0967b495bdbc8885872ab3b9ed03bc7a330a428f37acb5440&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43762&comment_hash=ce8e95e11dee3cb0967b495bdbc8885872ab3b9ed03bc7a330a428f37acb5440&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/dashboard/components/__tests__/printModeLogic.test.ts:
##########
@@ -0,0 +1,335 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Unit tests for SIP-212 print-mode URL-param helpers.
+ *
+ * These tests verify the logic used by Row.tsx, Tabs.tsx, and SliceHeader
+ * that reads ?print=1 from the URL and switches their print-mode behaviour.
+ * All tests work through the same `getUrlParam(URL_PARAMS.print)` call that
+ * the real components use โ€” no component rendering required.
+ */
+
+import { getUrlParam } from 'src/utils/urlUtils';
+import { URL_PARAMS } from 'src/constants';
+import {
+  getPrintFontSizeCSS,
+  PRINT_FONT_SIZE_SMALL,
+  PRINT_FONT_SIZE_MEDIUM,
+  PRINT_FONT_SIZE_LARGE,
+} from 'src/dashboard/styles/printMode';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+/**
+ * Simulate the component-level logic:
+ * `const isPrintMode = getUrlParam(URL_PARAMS.print) === 1;`
+ */
+function computeIsPrintMode(): boolean {
+  return getUrlParam(URL_PARAMS.print) === 1;
+}

Review Comment:
   **Suggestion:** These tests call local copies of component logic instead of 
rendering the components, so Row, Tabs, and SliceHeader regressions can pass 
every test unnoticed. [code quality]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=47f74273c35445688208679ad370ca73&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=47f74273c35445688208679ad370ca73&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/dashboard/components/__tests__/printModeLogic.test.ts
   **Line:** 46:48
   **Comment:**
        *Code Quality: These tests call local copies of component logic instead 
of rendering the components, so Row, Tabs, and SliceHeader regressions can pass 
every test unnoticed.
   
   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%2F43762&comment_hash=ba8aced4454cabf02df597e4ad6140fba906433f5d64f8a6c362d75117dfdc23&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43762&comment_hash=ba8aced4454cabf02df597e4ad6140fba906433f5d64f8a6c362d75117dfdc23&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]

Reply via email to