Skip to content

fix(explore): explain disabled chart overwrite option#39796

Merged
rusackas merged 3 commits into
apache:masterfrom
yeaight7:yeaight7/explore-save-owner-message
May 12, 2026
Merged

fix(explore): explain disabled chart overwrite option#39796
rusackas merged 3 commits into
apache:masterfrom
yeaight7:yeaight7/explore-save-owner-message

Conversation

@yeaight7
Copy link
Copy Markdown
Contributor

@yeaight7 yeaight7 commented Apr 30, 2026

SUMMARY

Adds explanatory helper text under the disabled Explore save modal overwrite option when an existing chart cannot be overwritten. The message now distinguishes charts the user does not own from charts managed externally.

Fixes #39786

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not included. Cosmetic text-only change in the existing Save chart modal.

TESTING INSTRUCTIONS

  1. Open Explore for an existing chart where the current user is not listed as a chart owner.
  2. Open the Save chart modal.
  3. Confirm "Save (Overwrite)" is disabled and the modal shows "Must be a chart owner to overwrite this chart. Save as a new chart instead."
  4. Open Explore for an existing chart with is_managed_externally: true.
  5. Confirm "Save (Overwrite)" is disabled and the modal shows "This chart is managed externally and can't be overwritten in Superset."
  6. Confirm chart owners still see the existing overwrite behavior when the chart is not managed externally.

Automated/local validation run:

  • npx jest --config jest.config.js --maxWorkers=80% --silent --testRegex ".*SaveModal\\.test\\.tsx$" (passes: 23 tests)
  • npx prettier --check src/explore/components/SaveModal.tsx src/explore/components/SaveModal.test.tsx (passes)
  • pre-commit run --all-files (passes)

ADDITIONAL INFORMATION

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 30, 2026

Code Review Agent Run #d3f2b5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 3f2dcc4..3f2dcc4
    • superset-frontend/src/explore/components/SaveModal.test.tsx
    • superset-frontend/src/explore/components/SaveModal.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 explore:save Related to saving changes in Explore label Apr 30, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.38%. Comparing base (f67dd4a) to head (bf49e0e).
⚠️ Report is 48 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39796      +/-   ##
==========================================
+ Coverage   63.83%   64.38%   +0.54%     
==========================================
  Files        2589     2573      -16     
  Lines      137821   135606    -2215     
  Branches    31928    31655     -273     
==========================================
- Hits        87978    87306     -672     
+ Misses      48327    46803    -1524     
+ Partials     1516     1497      -19     
Flag Coverage Δ
javascript 66.52% <100.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.

@Mayankaggarwal8055
Copy link
Copy Markdown
Contributor

Hey @yeaight7, this is a nice UX improvement 👍

The message makes sense and definitely helps explain why the overwrite option is disabled. One small thought — do you think it would help to also hint at the alternative (like saving as a new chart)? Might make it a bit more actionable for users.

Also just checking — is this string covered by translation like the rest of the UI?

Overall looks clean and well scoped. Nice work!

@yeaight7 yeaight7 force-pushed the yeaight7/explore-save-owner-message branch from 3f2dcc4 to 2cbc37c Compare May 2, 2026 17:15
@netlify
Copy link
Copy Markdown

netlify Bot commented May 2, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit bf49e0e
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a00fec15aa0da0008cc422f
😎 Deploy Preview https://deploy-preview-39796--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 2, 2026

Code Review Agent Run #d6a694

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 2cbc37c..2cbc37c
    • superset-frontend/src/explore/components/SaveModal.test.tsx
    • superset-frontend/src/explore/components/SaveModal.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

@yeaight7
Copy link
Copy Markdown
Contributor Author

yeaight7 commented May 3, 2026

hey @Mayankaggarwal8055, forgot to reply.

Yes, everything is covered by translation.

I agree with your suggestion, that's why I added the hint to "Save as new chart".

Thanks for the feedback

Copy link
Copy Markdown
Member

@sfirke sfirke left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @yeaight7 !

One meaningful gap to address before merging: isChartOwner and canOverwriteSlice are not equivalent, and the PR gates the message on only one of the two conditions that can disable the button.

canOverwriteSlice() returns false in two distinct situations:

  1. The user is not an owner of the chart
  2. The chart has is_managed_externally: true (managed by an external tool like a git-sync pipeline)

