mistercrunch commented on code in PR #34182: URL: https://github.com/apache/superset/pull/34182#discussion_r2220857578
########## superset-frontend/src/theme/ThemeController.ts: ########## @@ -236,6 +246,76 @@ export class ThemeController { this.updateTheme(defaultTheme); } + /** + * Sets a CRUD theme by ID. This will fetch the theme from the API and apply it. + * @param themeId - The ID of the CRUD theme to apply + */ + public async setCrudTheme(themeId: string | null): Promise<void> { + this.crudThemeId = themeId; + + if (themeId) { + this.storage.setItem(STORAGE_KEYS.CRUD_THEME_ID, themeId); + try { + const themeConfig = await this.fetchCrudTheme(themeId); + if (themeConfig) { + this.updateTheme(themeConfig); + } + } catch (error) { + console.error('Failed to load CRUD theme:', error); + this.fallbackToDefaultMode(); + } + } else { + this.storage.removeItem(STORAGE_KEYS.CRUD_THEME_ID); + this.resetTheme(); + } + } + + /** + * Sets a temporary theme override for development purposes. + * This does not persist the theme but allows live preview. + * @param theme - The theme configuration to apply temporarily + */ + public setTemporaryTheme(theme: AnyThemeConfig): void { + this.validateThemeUpdatePermission(); + + this.devThemeOverride = theme; + this.storage.setItem( + STORAGE_KEYS.DEV_THEME_OVERRIDE, + JSON.stringify(theme), + ); + + const normalizedTheme = this.normalizeTheme(theme); + this.updateTheme(normalizedTheme); + } Review Comment: Right, it applies/persist for the current user using local storage, use can "clear local settings" to fallback on the system default + light/dark preferences -- 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