From 9fe9285b07f696ae961d17bdfd9389a06b70ebd1 Mon Sep 17 00:00:00 2001 From: secustor Date: Thu, 25 Jan 2024 16:46:18 +0100 Subject: [PATCH] feat(plugins/home/FeatureDocsCard): use EntityDisplayName rather then data direct Signed-off-by: secustor --- .changeset/nasty-shirts-look.md | 4 ++-- .../src/homePageComponents/FeaturedDocsCard/Content.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.changeset/nasty-shirts-look.md b/.changeset/nasty-shirts-look.md index 2742ebd1f6..2a6e2d9c19 100644 --- a/.changeset/nasty-shirts-look.md +++ b/.changeset/nasty-shirts-look.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-home': patch +'@backstage/plugin-home': minor --- -Fall back to metadata.name if no metadata.title has been defined +Use EntityDisplayName JSX element entity information directly for FeaturedDocsCard. diff --git a/plugins/home/src/homePageComponents/FeaturedDocsCard/Content.tsx b/plugins/home/src/homePageComponents/FeaturedDocsCard/Content.tsx index 21ed43003b..a7ba4d5e9b 100644 --- a/plugins/home/src/homePageComponents/FeaturedDocsCard/Content.tsx +++ b/plugins/home/src/homePageComponents/FeaturedDocsCard/Content.tsx @@ -23,11 +23,16 @@ import { Progress, ErrorPanel, } from '@backstage/core-components'; -import { catalogApiRef, CatalogApi } from '@backstage/plugin-catalog-react'; +import { + catalogApiRef, + CatalogApi, + EntityDisplayName, +} from '@backstage/plugin-catalog-react'; import { useApi } from '@backstage/core-plugin-api'; import { EntityFilterQuery } from '@backstage/catalog-client'; import { makeStyles, Typography } from '@material-ui/core'; +import { stringifyEntityRef } from '@backstage/catalog-model'; /** * Props customizing the component. @@ -116,7 +121,7 @@ export const Content = (props: FeaturedDocsCardProps): JSX.Element => { }/` } > - {d.metadata.title ?? d.metadata.name} + {d.metadata.description && (