geido commented on code in PR #34560: URL: https://github.com/apache/superset/pull/34560#discussion_r2256856568
########## superset-frontend/src/pages/ThemeList/index.test.tsx: ########## @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +describe('ThemesList', () => { + it('uses flat theme structure for enableUiThemeAdministration', () => { + // This test verifies that the component is updated to use the flat theme structure + // The actual component testing would require complex setup with all providers + // For now, we just verify the structure is correct in the component code + + // The component should access: + // bootstrapData?.common?.theme?.enableUiThemeAdministration + // NOT: + // bootstrapData?.common?.theme?.settings?.enableUiThemeAdministration + + expect(true).toBe(true); Review Comment: It's true that it's true ########## superset-frontend/src/pages/ThemeList/index.tsx: ########## @@ -215,6 +233,96 @@ function ThemesList({ addSuccessToast(t('Theme imported')); }; + const handleSetSystemDefault = (theme: ThemeObject) => { Review Comment: I think for these confirmation handler functions there is some opportunity for optimization / drying up ########## superset-frontend/src/pages/ThemeList/index.tsx: ########## @@ -215,6 +233,96 @@ function ThemesList({ addSuccessToast(t('Theme imported')); }; + const handleSetSystemDefault = (theme: ThemeObject) => { + Modal.confirm({ + title: t('Set System Default Theme'), + content: t( + 'Are you sure you want to set "%s" as the system default theme? This will apply to all users who haven\'t set a personal preference.', Review Comment: What controls are we giving to the admins to decide whether individual users can set their own themes? I am thinking that some orgs might just want everybody to stick to the org theme. ########## docs/docs/configuration/theming.mdx: ########## @@ -62,12 +62,13 @@ THEME_DARK = { } } -# Theme behavior settings -THEME_SETTINGS = { - "enforced": False, # If True, forces default theme always - "allowSwitching": True, # Allow users to switch between themes - "allowOSPreference": True, # Auto-detect system theme preference -} +# Enable UI-based theme administration for admins +ENABLE_UI_THEME_ADMINISTRATION = True + +# To force a single theme on all users, set THEME_DARK = None +# When both THEME_DEFAULT and THEME_DARK are defined: +# - Users can manually switch between themes +# - OS preference detection is automatically enabled Review Comment: I think here we are losing on flexibility. We know of use cases in Embedded where users want to be able to control what theme mode is applied. They might have a specific default and dark theme but also the need of setting it programmatically rather than relying on machine preference. Would that ability be lost with this change? -- 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