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(empty dashboards): Allow downloading a screenshot of an empty dashboard #30767

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

msyavuz
Copy link
Contributor

@msyavuz msyavuz commented Oct 31, 2024

SUMMARY

Check if a dashboard contains charts first, if not don't wait for them to load etc. This fixes the bug where if the dashboard is empty screenshot fails.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  1. Create an empty dashboard
  2. Download png/pdf screenshot of the empty dashboard

ADDITIONAL INFORMATION

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.91%. Comparing base (76d897e) to head (38032e5).
Report is 966 commits behind head on master.

Files with missing lines Patch % Lines
superset/utils/webdriver.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #30767       +/-   ##
===========================================
+ Coverage   60.48%   83.91%   +23.43%     
===========================================
  Files        1931      536     -1395     
  Lines       76236    38921    -37315     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    32662    -13452     
+ Misses      28017     6259    -21758     
+ Partials     2105        0     -2105     
Flag Coverage Δ
javascript ?

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.

@geido geido added preset:bounty Issues that have been selected by Preset and have a bounty attached. hold! On hold labels Oct 31, 2024
@pull-request-size pull-request-size bot added size/S and removed size/M labels Nov 4, 2024
@msyavuz msyavuz marked this pull request as ready for review November 6, 2024 10:07
@dosubot dosubot bot added the dashboard:error Related to Dashboard errors label Nov 6, 2024
@geido geido removed the hold! On hold label Nov 13, 2024
superset/utils/webdriver.py Outdated Show resolved Hide resolved
@geido geido changed the title fix(empty dashboards): Check for chart-container first fix(empty dashboards): Allow downloading a screenshot of an empty dashboard Nov 13, 2024
superset/utils/webdriver.py Outdated Show resolved Hide resolved
superset/utils/webdriver.py Outdated Show resolved Hide resolved
Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

I did some text enhancements for comments and errors but the general approach looks fine to me. It would be nice to have a better way to differentiate between an empty dashboard (that will never load any charts) and a dashboard that is waiting for chart containers to draw, but I guess this should do fine for now. I tested it locally too. Thanks!

@geido geido merged commit 58f9be9 into apache:master Nov 13, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:error Related to Dashboard errors preset:bounty Issues that have been selected by Preset and have a bounty attached. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard Screenshot API Endpooint Gives and Error Message when a Dashboard is Empty or has no Charts
3 participants