Skip to content

fix(sqllab): Update style for code viewer container#39075

Merged
justinpark merged 3 commits intoapache:masterfrom
justinpark:fix--sqllab-view-query-code-block-viewer
Apr 8, 2026
Merged

fix(sqllab): Update style for code viewer container#39075
justinpark merged 3 commits intoapache:masterfrom
justinpark:fix--sqllab-view-query-code-block-viewer

Conversation

@justinpark
Copy link
Copy Markdown
Member

@justinpark justinpark commented Apr 3, 2026

SUMMARY

Fixes #39076

This commit updates the style for code viewer matching with the previous version.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

●_Superset_6_1_-_SQL_Lab_view_query_looks_bad_-_Asana

After:

Screenshot 2026-04-02 at 5 25 16 PM

TESTING INSTRUCTIONS

Screenshot

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 3, 2026

Code Review Agent Run #12eff9

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx - 1
Review Details
  • Files reviewed - 3 · Commit Range: 0bce6fc..0bce6fc
    • superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx
    • superset-frontend/src/features/queries/QueryPreviewModal.tsx
    • superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the sqllab:design Related to the SQL Lab UI/UX label Apr 3, 2026
@justinpark justinpark requested a review from sadpandajoe April 3, 2026 00:29
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 3, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 0bce6fc
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69cf09c295b28900081cbd4f
😎 Deploy Preview https://deploy-preview-39075--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 3, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.48%. Comparing base (15bab22) to head (6b6546e).
⚠️ Report is 127 commits behind head on master.

Files with missing lines Patch % Lines
...rontend/src/features/queries/QueryPreviewModal.tsx 0.00% 2 Missing ⚠️
...nd/src/features/queries/SavedQueryPreviewModal.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39075      +/-   ##
==========================================
- Coverage   64.48%   64.48%   -0.01%     
==========================================
  Files        2536     2536              
  Lines      130862   130872      +10     
  Branches    30358    30358              
==========================================
+ Hits        84387    84393       +6     
- Misses      45012    45016       +4     
  Partials     1463     1463              
Flag Coverage Δ
javascript 65.83% <60.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

borderColor: theme.colorBorder,
borderStyle: 'solid',
marginTop: theme.sizeUnit * 4,
fontSize: '0.75em',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we use this instead? theme.fontSize

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sounds good. done!

const codeBlockStyle = {
border: 1,
borderColor: theme.colorBorder,
borderStyle: 'solid',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to mention this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. Without borderStyle, no border made

marginTop: theme.sizeUnit * 4,
fontSize: '0.75em',
height: 375,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use a more standardized height?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sure. updated

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 3, 2026

Code Review Agent Run #882634

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 0bce6fc..aed6cfb
    • superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx
    • superset-frontend/src/features/queries/QueryPreviewModal.tsx
    • superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@michael-s-molina
Copy link
Copy Markdown
Member

@justinpark Can you remove the extra padding between the modal title and the content? I think you just need to remove the content top padding given that the header already has padding.

@justinpark
Copy link
Copy Markdown
Member Author

justinpark Can you remove the extra padding between the modal title and the content? I think you just need to remove the content top padding given that the header already has padding.

updated.

Screenshot 2026-04-07 at 3 18 48 PM Screenshot 2026-04-07 at 3 22 54 PM

<CodeSyntaxHighlighter language="sql">{sql}</CodeSyntaxHighlighter>
<div
css={css`
margin: -${theme.sizeUnit * 6}px;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: The new wrapper applies -sizeUnit * 6 margin on all four sides, but the modal body padding is not uniform (sizeUnit * 4 vertical and sizeUnit * 6 horizontal). This overcompensates top/bottom by 8px, which can push content into the header/footer area and cause layout overlap. Use axis-specific negative margins that match the modal body padding. [logic error]

Severity Level: Minor 🧹
- ⚠️ SQL Lab "View SQL" modal has misaligned vertical padding.
- ⚠️ Query history SQL viewer content encroaches modal header spacing.
Suggested change
margin: -${theme.sizeUnit * 6}px;
margin: -${theme.sizeUnit * 4}px -${theme.sizeUnit * 6}px;
Steps of Reproduction ✅
1. Open SQL Lab (implemented in `superset-frontend/src/SqlLab/components/App/index.tsx`)
and run any query so that results are available; the result view uses `ResultSet`
(`src/SqlLab/components/ResultSet/index.tsx`), which conditionally renders
`HighlightedSql` at lines 584–587 when `showSql` is true.

2. In the SQL Lab "Query history" table (`src/SqlLab/components/QueryTable/index.tsx`),
each row's SQL column is rendered as a `<HighlightedSql>` inside a `Card` at lines 16–23
(offset block 280–319), so clicking that truncated SQL opens a modal via `HighlightedSql`.

3. `HighlightedSql` (`src/SqlLab/components/HighlightedSql/index.tsx`) renders a
`<ModalTrigger>` at lines 112–124 with `modalBody={<HighlightSqlModal rawSql={rawSql}
sql={sql} />}`, and `HighlightSqlModal` returns a wrapper `<div>` with `css={css`margin:
-${theme.sizeUnit * 6}px;`}` at lines 83–88, so this negative margin is applied around the
whole modal body content.

4. The `ModalTrigger` uses the shared `Modal` component from
`packages/superset-ui-core/src/components/Modal/Modal.tsx`, whose `StyledModal` sets
`.ant-modal-body { padding: ${theme.sizeUnit * 4}px ${theme.sizeUnit * 6}px; }` at lines
123–126; combining this with `margin: -${theme.sizeUnit * 6}px;` on the inner `<div>`
cancels left/right padding but overshoots top/bottom by `theme.sizeUnit * 2`, causing the
SQL title and code block to visually encroach into the header/border area instead of
aligning flush only with the horizontal padding as intended. The suggested change to
`margin: -${theme.sizeUnit * 4}px -${theme.sizeUnit * 6}px;` would exactly negate the
modal body padding vertically and horizontally, avoiding this layout mismatch.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx
**Line:** 86:86
**Comment:**
	*Logic Error: The new wrapper applies `-sizeUnit * 6` margin on all four sides, but the modal body padding is not uniform (`sizeUnit * 4` vertical and `sizeUnit * 6` horizontal). This overcompensates top/bottom by 8px, which can push content into the header/footer area and cause layout overlap. Use axis-specific negative margins that match the modal body padding.

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.
👍 | 👎

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 7, 2026

Code Review Agent Run #a1b07e

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx - 1
    • Custom CSS Usage Violation · Line 84-88
      The code adds custom CSS with a negative margin to the modal div, violating the guideline to avoid custom CSS whenever possible. Consider using Ant Design theming or styled components instead to maintain consistency.
Review Details
  • Files reviewed - 3 · Commit Range: aed6cfb..6b6546e
    • superset-frontend/src/SqlLab/components/HighlightedSql/index.tsx
    • superset-frontend/src/features/queries/QueryPreviewModal.tsx
    • superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@justinpark justinpark merged commit 4c2dd63 into apache:master Apr 8, 2026
84 of 85 checks passed
michael-s-molina pushed a commit that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M sqllab:design Related to the SQL Lab UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL Lab view query looks bad

3 participants