The PR introduces isChartOwner — which only checks condition 1 — and uses that to decide whether to show the message. This means: if a user is an owner but the chart is externally managed, the overwrite button is still disabled but no message appears. The user sees a disabled control with no explanation.

The fix is straightforward — replace isExistingChartNonOwner (and the redundant isChartOwner variable) with a condition based on canOverwriteSlice itself, and distinguish the two cases in the message text. This matches the pattern already used in PropertiesModal for the same flag:

{this.props.slice && !canOverwriteSlice && (
  <div>
    <Typography.Text type="secondary">
      {this.props.slice.is_managed_externally
        ? t("This chart is managed externally and can't be overwritten in Superset.")
        : t('Must be a chart owner to overwrite this chart. Save as a new chart instead.')}
    </Typography.Text>
  </div>
)}

A test for the externally-managed case should be added alongside the existing non-owner test.

Minor style note: "Save as a new chart instead." may be unnecessary since the radio button is right there — existing hint text in the codebase tends toward single-sentence messages.

@yeaight7
Copy link
Copy Markdown
Contributor Author

yeaight7 commented May 4, 2026

Addressed in the next update: the helper text now uses slice && !canOverwriteSlice, removes the separate owner-only condition, and shows a separate externally-managed message. Added coverage for the externally-managed case alongside the non-owner case.

Validation: SaveModal.test.tsx passes locally (23 tests), and Prettier passes for the changed files.

@pull-request-size pull-request-size Bot added size/M and removed size/S labels May 4, 2026
@yeaight7 yeaight7 requested a review from sfirke May 4, 2026 21:59
@yeaight7 yeaight7 force-pushed the yeaight7/explore-save-owner-message branch from 2fee52d to 7e196be Compare May 4, 2026 22:01
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 4, 2026

Code Review Agent Run #556f4f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 2cbc37c..7e196be
    • superset-frontend/src/explore/components/SaveModal.test.tsx
    • superset-frontend/src/explore/components/SaveModal.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

@rusackas rusackas requested a review from sadpandajoe May 12, 2026 17:16
@rusackas
Copy link
Copy Markdown
Member

rusackas commented May 12, 2026

Noting that HoltzTomas#33 is also open... from a bot (but not targeting this repo)! Anyone care to assess how they stack up?

@sfirke
Copy link
Copy Markdown
Member

sfirke commented May 12, 2026

I just approved this, let's see if CI passes. @rusackas I have assigned @yeaight7 to the issue, so want to give them dibs on fixing it. Funny that the Devin bot has a fix but doesn't target this repo 🤨

@sfirke
Copy link
Copy Markdown
Member

sfirke commented May 12, 2026

@yeaight7 in the original issue I wrote:

Please include a screenshot in the PR showing the new UI look.

Is that something you're able to add?

@Mayankaggarwal8055
Copy link
Copy Markdown
Contributor

Nice, the updated logic looks much cleaner now, especially handling both the ownership and externally-managed cases separately.

The additional test coverage was a good catch too 👍

@rusackas
Copy link
Copy Markdown
Member

Took a look at the Devin PR (not on our repo) — this one is the better fix and worth pushing over the finish line.... I think it's close enough.

The key difference is that the other one gates the message on a separate isNonOwnerOfExistingSlice() helper that only checks ownership, so it silently fails to explain the disabled button when is_managed_externally is true. This PR correctly uses !canOverwriteSlice — the same condition that disables the button — and shows a distinct message for each case. It's also a smaller, cleaner diff.

The one open thread is the style note about "Save as a new chart instead." being potentially redundant given the radio button is right there. That seems like a quick editorial call to unblock this. Otherwise the logic looks solid and the test coverage is good. Approving, and (unless there are ninja-edits to be made) will merge imminently.

@rusackas
Copy link
Copy Markdown
Member

Meh... I'm not worried about the redundant messaging, on second thought. Easy follow-up PR if people want to wordsmith... this seems to be the right fix. In it goes!

@rusackas rusackas merged commit 7445105 into apache:master May 12, 2026
72 checks passed
@yeaight7
Copy link
Copy Markdown
Contributor Author

Happy to help 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

explore:save Related to saving changes in Explore size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UX: User should see an explanation for why they can't overwrite a chart when they don't own it

4 participants