Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to avoid replacing charts with the Loading logo when charts are n… #30935

Closed
wants to merge 2 commits into from

Conversation

jpchev
Copy link
Contributor

@jpchev jpchev commented Nov 15, 2024

this is to fix issue 27532

SUMMARY

by setting to True the following feature flag in config.py

"DASHBOARD_DISABLE_LOADING": True

one can avoid having charts replaced by the login icon when charts are not in the current view.
This is useful to export all the charts of a dashboard to a pdf file.

TESTING INSTRUCTIONS

after having set the feature flag DASHBOARD_DISABLE_LOADING, see in the DOM that charts don't get replaced by the "loading" img upon scrolling the page.

Fixes #27532

…ot in the current view. Useful to have all charts printed when exporting to pdf
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@dosubot dosubot bot added the dashboard:performance Related to Dashboard performance label Nov 15, 2024
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.85%. Comparing base (76d897e) to head (d031d34).
Report is 977 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #30935       +/-   ##
===========================================
+ Coverage   60.48%   83.85%   +23.36%     
===========================================
  Files        1931      536     -1395     
  Lines       76236    38959    -37277     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    32669    -13445     
+ Misses      28017     6290    -21727     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.82% <ø> (-0.35%) ⬇️
javascript ?
mysql 76.72% <ø> (?)
postgres 76.81% <ø> (?)
presto 53.30% <ø> (-0.51%) ⬇️
python 83.85% <ø> (+20.36%) ⬆️
sqlite 76.28% <ø> (?)
unit 60.82% <ø> (+3.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@kgabryje
Copy link
Member

@jpchev This change doesn't really fix the issue, it only skips the virtualization check - which has the same effect as simply disabling virtualization (DASHBOARD_VIRTUALIZATION = false).

In my opinion, a proper fix would be to move the PDF generation to the backend, as a Celery/Selenium job (like the screenshots - see ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT flag). Until then, disabling virtualization is the only viable workaround - which should be fine unless you work on some very large dashboards

@jpchev
Copy link
Contributor Author

jpchev commented Nov 18, 2024

@kgabryje ok, do you mean that setting ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT = True would be enough to have the pdf generated on the backend?

I thought that is only for scheduled dashboards

@kgabryje
Copy link
Member

@kgabryje ok, do you mean that setting ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT = True would be enough to have the pdf generated on the backend?

I thought that is only for scheduled dashboards

No, that feature flag enables downloading dashboard as an image through Selenium, not client-side. I meant that we should do a similar thing for downloading as PDF to fix the problem with loading charts

@jpchev
Copy link
Contributor Author

jpchev commented Nov 18, 2024

I'm testing with DASHBOARD_VIRTUALIZATION = false, does't seem to help in embedded dashboards. Do you think it's available in version 4.0.1 ?

BTW, for the generation on the backend, is it enough to set ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT = True
or does that go together with another setup?

Thank you

@kgabryje
Copy link
Member

TBH I don't really know the details of that feature, but perhaps @geido knows more?

@jpchev
Copy link
Contributor Author

jpchev commented Nov 18, 2024

it seems ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT has been added in 4.1.0,
I'll migrate as soon as the helm chart is ready (I'm on kubernetes).

UPDATE: DASHBOARD_VIRTUALIZATION = False seems to work, I had set it up in the wrong place (not in the FEATURE_FLAGS dictionary), now it has the same effect of my PR.

Thank you

@geido
Copy link
Member

geido commented Nov 18, 2024

I'm testing with DASHBOARD_VIRTUALIZATION = false, does't seem to help in embedded dashboards. Do you think it's available in version 4.0.1 ?

BTW, for the generation on the backend, is it enough to set ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT = True or does that go together with another setup?

Thank you

You also need ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS

@jpchev
Copy link
Contributor Author

jpchev commented Nov 18, 2024

closing this PR as not relevant anymore

@jpchev jpchev closed this Nov 18, 2024
@jpchev jpchev deleted the fix/pdf_charts_not_in_view branch November 19, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:performance Related to Dashboard performance packages size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export to PDF leaves charts empty on first export
3 participants