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: In chart gallery thumbnail is rendered in case of no example in #16707 #26415

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

sivasathyaseeelan
Copy link
Contributor

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

  • Has associated issue: Fixes [Gallery] Some chart type in gallery do not have example #16707
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3a7d76c) 69.15% compared to head (66790e3) 69.16%.

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     
Flag Coverage Δ
javascript 56.49% <100.00%> (+<0.01%) ⬆️

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.

</SectionTitle>
<Examples>
{(selectedVizMetadata?.exampleGallery || []).map(example => (
{selectedVizMetadata?.exampleGallery.length ? (
Copy link
Member

@michael-s-molina michael-s-molina Jan 5, 2024

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>

Copy link
Contributor Author

@sivasathyaseeelan sivasathyaseeelan Jan 5, 2024

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?

Copy link
Member

Choose a reason for hiding this comment

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

👍🏼

Copy link
Member

@michael-s-molina michael-s-molina left a 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!

@rusackas rusackas merged commit 6d58566 into apache:master Jan 8, 2024
30 checks passed
@michael-s-molina michael-s-molina added v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch labels Jan 9, 2024
michael-s-molina pushed a commit that referenced this pull request Jan 9, 2024
michael-s-molina pushed a commit that referenced this pull request Jan 9, 2024
josedev-union pushed a commit to Ortege-xyz/studio that referenced this pull request Jan 22, 2024
@mistercrunch mistercrunch added 🍒 3.0.3 🍒 3.0.4 🍒 3.1.0 🍒 3.1.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch 🍒 3.0.3 🍒 3.0.4 🍒 3.1.0 🍒 3.1.1 🍒 3.1.2 🍒 3.1.3 🚢 4.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Gallery] Some chart type in gallery do not have example
4 participants