mistercrunch commented on code in PR #34182:
URL: https://github.com/apache/superset/pull/34182#discussion_r2220868159
##########
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();
+ }
+ }
Review Comment:
That's right, though we might need it in the future (?) might be attached to
user prefs in the future. Can keep for now.
--
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]