Bazaar: Added 'isBazaarAvailable' helper

The EntityBazaarInfoCard shows the bazaar data for components that
have a bazaar item linked. The isBazaarAvailable helper makes it
possible to only include the EntityBazaarInfoCard for components
that actually have a bazaar project linked.

Closes #15013

Signed-off-by: Niklas Aronsson <niklasar@axis.com>
This commit is contained in:
Niklas Aronsson
2022-12-30 11:55:08 +01:00
parent 7f4abd5f1c
commit 41d0b0a24a
5 changed files with 45 additions and 5 deletions
+8 -5
View File
@@ -49,17 +49,20 @@ Add a **Bazaar icon** to the Sidebar to easily access the Bazaar. In `packages/a
Add a **Bazaar card** to the overview tab on the `packages/app/src/components/catalog/EntityPage.tsx` add:
```diff
+ import { EntityBazaarInfoCard } from '@backstage/plugin-bazaar';
+ import { EntityBazaarInfoCard, isBazaarAvailable } from '@backstage/plugin-bazaar';
const overviewContent = (
<Grid item md={8} xs={12}>
<EntityAboutCard variant="gridItem" />
</Grid>
+ <Grid item sm={6}>
+ <EntityBazaarInfoCard />
+ </Grid>
+ <EntitySwitch>
+ <EntitySwitch.Case if={isBazaarAvailable}>
+ <Grid item sm={6}>
+ <EntityBazaarInfoCard />
+ </Grid>
+ </EntitySwitch.Case>
+ </EntitySwitch>
{/* ...other entity-cards */}
```