You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sivasathyaseeelan (via GitHub)" <gi...@apache.org> on 2024/01/05 13:22:02 UTC
[PR] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
sivasathyaseeelan opened a new pull request, #26415:
URL: https://github.com/apache/superset/pull/26415
### SUMMARY
This PR solves the issue mentioned in #16707 . I have made VizTypeGallery component to render the thumbnail image for selected chart for which example images are not available.
### BEFORE
[![Before Changes]](https://github.com/apache/superset/assets/95441117/8e39d778-c7bc-49aa-a279-8b6ab99a51ba)
### AFTER
[![After Changes]](https://github.com/apache/superset/assets/95441117/9d5325fd-26e3-42cd-aacd-578b2b379254)
### TESTING INSTRUCTIONS
Kindly go to http://localhost:9000/chart/add and please select any chart so that you can be able to see example images of selected chart
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [x] Has associated issue: Fixes #16707
- [ ] Required feature flags:
- [x] 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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443257993
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Maybe this looks more readable?
```
<Examples>
{(
selectedVizMetadata?.exampleGallery || [
{
url: selectedVizMetadata?.thumbnail,
caption: selectedVizMetadata?.thumbnail,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1444476244
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
👍🏼
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "sivasathyaseeelan (via GitHub)" <gi...@apache.org>.
sivasathyaseeelan commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443321891
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Hi @michael-s-molina, The above piece of code which you have mentioned doesn't render the thumbnail image in case of no exampleGallery.
But,
```jsx
<Examples>
{(selectedVizMetadata?.exampleGallery?.length
? selectedVizMetadata.exampleGallery
: [
{
url: selectedVizMetadata?.thumbnail,
caption: selectedVizMetadata?.name,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
this code works.
Can I go and use this piece of code and modify this PR?
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "sivasathyaseeelan (via GitHub)" <gi...@apache.org>.
sivasathyaseeelan commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443321891
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Hi @michael-s-molina, The above piece of code which you have mentioned doesn't render the thumbnail image in case of no exampleGallery.
But,
```jsx
<Examples>
{(selectedVizMetadata?.exampleGallery?.length
? selectedVizMetadata.exampleGallery
: [
{
url: selectedVizMetadata?.thumbnail,
caption: selectedVizMetadata?.name,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
this code works.
Can I go and use this piece of code, and modify this PR?
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443257993
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Maybe this looks more readable?
```
<Examples>
{(
selectedVizMetadata?.exampleGallery || [
{
url: selectedVizMetadata.thumbnail,
caption: selectedVizMetadata.name,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443257993
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Maybe this looks more readable?
```
<Examples>
{(
selectedVizMetadata?.exampleGallery || [
{
url: selectedVizMetadata?.thumbnail,
caption: selectedVizMetadata?.name,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #26415:
URL: https://github.com/apache/superset/pull/26415#issuecomment-1878684855
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/26415?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: `1 lines` in your changes are missing coverage. Please review.
> Comparison is base [(`3a7d76c`)](https://app.codecov.io/gh/apache/superset/commit/3a7d76cece4408c8e80862ab9db3a38eaaafdc8c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 69.15% compared to head [(`1945380`)](https://app.codecov.io/gh/apache/superset/pull/26415?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 69.15%.
| [Files](https://app.codecov.io/gh/apache/superset/pull/26415?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...ponents/controls/VizTypeControl/VizTypeGallery.tsx](https://app.codecov.io/gh/apache/superset/pull/26415?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9WaXpUeXBlQ29udHJvbC9WaXpUeXBlR2FsbGVyeS50c3g=) | 66.66% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/superset/pull/26415?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 #26415 +/- ##
=======================================
Coverage 69.15% 69.15%
=======================================
Files 1947 1947
Lines 76010 76010
Branches 8481 8481
=======================================
Hits 52565 52565
Misses 21264 21264
Partials 2181 2181
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/26415/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/26415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.48% <66.66%> (ø)` | |
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/26415?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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "sivasathyaseeelan (via GitHub)" <gi...@apache.org>.
sivasathyaseeelan commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443321891
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Hi @michael-s-molina, The above piece of code which you have mentioned doesn't render the thumbnail image in case of no exampleGallery.
But,
```jsx
<Examples>
{(selectedVizMetadata?.exampleGallery?.length
? selectedVizMetadata.exampleGallery
: [
{
url: selectedVizMetadata?.thumbnail,
caption: selectedVizMetadata?.name,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
this code works.
Can I apply this piece of code to modify this PR?
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #26415:
URL: https://github.com/apache/superset/pull/26415
--
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] fix: In chart gallery thumbnail is rendered in case of no example in #16707 [superset]
Posted by "sivasathyaseeelan (via GitHub)" <gi...@apache.org>.
sivasathyaseeelan commented on code in PR #26415:
URL: https://github.com/apache/superset/pull/26415#discussion_r1443321891
##########
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx:
##########
@@ -849,17 +849,26 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
grid-area: examples-header;
`}
>
- {!!selectedVizMetadata?.exampleGallery?.length && t('Examples')}
+ {t('Examples')}
</SectionTitle>
<Examples>
- {(selectedVizMetadata?.exampleGallery || []).map(example => (
+ {selectedVizMetadata?.exampleGallery.length ? (
Review Comment:
Hi @michael-s-molina, The above piece of code which you have mentioned doesn't render the thumbnail image in case of no exampleGallery in my local machine.
But,
```jsx
<Examples>
{(selectedVizMetadata?.exampleGallery?.length
? selectedVizMetadata.exampleGallery
: [
{
url: selectedVizMetadata?.thumbnail,
caption: selectedVizMetadata?.name,
},
]
).map(example => (
<img
key={example.url}
src={example.url}
alt={example.caption}
title={example.caption}
/>
))}
</Examples>
```
this code works.
Can I apply this piece of code to modify this PR?
--
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