superset icon indicating copy to clipboard operation
superset copied to clipboard

feat: add tab select with save chart to dashboard

Open SBIN2010 opened this issue 3 weeks ago • 25 comments

User description

SUMMARY

Users can now select a specific tab when saving a chart to a dashboard. This allows for more precise control over chart placement in complex dashboards with multiple tabs.

Add the ability to select a tab in the chart save modal window when placing it on a dashboard:

  • Load and display available tabs when an existing dashboard is selected
  • Allow users to choose a specific tab for the new chart
  • Automatically position the chart on the selected tab

Added TreeSelect from Ant Design for tab selection

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Снимок экрана от 2025-11-28 22-43-07

demo2_can_select_tab.webm

TESTING INSTRUCTIONS

run test src/explore/components/SaveModal.test.jsx

ADDITIONAL INFORMATION

  • [ ] Has associated issue:
  • [ ] Required feature flags:
  • [x] 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

CodeAnt-AI Description

Let users pick a dashboard tab when saving a chart

What Changed

  • When using "Save as..." and choosing a dashboard, a tab selector appears so the chart can be assigned to a specific tab
  • Newly saved charts are added directly onto the selected dashboard tab; if this fails, the chart is still saved and a warning is shown
  • When redirecting to the dashboard after saving, the page now opens on the chosen tab instead of the default tab

Impact

✅ Easier chart placement on multi-tab dashboards ✅ Quicker access to newly saved charts ✅ Clearer feedback when tab placement fails

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

SBIN2010 avatar Nov 28 '25 19:11 SBIN2010

🎪 Showtime is building environment on GHA for a339bd9

github-actions[bot] avatar Nov 30 '25 19:11 github-actions[bot]

⚠️ DEPRECATED WORKFLOW ⚠️

@SBIN2010 This workflow is deprecated! Please use the new Superset Showtime system instead:

  • Replace "testenv-up" label with "🎪 trigger-start"
  • Better reliability and easier management
  • See https://github.com/mistercrunch/superset-showtime for details

Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

github-actions[bot] avatar Dec 01 '25 15:12 github-actions[bot]

@SBIN2010 Ephemeral environment spinning up at http://34.221.129.14:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Dec 01 '25 15:12 github-actions[bot]

I LOVE THIS FEATURE!

Lots of copilot suggestions... I committed a couple of the "no-brainer" ones on your behalf, but I'm curious what you think of the rest.

rusackas avatar Dec 01 '25 19:12 rusackas

CodeAnt AI is reviewing your PR.

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • [ ] Possible Bug
    onDashboardChange assumes the dashboard argument is always a non-null object, but AsyncSelect is configured with allowClear, so it may pass null/undefined when the selection is cleared. The new implementation immediately dereferences dashboard.value, which can now throw at runtime when clearing the field. This path needs a null/undefined guard.

  • [ ] Possible Bug
    In addChartToDashboardTab, the catch block calls new Error('Error adding chart to dashboard tab:', error). The Error constructor only accepts a single message argument, so the second error argument is invalid in TypeScript and will be ignored at runtime. This both causes a type error and drops the original stack/context; the function should either rethrow the original error or wrap it properly.

  • [ ] Possible Bug
    The mocked TreeSelect uses a data-test attribute but the tests query using getByTestId('mock-tree-select'), which expects data-testid. This mismatch will cause all tab selector tests to fail and should be aligned.

CodeAnt AI finished reviewing your PR.

🎪 Showtime is building environment on GHA for 8642a16

github-actions[bot] avatar Dec 02 '25 23:12 github-actions[bot]

🎪 Showtime deployed environment on GHA for 8642a16

Environment: http://44.250.241.142:8080 (admin/admin) • Lifetime: 48h auto-cleanup • Updates: New commits create fresh environments automatically

github-actions[bot] avatar Dec 02 '25 23:12 github-actions[bot]

🎪 Showtime is building environment on GHA for 8642a16

github-actions[bot] avatar Dec 03 '25 08:12 github-actions[bot]

⚠️ DEPRECATED WORKFLOW ⚠️

@EnxDev This workflow is deprecated! Please use the new Superset Showtime system instead:

  • Replace "testenv-up" label with "🎪 trigger-start"
  • Better reliability and easier management
  • See https://github.com/mistercrunch/superset-showtime for details

Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

github-actions[bot] avatar Dec 03 '25 08:12 github-actions[bot]

@EnxDev Ephemeral environment spinning up at http://54.213.160.155:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Dec 03 '25 08:12 github-actions[bot]

CodeAnt AI is running Incremental review

  • In this case, the chart is already saved inside the Sales Dashboard. When I try to save it, the “Add to tabs” field is still disabled. To enable it, I have to select another dashboard and then come back to the Sales Dashboard.

I just noticed this myself. And I've already fixed it.🤝

SBIN2010 avatar Dec 03 '25 10:12 SBIN2010

  • In this case, the chart is already saved inside the Sales Dashboard. When I try to save it, the “Add to tabs” field is still disabled. To enable it, I have to select another dashboard and then come back to the Sales Dashboard.

I just noticed this myself. And I've already fixed it.🤝

Okay, I'm currently testing on your branch with the latest changes pushed, and I’m seeing the same behavior I described earlier. You probably still have some changes to push if you’ve already fixed it.

I'm also wondering whether we should place the new chart in the same row as the last one if there’s available space, instead of creating a new row; @SBIN2010 what do you think about that?

Screenshot 2025-12-03 112259

EnxDev avatar Dec 03 '25 10:12 EnxDev

@SBIN2010 this is the current behavior after my changes

Probably we should set the first tab as a default value inside "Add to tabs" field

https://github.com/user-attachments/assets/40d9b7d4-d295-4608-90f4-39b4daeb37ea

EnxDev avatar Dec 03 '25 11:12 EnxDev

CodeAnt AI is running Incremental review

CodeAnt AI is running Incremental review

CodeAnt AI is running Incremental review

CodeAnt AI is running Incremental review

Hey @SBIN2010 how about this?

should we add "Out of tab" property as a default insted of the first tab?

EnxDev avatar Dec 05 '25 15:12 EnxDev

CodeAnt AI is running Incremental review

Hey @SBIN2010 how about this?

should we add "Out of tab" property as a default insted of the first tab?

I added the 'Out of tab' option, but only for those cases where tabs are not pages and all tabs are placed on the first page.

SBIN2010 avatar Dec 05 '25 20:12 SBIN2010

🎪 Showtime is building environment on GHA for 959563a

github-actions[bot] avatar Dec 08 '25 21:12 github-actions[bot]

🎪 Showtime deployed environment on GHA for 959563a

Environment: http://52.26.101.174:8080 (admin/admin) • Lifetime: 48h auto-cleanup • Updates: New commits create fresh environments automatically

github-actions[bot] avatar Dec 08 '25 21:12 github-actions[bot]