diff --git a/.changeset/curvy-rocks-guess.md b/.changeset/curvy-rocks-guess.md new file mode 100644 index 0000000000..db55ef422e --- /dev/null +++ b/.changeset/curvy-rocks-guess.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-org': patch +--- + +allow the title of the card to use the title of the entity, if it is set. diff --git a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.stories.tsx b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.stories.tsx index f183ab4d8e..526d7c9c4c 100644 --- a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.stories.tsx +++ b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.stories.tsx @@ -128,3 +128,33 @@ export const ExtraDetails = () => ( ); + +const groupWithTitle: GroupEntity = { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-a', + description: 'Team A description', + title: 'Team A title', + }, + spec: { + profile: { + email: 'team-a@example.com', + picture: + 'https://avatars.dicebear.com/api/identicon/team-a@example.com.svg?background=%23fff&margin=25', + }, + type: 'group', + children: [], + }, + relations: [dummyDepartment], +}; + +export const UseGroupTitle = () => ( + + + + + + + +); diff --git a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx index 5e795b2710..e8f06e49b3 100644 --- a/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx +++ b/plugins/org/src/components/Cards/Group/GroupProfile/GroupProfileCard.tsx @@ -81,7 +81,7 @@ export const GroupProfileCard = (props: { } const { - metadata: { name, description, annotations, links }, + metadata: { name, description, title, annotations, links }, spec: { profile }, } = group; @@ -99,7 +99,7 @@ export const GroupProfileCard = (props: { const entityMetadataEditUrl = group.metadata.annotations?.[ANNOTATION_EDIT_URL]; - const displayName = profile?.displayName ?? name; + const displayName = profile?.displayName ?? title ?? name; const emailHref = profile?.email ? `mailto:${profile.email}` : '#'; const infoCardAction = entityMetadataEditUrl ? (