GitHub user VasilijeBursac edited a comment on the discussion: Customize 
loading spinner position and appereance

Hi everyone!

I wanted to tackle this functionality and contribute my first PR to the 
Superset repo, but I ran into some design questions and would really appreciate 
your input.

## Goal
My initial idea was to allow setting a custom loading animation (e.g. 
`loading.gif`) via a theme token for specifying path to custom `loading.gif` 
file, similar to how `brandLogoUrl` token works. I thought this would provide a 
clean and flexible way to swap out the default loader on a per-theme basis.

## What I Tried
I added a new `loadingAnimationUrl: string` token to the 
`SupersetSpecificTokens` interface in
`/superset-frontend/packages/superset-ui-core/src/theme/types.ts`. Though, 
maybe `loadingGifUrl` token name would be a better fit in this case.

Then I tried to find all the places where the default `loading.gif` file is 
used, with the idea of replacing it with `theme.loadingAnimationUrl`. However, 
I quickly ran into a problem:

The loader is used in both the Jinja base template 
(`superset/templates/superset/spa.html`) and also in React components (e.g. 
`ChartLayer.tsx`, `DatasetPanel.tsx`)

## My Dilemma
Since these are two separate rendering layers (Jinja + React), I'm unsure what 
would be the best approach to share the custom `loading.gif` path between them.

**Here are two approaches I considered:**

**Option 1: Custom Theme Token (`theme.loadingAnimationUrl`):**
- **Pros:** Keeps the config fully within the theme system. React components 
can easily access it.
- **Cons:** How can we make this value accessible in the base Jinja template 
(spa.html)?

**Option 2: Additional config in `superset_config.py` (similar to setting 
custom favicon or custom fonts):**
- **Pros:** Simple to access from Jinja via config.
- **Cons:** How can we access it in the frontend React components? Also, it is 
less flexible, since it wouldn't support per-theme custom loaders — just one 
global .gif file per app.

## Setting loader position
As @danielvodnanskyextconradcom stated, it might also be useful to allow custom 
positioning of the loading gif via the theme tokens. I assume that it could 
probably be realized according to the same principle as the path itself, but 
due to the very nature and complexity of setting the position, this is probably 
a bit more difficult and more cumbersome to do through theme.

Would love to hear your thoughts. Am I on the right track? Maybe @mistercrunch, 
@rusackas  can chime in with their insights or advice?

Thanks in advance!

GitHub link: 
https://github.com/apache/superset/discussions/28768#discussioncomment-13952804

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to