From d7c8d8c52dd74885360ee81e6baadd928c930ad6 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Wed, 22 Mar 2023 11:25:17 +0000 Subject: [PATCH 1/2] if the title is set use it in the group profile Signed-off-by: Brian Fletcher --- .changeset/curvy-rocks-guess.md | 5 ++++ .../GroupProfile/GroupProfileCard.stories.tsx | 30 +++++++++++++++++++ .../Group/GroupProfile/GroupProfileCard.tsx | 4 +-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .changeset/curvy-rocks-guess.md 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 ? ( Date: Wed, 22 Mar 2023 11:27:47 +0000 Subject: [PATCH 2/2] make changeset less sloppy Signed-off-by: Brian Fletcher --- .changeset/curvy-rocks-guess.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/curvy-rocks-guess.md b/.changeset/curvy-rocks-guess.md index db55ef422e..0ce46f787d 100644 --- a/.changeset/curvy-rocks-guess.md +++ b/.changeset/curvy-rocks-guess.md @@ -2,4 +2,4 @@ '@backstage/plugin-org': patch --- -allow the title of the card to use the title of the entity, if it is set. +Allow the title of the group profile card to use the title of the entity, if it is set.