RehanIslam09 opened a new pull request, #42238: URL: https://github.com/apache/superset/pull/42238
## SUMMARY Adds an optional download control for charts rendered through standalone Explore URLs. Standalone chart embeds currently hide the Explore chart header, which also makes the existing data export actions unavailable. This change introduces a new `show_download` URL parameter that allows standalone chart embeds to explicitly expose a compact download control without displaying the full Explore interface. Example: `/explore/p/<permalink-key>/?standalone=1&show_download=1` The download control is opt-in and remains hidden when `show_download` is absent or disabled, preserving the existing standalone behavior. The control also respects the existing `can_download` permission. When enabled, users can export chart data as: - CSV - JSON - Excel The existing Explore data export logic has been extracted into a reusable `useExploreDataExport` hook. Both the standard Explore actions menu and the new standalone download control use this shared implementation, avoiding duplicated export behavior and preserving existing functionality such as streaming CSV exports and export error handling. ## BEFORE / AFTER ### Before Standalone charts rendered with `standalone=1` do not expose data export controls. ### After Adding `show_download=1` displays a compact download button in the top-right corner of the standalone chart. The download menu provides CSV, JSON, and Excel export options. <img width="1705" height="421" alt="image" src="https://github.com/user-attachments/assets/fbab842e-bb08-481b-a272-d0ffa94b2e2a" /> Exports use the existing chart export functionality. <img width="1705" height="384" alt="image" src="https://github.com/user-attachments/assets/0027008d-ff4d-4651-b333-f54db14712b2" /> ## TESTING INSTRUCTIONS 1. Create or open a chart in Explore. 2. Generate a permalink for the chart. 3. Open the standalone permalink without `show_download`: `?standalone=1` - Verify that the download control is not displayed. 4. Open the permalink with: `?standalone=1&show_download=0` - Verify that the download control is not displayed. 5. Open the permalink with: `?standalone=1&show_download=1` - Verify that the download control is displayed for a user with download permissions. 6. Open the download menu. 7. Verify that CSV export successfully downloads the chart data. 8. Verify that JSON export successfully downloads the chart data. 9. Verify that Excel export successfully downloads the chart data. 10. Verify that users without download permissions do not see the download control. 11. Verify that `show_download=1` does not add the standalone download control outside standalone mode. ## AUTOMATED TESTS Added coverage for the standalone download control behavior: - Download control is hidden when `show_download` is absent. - Download control is hidden when `show_download=0`. - Download control is displayed when `show_download=1` and the user has download permission. - Download control is hidden when the user does not have download permission. - Download control is hidden outside standalone mode. Relevant test suites: - `ExploreChartPanel.test.tsx` - `useExploreAdditionalActionsMenu.test.tsx` Results: - 2 test suites passed - 20 tests passed - 0 test failures Additional validation: - Prettier check passed. - Oxlint completed with 0 errors. - `git diff --check` passed. - CSV, JSON, and Excel exports were manually verified. Closes #42224 -- 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]
