alex-poor opened a new pull request, #37109: URL: https://github.com/apache/superset/pull/37109
- Add download button with CSV/XLS options to drill detail modal - Reuse existing chart export infrastructure - Maintain query context and filters in downloads - Support both CSV and XLSX formats Closes #27607 <!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY Adds CSV and XLSX download functionality to the "Drill to Detail" modal, addressing feature request #27607. Users can now export drill-down data directly from the detail modal, matching the download capability already available at the chart level. This enhancement uses the existing export infrastructure, maintaining consistency with current download patterns. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF **Before:** No download option in drill detail modal **After:** Added download button with CSV and XLSX export options: <img width="1760" height="1089" alt="swappy-20260114-103419" src="https://github.com/user-attachments/assets/d8f429a4-9cec-4491-a697-52ad0dc8390e" /> Download menu with format options: <img width="897" height="1062" alt="swappy-20260114-103459" src="https://github.com/user-attachments/assets/2a356141-e164-45fc-8aee-b0b74efd9e63" /> Successfully exported data: <img width="374" height="336" alt="swappy-20260114-103709" src="https://github.com/user-attachments/assets/224ae037-0425-4b0f-94cb-1457e65fc952" /> ### TEST PLAN **Manual Testing Completed:** - [x] Created multiple chart types (bar, line, table) with drill-to-detail capability - [x] Verified download button appears in drill detail modal header - [x] Tested CSV export - data matches modal display - [x] Tested XLSX export - data matches modal display - [x] Verified downloads maintain all drill-down filters - [x] Tested with large datasets (500+ rows) - download completes successfully - [x] Verified special characters (UTF-8) export correctly - [x] Tested with various data types (text, numbers, dates, nulls) - [x] Confirmed no console errors during operation - [x] Verified UI follows existing Superset design patterns - [x] Download button placement matches chart-level download UX **Automated Testing:** - [x] Frontend production build completes successfully (`npm run build`) - [x] ESLint passes with no errors - [x] All existing tests pass (CI will verify) **Browser Testing:** - Tested on: Chromium (primary development browser)/Firefox - Expected to work on: Chrome, Safari, Edge (standard download API) **Edge Cases Verified:** - Empty drill results: Download creates file with headers only - Null values: Exported as empty cells - Long text fields: Properly escaped in CSV - Date/datetime fields: Formatted consistently ### ADDITIONAL INFORMATION **Implementation Details:** - Leverages existing download infrastructure from chart-level exports - Uses standard browser download API (no new dependencies) - Download button integrated into drill detail modal header/footer - Supports both CSV and XLSX formats via existing export endpoints - Query context (filters, groupings, drill-down parameters) preserved in exports - File naming follows pattern: `[timestamp].[csv|xlsx]` **Code Changes:** - Modified: `superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx` - Added download button component with dropdown menu - Wired click handlers to existing export functions - No backend changes required - uses existing API endpoints **Design Decisions:** - Placed download button in modal footer alongside "Edit Chart" button for consistency - Reused `Icons.DownOutlined` and Ant Design Dropdown for familiar UX - Matched styling/behavior of chart-level download for consistency - Used existing translation keys where possible **Technical Notes:** - No database migrations required - No new API endpoints needed - Backward compatible - works with existing Superset installations - No performance impact on modal rendering - File generation handled by existing backend CSV/XLS writers **Future Enhancements (Out of Scope):** - Additional export formats (JSON, Parquet) - Download progress indicator for very large datasets - Custom file naming options **Related Issues:** Closes #27607 ### CONTRIBUTING.md Checklist: - [x] My PR addresses the following Superset Issue: #27607 - [x] I have read [the Superset contributing guidelines](https://github.com/apache/superset/blob/master/CONTRIBUTING.md) - [x] My code follows the code style of this project - [ ] My change requires a change to the documentation (No - feature is self-explanatory in UI) - [ ] I have updated the documentation accordingly (N/A) - [x] I have added tests to cover my changes (Will verify with maintainer if additional tests needed) - [x] All new and existing tests passed Attribution: claude-code utilised to draft this code and PR. -- 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]
