AxisCommunications / backstage-plugins

Backstage Plugins Created by Axis Communications
MIT License
32 stars 17 forks source link

Hide ReadmeCard if backend returns 404 #194

Closed fridajac closed 1 month ago

fridajac commented 1 month ago

Hey, I just made a Pull Request!

Changes:

Context

Our usability tests show that the EntityPage sometimes gets very cluttered with a lot of information. This results in that the users can't find what they are looking for. We want to fix this by making it possible to not render any ReadmeCard at all, if the README.md is not available (backend returns 404 Not Found).

Screenshots

Before

Screenshot from 2024-10-07 15-07-20

The "No README.md file found at source location"-text is displayed

After

Screenshot from 2024-10-07 15-07-39

No card is displayed

Checklist before requesting a review

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: a790550f8e44a1fb2b368d7f089fa4075c9399f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages | Name | Type | | ------------------------------------- | ----- | | @axis-backstage/plugin-readme-backend | Minor | | @axis-backstage/plugin-readme | Minor | | app | Minor | | backend | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

fridajac commented 1 month ago

LGTM, another way to solve this would be to create an async "haveReadme" function and have the EntitySwitch handle the show/hide logic. Would probably need another (cached) api call.

<EntitySwitch.case if={haveReadme}

That is much better! Thanks!