mistercrunch opened a new pull request, #34560: URL: https://github.com/apache/superset/pull/34560
Second/better take on https://github.com/apache/superset/pull/34510 This commit implements a comprehensive UI-based theme administration system for Apache Superset, replacing the UUID-based configuration approach with an intuitive admin interface. ## Major Features ### Database Schema Changes - Added `is_system_default` and `is_system_dark` boolean fields to Theme model - Added database indexes for performance optimization on system theme queries - Created Alembic migration handling existing data with proper nullable column management ### Backend API Enhancements - New REST endpoints for system theme management: - `PUT /api/v1/theme/{id}/set_system_default` - Set theme as system default - `PUT /api/v1/theme/{id}/set_system_dark` - Set theme as system dark - `DELETE /api/v1/theme/unset_system_default` - Clear system default theme - `DELETE /api/v1/theme/unset_system_dark` - Clear system dark theme - Atomic operations ensuring only one theme can be system default/dark at a time - Admin-only permission enforcement for all system theme operations - Protection against deletion of themes set as system themes ### Frontend UI Components - Visual indicators for system themes using sun/moon icons with semantic colors - Action buttons for setting/unsetting system themes with confirmation dialogs - Proper deletion protection for system themes in both single and bulk operations - Comprehensive error handling with user-friendly toast notifications ### Configuration Simplification - Replaced complex `THEME_SETTINGS` dictionary with simple `ENABLE_UI_THEME_ADMINISTRATION` boolean - Maintained backward compatibility with deprecated `THEME_SETTINGS` configuration - Simplified theme enforcement: `THEME_DARK = None` forces single theme for all users - Automatic OS preference detection when both light and dark themes are available ### Theme Bootstrap Integration - Enhanced theme bootstrap data to include system theme information - Fallback logic when database themes are invalid or missing - Seamless integration with existing theme controller and frontend infrastructure ### Comprehensive Testing - Full test coverage for all new API endpoints and permission checks - Frontend component tests with proper mock data and user interaction testing - Integration tests verifying admin permissions and system theme constraints - Database migration tests ensuring proper data handling ## Technical Improvements - Atomic database operations using bulk UPDATE queries for consistency - Type-safe frontend implementation with proper TypeScript definitions - Optimized database queries with strategic indexing - Clean separation of concerns between UI administration and configuration-based themes - Documentation updates reflecting the new UI-based workflow ## Breaking Changes - `THEME_SETTINGS` dictionary is now deprecated (backward compatible) - System theme management now requires admin privileges - Theme deletion is blocked for themes set as system default or dark -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org