You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "ERGO1995 (via GitHub)" <gi...@apache.org> on 2024/12/19 10:10:58 UTC
[PR] feat(Loader) add LOADERS variable in config files to enable custom loader gif [superset]
ERGO1995 opened a new pull request, #31565:
URL: https://github.com/apache/superset/pull/31565
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Added a LOADERS variable in the configuration files config.py and superset_config.py:
- config.py default value → LOADERS = [{"src": "/static/assets/images/loading.gif"}]
- superset_config.py → LOADERS = [{"src": "/static/assets/images/YOUR_GIF.gif"}] (for exemple)
Managed the loader in Superset's base HTML skeleton:
- superset/superset/templates/superset/basic.html
Retrieved the custom loader in Superset API endpoints:
- superset/superset/views/core.py → Added an endpoint to retrieve the loader from the configuration file.
Managed the loader in Superset's React.js elements:
- superset/superset-frontend/src/components/Loading/index.tsx → Fetches the custom loader via the new endpoint.
I'm very new to Superset and the open-source world, and this is my first attempt. I'm open to any advice on how to make this cleaner if needed :)
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
### TESTING INSTRUCTIONS
Don't setup the LOADERS in superset_config.py file to see the default loader. Then add tyour custom gif to see the difference.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "ERGO1995 (via GitHub)" <gi...@apache.org>.
ERGO1995 commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2566273348
@rusackas I noticed that the loader is not handled properly in an embedding context. The image does not load. Do you have any idea what might be causing this issue? I came across a topic that could potentially relate to my problem, but the lines referenced in config.py no longer seem relevant (https://github.com/apache/superset/issues/28112#issuecomment-2062595472) @mistercrunch.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(Loader) add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2555028667
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/31565?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `66.66667%` with `2 lines` in your changes missing coverage. Please review.
> Project coverage is 65.33%. Comparing base [(`76d897e`)](https://app.codecov.io/gh/apache/superset/commit/76d897eaa2f9e137102bc194c2e3109c29d0348f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`6197113`)](https://app.codecov.io/gh/apache/superset/commit/6197113c41c4a5f931c7cf11e834cf6243bba162?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1200 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/31565?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/views/core.py](https://app.codecov.io/gh/apache/superset/pull/31565?src=pr&el=tree&filepath=superset%2Fviews%2Fcore.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | 60.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/31565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #31565 +/- ##
==========================================
+ Coverage 60.48% 65.33% +4.84%
==========================================
Files 1931 538 -1393
Lines 76236 39130 -37106
Branches 8568 0 -8568
==========================================
- Hits 46114 25565 -20549
+ Misses 28017 13565 -14452
+ Partials 2105 0 -2105
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/31565/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/31565/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `48.76% <66.66%> (-0.41%)` | :arrow_down: |
| [javascript](https://app.codecov.io/gh/apache/superset/pull/31565/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/31565/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.27% <66.66%> (-0.54%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/31565/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.33% <66.66%> (+1.84%)` | :arrow_up: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/31565/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.86% <66.66%> (+3.23%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/31565?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "ERGO1995 (via GitHub)" <gi...@apache.org>.
ERGO1995 commented on code in PR #31565:
URL: https://github.com/apache/superset/pull/31565#discussion_r1995659349
##########
superset-frontend/src/components/Loading/index.tsx:
##########
@@ -61,6 +60,38 @@ export default function Loading({
image,
className,
}: Props) {
+ const [Loader, setLoader] = useState<string | undefined>(undefined);
+ useEffect(() => {
+ console.log('Fetching loader...');
+ fetch('/superset/loader/', {
+ method: 'GET',
+ credentials: 'include',
+ })
+ .then(response => {
+ console.log('Response status:', response.status);
+ if (!response.ok) {
+ if (response.status === 401) {
+ console.error('User is not authenticated');
+ } else if (response.status === 403) {
+ console.error('User does not have permission to access this endpoint');
+ }
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
+ return response.json();
+ })
+ .then(data => {
+ console.log('Received data:', data);
+ // Vérifie si l'objet a une clé "src" et l'assigne
Review Comment:
done 👍
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "ERGO1995 (via GitHub)" <gi...@apache.org>.
ERGO1995 commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2565178341
@rusackas thank you for your feedback. Yes, I agree that it would be cleaner. I'll take care of it.
As for the array, I followed the same approach as for the FAVICONS. I probably didn’t quite understand why they were in array form as well?
Otherwise, for this new element, I saw a GitHub issue mentioning loader customization. This could serve as a basis in case we want to add keys like the positioning of the loader or other ideas.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2963704516
Need a rebase on this one... but also I'm working on introducing a native SVG loader that's themable (as part of the newer Theming effort). I'll try to make sure we can fall back to a specified GIF (or whatever) if present.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #31565:
URL: https://github.com/apache/superset/pull/31565#discussion_r1894285370
##########
superset/config.py:
##########
@@ -109,6 +109,7 @@
# },
FAVICONS = [{"href": "/static/assets/images/favicon.png"}]
+LOADERS = [{"src": "/static/assets/images/loading.gif"}]
Review Comment:
Perhaps this is a bit of a side mission for another PR, or it could be part of this, but I notice we have the FAVICON and LOADERS up here. APP_ICON is waaaaay down below, but maybe they should live together in the config?
LOADERS could also probably use a comment explaining what it is, for anyone learning what they can config.
Is there a reason it's an array? Can you use more than one? If it's just a single GIF, it should probably be more singular like APP_ICON. And to be crazy pedantic, maybe it should just be "LOADER" rather than "LOADERS"
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2571464014
It feels like all this should be included in the theme object eventually.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2967669279
Wanted to note that the theming branch now includes tokens for the logo img, positioning and scaling. I believe it's probably the right place to also reference a custom spinner. This is likely to conflict with the theming branch and break the inteferface. Would recommend targeting the theming branch of waiting for it to merge to open something that's cohesive with the work taking place there.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2722360770
Heya... this hasn't been touched in a while, and has a bunch of CI issues, including pre-commit failures.
Superset uses Git pre-commit hooks courtesy of [pre-commit](https://pre-commit.com/). To install run the following:
```
pip3 install -r requirements/development.txt
pre-commit install
A series of checks will now run when you make a git commit.
```
Alternatively it is possible to run pre-commit by running pre-commit manually:
```
pre-commit run --all-files
```
I'm still not sure how to solve the embedded context issue, have you had any luck there? I suspect there needs to be a CSP adjustment made somewhere, but maybe you can see something in your browser logs?
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2970713033
Was talking with @ERGO1995 on Slack... we'll wait a bit for this one. I'll just mark it as Draft 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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "ERGO1995 (via GitHub)" <gi...@apache.org>.
ERGO1995 commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2724828575
> Heya... this hasn't been touched in a while, and has a bunch of CI issues, including pre-commit failures.
>
> Superset uses Git pre-commit hooks courtesy of [pre-commit](https://pre-commit.com/). To install run the following:
>
> ```
> pip3 install -r requirements/development.txt
> pre-commit install
> A series of checks will now run when you make a git commit.
> ```
>
> Alternatively it is possible to run pre-commit by running pre-commit manually:
>
> ```
> pre-commit run --all-files
> ```
>
> I'm still not sure how to solve the embedded context issue, have you had any luck there? I suspect there needs to be a CSP adjustment made somewhere, but maybe you can see something in your browser logs?
Hey, i don't understand cause i already use pre commit and i have this when i commit something:

--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-3644029992
Closing this stale draft PR. It has been inactive for about 6 months and would need a rebase on `master` given the 12 months since it was opened.
I believe this functionality has largely been addressed by the Theming effort, but if there's more to do here, we welcome the discussion. Feel free to open an issue or fresh PR if you'd like to continue this work.
@ERGO1995 thanks for your contribution!
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on code in PR #31565:
URL: https://github.com/apache/superset/pull/31565#discussion_r1994214974
##########
superset-frontend/src/components/Loading/index.tsx:
##########
@@ -61,6 +60,38 @@ export default function Loading({
image,
className,
}: Props) {
+ const [Loader, setLoader] = useState<string | undefined>(undefined);
+ useEffect(() => {
+ console.log('Fetching loader...');
+ fetch('/superset/loader/', {
+ method: 'GET',
+ credentials: 'include',
+ })
+ .then(response => {
+ console.log('Response status:', response.status);
+ if (!response.ok) {
+ if (response.status === 401) {
+ console.error('User is not authenticated');
+ } else if (response.status === 403) {
+ console.error('User does not have permission to access this endpoint');
+ }
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
+ return response.json();
+ })
+ .then(data => {
+ console.log('Received data:', data);
+ // Vérifie si l'objet a une clé "src" et l'assigne
Review Comment:
`en` plz
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #31565:
URL: https://github.com/apache/superset/pull/31565#issuecomment-2967673688
Here's a ref of how related things will be done in the future. I'd say we put this one on hold or try to target that branch. Note that there's a lot going on there and should merge into `master` soonish (few weeks at most (?))
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(config): add LOADERS variable in config files to enable custom loader gif [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #31565: feat(config): add LOADERS variable in config files to enable custom loader gif
URL: https://github.com/apache/superset/pull/31565
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org