-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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: In chart gallery thumbnail is rendered in case of no example in #16707 #26415
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #26415 +/- ##
=======================================
Coverage 69.15% 69.16%
=======================================
Files 1947 1947
Lines 76010 76009 -1
Branches 8481 8481
=======================================
+ Hits 52565 52568 +3
+ Misses 21264 21261 -3
+ Partials 2181 2180 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
</SectionTitle> | ||
<Examples> | ||
{(selectedVizMetadata?.exampleGallery || []).map(example => ( | ||
{selectedVizMetadata?.exampleGallery.length ? ( |
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.
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>
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.
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,
<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?
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.
👍🏼
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.
LGTM. Thanks for the improvement @sivasathyaseeelan!
…pache#16707 (apache#26415) (cherry picked from commit 6d58566)
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
Screencast.from.05-01-24.03.39.58.PM.IST.webm
AFTER
Screencast.from.05-01-24.03.41.23.PM.IST.webm
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