You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/02 20:15:17 UTC

[GitHub] [superset] lyndsiWilliams opened a new pull request, #22011: fix: Change downloadAsImage to use Superset theme

lyndsiWilliams opened a new pull request, #22011:
URL: https://github.com/apache/superset/pull/22011

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   This PR changes the background color of downloadAsImage to use the Superset theme. Originally, the value for this color was held in a local variable that referenced [this line from our LESS variables file](https://github.com/apache/superset/blob/master/superset-frontend/src/assets/stylesheets/less/variables.less#L34), but was assigned to the color `#F5F5F5`. Since that referenced color is now `#d2edf4` in our LESS variables file, I referenced the matching color in our Superset theme instead (`supersetTheme.colors.primary.light3`).
   
   ### BEFORE/AFTER SCREENSHOTS
   <!--- Skip this if not applicable -->
   I downloaded a chart as an image for both of these screenshots
   #### BEFORE:
   ![dlAsImgBefore](https://user-images.githubusercontent.com/55605634/199593272-d5bb62fc-9e68-4fa9-9281-08c3eb80fdd3.jpg)
   
   #### AFTER:
   ![dlAsImgAfter](https://user-images.githubusercontent.com/55605634/199593307-f1a82452-17fb-4dce-b882-b7cb1455e5d4.jpg)
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   - Open a chart and click the dropdown menu in the header next to the save button
   - Hover over the Download option and click "Download as Image" in the resulting menu
   - Observe the background color
   
   ### 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
   - [ ] 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


[GitHub] [superset] codecov[bot] commented on pull request #22011: fix: Change downloadAsImage to use Superset theme

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #22011:
URL: https://github.com/apache/superset/pull/22011#issuecomment-1301192051

   # [Codecov](https://codecov.io/gh/apache/superset/pull/22011?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22011](https://codecov.io/gh/apache/superset/pull/22011?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a0f8f3d) into [master](https://codecov.io/gh/apache/superset/commit/429f246f7a740cc3230491042f74fe5266c03c37?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (429f246) will **decrease** coverage by `10.07%`.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #22011       +/-   ##
   ===========================================
   - Coverage   65.76%   55.69%   -10.08%     
   ===========================================
     Files        1813     1813               
     Lines       69437    69437               
     Branches     7450     7450               
   ===========================================
   - Hits        45667    38672     -6995     
   - Misses      21850    28845     +6995     
     Partials     1920     1920               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.87% <ø> (ø)` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.77% <ø> (ø)` | |
   | python | `58.05% <ø> (-20.88%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `51.18% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/22011?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/utils/downloadAsImage.ts](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2Rvd25sb2FkQXNJbWFnZS50cw==) | `15.78% <0.00%> (ø)` | |
   | [superset/utils/dashboard\_import\_export.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvZGFzaGJvYXJkX2ltcG9ydF9leHBvcnQucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [superset/tags/core.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFncy9jb3JlLnB5) | `4.54% <0.00%> (-95.46%)` | :arrow_down: |
   | [superset/key\_value/commands/update.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `0.00% <0.00%> (-90.91%)` | :arrow_down: |
   | [superset/key\_value/commands/delete.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL2RlbGV0ZS5weQ==) | `0.00% <0.00%> (-87.88%)` | :arrow_down: |
   | [superset/key\_value/commands/delete\_expired.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL2RlbGV0ZV9leHBpcmVkLnB5) | `0.00% <0.00%> (-84.00%)` | :arrow_down: |
   | [superset/dashboards/commands/importers/v0.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9jb21tYW5kcy9pbXBvcnRlcnMvdjAucHk=) | `15.62% <0.00%> (-76.25%)` | :arrow_down: |
   | [superset/datasets/commands/create.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvY3JlYXRlLnB5) | `30.61% <0.00%> (-69.39%)` | :arrow_down: |
   | [superset/datasets/commands/update.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvdXBkYXRlLnB5) | `25.00% <0.00%> (-69.05%)` | :arrow_down: |
   | [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `24.03% <0.00%> (-69.00%)` | :arrow_down: |
   | ... and [320 more](https://codecov.io/gh/apache/superset/pull/22011/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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


[GitHub] [superset] rusackas commented on a diff in pull request #22011: fix: Change downloadAsImage to use Superset theme

Posted by GitBox <gi...@apache.org>.
rusackas commented on code in PR #22011:
URL: https://github.com/apache/superset/pull/22011#discussion_r1012361552


##########
superset-frontend/src/utils/downloadAsImage.ts:
##########
@@ -77,7 +71,7 @@ export default function downloadAsImage(
     return domToImage
       .toJpeg(elementToPrint, {
         quality: 0.95,
-        bgcolor: GRAY_BACKGROUND_COLOR,
+        bgcolor: supersetTheme.colors.primary.light3,

Review Comment:
   ```suggestion
           bgcolor: supersetTheme.colors.grayscale.light4,
   ```
   This is the small change I'm blabbing about in the git history investigation :P 



-- 
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


[GitHub] [superset] rusackas commented on pull request #22011: fix: Change downloadAsImage to use Superset theme

Posted by GitBox <gi...@apache.org>.
rusackas commented on PR #22011:
URL: https://github.com/apache/superset/pull/22011#issuecomment-1301464213

   I applaud your effort in reinforcing proper theme usage! I also randomly enjoyed a little trip down the commit history that this led to! 
   
   Regarding the comment you refer to in the code and its link to line 34, this gets interesting. At the time of [the PR adding that comment](https://github.com/apache/superset/pull/9819) to the codebase, the referenced line 34 actually pointed to a value that was indeed `#f5f5f5` as the variable added alludes to. Checking your screenshots, it looks like `before` and `after` are both the same color here (slightly blue) but I _think_ the `before` screenshot would/should be `#f5f5f5`, right? I think that rather than changing this value to one based on `primary` (which might be any random color when we get into theming) I would go for the closest supported grayscale color. In the theme, that looks like `grascale.light4` or `#f7f7f7`.
   
   Let me know if that all makes sense :) 


-- 
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


[GitHub] [superset] lyndsiWilliams commented on a diff in pull request #22011: fix: Change downloadAsImage to use Superset theme

Posted by GitBox <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22011:
URL: https://github.com/apache/superset/pull/22011#discussion_r1012369684


##########
superset-frontend/src/utils/downloadAsImage.ts:
##########
@@ -77,7 +71,7 @@ export default function downloadAsImage(
     return domToImage
       .toJpeg(elementToPrint, {
         quality: 0.95,
-        bgcolor: GRAY_BACKGROUND_COLOR,
+        bgcolor: supersetTheme.colors.primary.light3,

Review Comment:
   Yeah, that makes sense to me! Since #f5f5f5 wasn't in the theme I wasn't sure which was the correct color to choose here. Thanks for the point in the right direction! Corrected the color in [`this commit`](https://github.com/apache/superset/pull/22011/commits/34ab7e753991aa3f61d5f13819bb7db70ced9a42).



-- 
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


[GitHub] [superset] lyndsiWilliams merged pull request #22011: fix: Change downloadAsImage to use Superset theme

Posted by GitBox <gi...@apache.org>.
lyndsiWilliams merged PR #22011:
URL: https://github.com/apache/superset/pull/22011


-- 
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