-
Notifications
You must be signed in to change notification settings - Fork 16.6k
fix(explore): Fix downloading as image charts which use Mapbox #13181
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
Conversation
|
As the dependent PRs are probably best tested and merged in one go, I can review and test this tomorrow morning CET unless someone beats me to it. |
5c55c84 to
ecf710d
Compare
villebro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested along with the accompanying PRs - I can confirm that all charts download nicely as images, and I wasn't able to see any noticeable performance degradation due to this. Unless someone has any objections I propose merging the superset-ui PRs, bumping the package versions here and merging this.
|
@kgabryje the dependent PRs have now been merged and deployed (btw, this also needs a rebase). The 0.17.10 release of |
ecf710d to
1cc2497
Compare
|
@villebro Done. I bumped only deckgl as you suggested. We can put off bumping superset-ui, but until we do, only a gray background will get downloaded when user tries to save Mapbox chart as image (before the fix, it just failed silently and nothing got downloaded). |
Codecov Report
@@ Coverage Diff @@
## master #13181 +/- ##
===========================================
+ Coverage 53.06% 72.86% +19.80%
===========================================
Files 489 555 +66
Lines 17314 20544 +3230
Branches 4482 5377 +895
===========================================
+ Hits 9187 14969 +5782
+ Misses 8127 5447 -2680
- Partials 0 128 +128
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Thanks @kgabryje ! Let me open up a bump PR so we can get these in asap. |
|
@villebro I am gonna do a round of QA in master once you are done with all merging😃 thank you Ville! |
SUMMARY
Due to Mapbox controls being loaded from different origin, it was impossible to convert Mapbox canvas to base64 encoded image due to CORS policy of
HTMLCanvasElement.toDataURLmethod (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL#exceptions). This PR fixes it by filtering out div that contains control elements (such as Mapbox logo).This PR needs apache-superset/superset-ui-plugins-deckgl#25 and apache-superset/superset-ui#965 to be merged and respective packages to be bumped to work properly. Mapbox and DeckGL components need to have
preserveDrawingBufferprop set to true - otherwise only a gray background is getting captured. This change may affect performance of MapBox and DeckGL charts - I'd appreciate some stress tests and verifying if performance is acceptable when compared to current versionBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: see #12745


After:
TEST PLAN
ADDITIONAL INFORMATION
CC: @villebro @junlincc @altef