fix(dashboard): make system default/dark themes assignable to a dashboard - #44361
sadpandajoe wants to merge 2 commits into
Conversation
…oard The dashboard properties "Theme" dropdown fetched /api/v1/theme/ with an is_system=false filter, hiding the two config-seeded system themes (THEME_DEFAULT/THEME_DARK) even though SeedSystemThemesCommand already persists them as Theme rows on every app boot. Users could not pin a dashboard to a specific system theme to keep custom CSS stable regardless of viewer dark-mode preference. Fixes #37289
Code Review Agent Run #1a5d22Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #44361 +/- ##
==========================================
- Coverage 80.28% 80.28% -0.01%
==========================================
Files 2929 2929
Lines 174176 174176
Branches 40450 40450
==========================================
- Hits 139843 139840 -3
- Misses 31676 31679 +3
Partials 2657 2657
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SUMMARY
The dashboard properties "Theme" dropdown fetches
/api/v1/theme/with anis_system eq falsefilter (superset-frontend/src/dashboard/components/PropertiesModal/index.tsx), which hides the two system themes. Contrary to a GitHub bot comment on the issue claiming THEME_DEFAULT/THEME_DARK are "not stored as database rows,"SeedSystemThemesCommand(superset/commands/theme/seed.py) already upserts them asThemerows withis_system=Trueon every app start (superset/app.py ->sync_config_to_db). Since user-created themes are always created withis_system=False(superset/themes/api.py), the client-side filter is exactly what hid the two system themes from the picker — no backend/schema change is needed. This PR removes that filter so THEME_DEFAULT/THEME_DARK become selectable, letting a dashboard be pinned to a specific theme regardless of a viewer's OS/browser dark-mode preference (the reported use case: dashboards with custom CSS written for a light theme break when a viewer's system prefers dark).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No screenshots captured — this environment has no running Superset instance to render the dropdown against. The change and its effect (system themes appear as extra options in
dashboard-theme-select) are covered by the added Jest regression test instead.TESTING INSTRUCTIONS
ADDITIONAL INFORMATION