From 752f9bf7034f03da749e55d90861fb75eebb0cb3 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Mon, 6 Jan 2025 12:05:03 +0000 Subject: [PATCH 1/8] feat(MyGroupsSidebarItem): enhance group title display with EntityDisplayName component - This is to ensure increased readability to the user. Signed-off-by: Dhruv Joshi --- .../components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx index 7e82d9f928..bd515f8553 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx @@ -37,6 +37,7 @@ import { entityRouteRef, } from '@backstage/plugin-catalog-react'; import { getCompoundEntityRef } from '@backstage/catalog-model'; +import { EntityDisplayName } from '@backstage/plugin-catalog-react'; /** * MyGroupsSidebarItem can be added to your sidebar providing quick access to groups the logged in user is a member of @@ -66,7 +67,7 @@ export const MyGroupsSidebarItem = (props: { ...(filter ?? {}), }, ], - fields: ['metadata', 'kind'], + fields: ['metadata', 'kind', 'spec'], }); return response.items; @@ -96,7 +97,7 @@ export const MyGroupsSidebarItem = (props: { {groups?.map(function groupsMap(group) { return ( } subtitle={ group.metadata.namespace !== DEFAULT_NAMESPACE ? group.metadata.namespace From 9cf12604057630aae84e841573c845aaa729e114 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Mon, 6 Jan 2025 13:25:53 +0000 Subject: [PATCH 2/8] feat(MyGroupsSidebarItem): Added changeset for the commits Signed-off-by: Dhruv Joshi --- .changeset/purple-years-cross.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/purple-years-cross.md diff --git a/.changeset/purple-years-cross.md b/.changeset/purple-years-cross.md new file mode 100644 index 0000000000..bd41648bc7 --- /dev/null +++ b/.changeset/purple-years-cross.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-org': patch +--- + +Fixed bug in MyGroupsSidebarItem component, for the 'My Squads' section to display a list of Squads using the displayName from the entity config, instead of using the metadata name and title. This is to ensure increased readability to the user. From 63aadf3f22879c8be07cab133e01665edae590c6 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Mon, 6 Jan 2025 14:34:55 +0000 Subject: [PATCH 3/8] fix: update .changeset/purple-years-cross.md Co-authored-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com> Signed-off-by: Dhruv Joshi --- .changeset/purple-years-cross.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/purple-years-cross.md b/.changeset/purple-years-cross.md index bd41648bc7..47110e9bf7 100644 --- a/.changeset/purple-years-cross.md +++ b/.changeset/purple-years-cross.md @@ -2,4 +2,4 @@ '@backstage/plugin-org': patch --- -Fixed bug in MyGroupsSidebarItem component, for the 'My Squads' section to display a list of Squads using the displayName from the entity config, instead of using the metadata name and title. This is to ensure increased readability to the user. +Added support for `spec.profile.displayName` to be used in the `MyGroupsSidebarItem` component via the `EntityDisplayName` component when you are a member of multiple Groups. From 5d175bb0e8b342567cbe32c7062cadb6738204d7 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Mon, 6 Jan 2025 15:43:36 +0000 Subject: [PATCH 4/8] test(MyGroupsSidebarItem): enhance tests to verify displayName for group entities Signed-off-by: Dhruv Joshi --- .../MyGroupsSidebarItem.test.tsx | 253 ++++++++++++------ 1 file changed, 172 insertions(+), 81 deletions(-) diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx index de46be98be..092f020c6b 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx @@ -78,6 +78,9 @@ describe('MyGroupsSidebarItem Test', () => { spec: { type: 'team', children: [], + profile: { + displayName: 'Team A', + }, }, }, ] as Entity[], @@ -111,7 +114,94 @@ describe('MyGroupsSidebarItem Test', () => { }); describe('For users that are members of multiple groups', () => { - it('MyGroupsSidebarItem should display a sub-menu with all their groups and a link to each group', async () => { + it('MyGroupsSidebarItem should display a sub-menu with all their groups, with displaying the title through displayName, and a link to each group', async () => { + const identityApi = mockApis.identity({ + userEntityRef: 'user:default/nigel.manning', + ownershipEntityRefs: ['user:default/nigel.manning'], + }); + const catalogApi = catalogApiMock.mock({ + getEntities: async () => ({ + items: [ + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-a', + title: 'Team A', + namespace: 'default', + }, + spec: { + type: 'team', + children: [], + profile: { + displayName: 'Team A', + }, + }, + }, + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-b', + title: 'Team B', + namespace: 'default', + }, + spec: { + type: 'team', + children: [], + profile: { + displayName: 'Team B', + }, + }, + }, + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-c', + title: 'Team C', + namespace: 'default', + }, + spec: { + type: 'team', + children: [], + profile: { + displayName: 'Team C', + }, + }, + }, + ] as Entity[], + }), + }); + const rendered = await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, + ); + + expect(rendered.getByLabelText('My Squads')).toBeInTheDocument(); + expect(rendered.getByLabelText('Team B')).toBeInTheDocument(); + expect(rendered.getByLabelText('Team C')).toHaveAttribute( + 'href', + '/catalog/default/Group/team-c', + ); + }); + + it('MyGroupsSidebarItem should display the metadata name when the displayName property is not available in the entity', async () => { const identityApi = mockApis.identity({ userEntityRef: 'user:default/nigel.manning', ownershipEntityRefs: ['user:default/nigel.manning'], @@ -180,86 +270,87 @@ describe('MyGroupsSidebarItem Test', () => { }, }, ); - - expect(rendered.getByLabelText('My Squads')).toBeInTheDocument(); - }); - }); - - describe('When an additional filter is not provided', () => { - it('catalogApi.getEntities() should be called with the default filter', async () => { - const identityApi = mockApis.identity({ - userEntityRef: 'user:default/guest', - ownershipEntityRefs: ['user:default/guest'], - }); - const mockCatalogApi = catalogApiMock.mock(); - await renderInTestApp( - - - , - { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, - }, - }, - ); - expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ - filter: [ - { - kind: 'group', - 'relations.hasMember': 'user:default/guest', - }, - ], - fields: ['metadata', 'kind'], - }); - }); - }); - - describe('When an additional filter is provided', () => { - it('catalogApi.getEntities() should be called with an additional filter item', async () => { - const identityApi = mockApis.identity({ - userEntityRef: 'user:default/guest', - ownershipEntityRefs: ['user:default/guest'], - }); - const mockCatalogApi = catalogApiMock.mock(); - await renderInTestApp( - - - , - { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, - }, - }, - ); - expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ - filter: [ - { - kind: 'group', - 'relations.hasMember': 'user:default/guest', - 'spec.type': 'team', - }, - ], - fields: ['metadata', 'kind'], - }); + expect(rendered.getByLabelText('Team-a')).toBeInTheDocument(); + expect(rendered.getByLabelText('Team-b')).toBeInTheDocument(); + expect(rendered.getByLabelText('Team-c')).toBeInTheDocument(); + }); + }); +}); + +describe('When an additional filter is not provided', () => { + it('catalogApi.getEntities() should be called with the default filter', async () => { + const identityApi = mockApis.identity({ + userEntityRef: 'user:default/guest', + ownershipEntityRefs: ['user:default/guest'], + }); + const mockCatalogApi = catalogApiMock.mock(); + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, + ); + expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ + filter: [ + { + kind: 'group', + 'relations.hasMember': 'user:default/guest', + }, + ], + fields: ['metadata', 'kind'], + }); + }); +}); + +describe('When an additional filter is provided', () => { + it('catalogApi.getEntities() should be called with an additional filter item', async () => { + const identityApi = mockApis.identity({ + userEntityRef: 'user:default/guest', + ownershipEntityRefs: ['user:default/guest'], + }); + const mockCatalogApi = catalogApiMock.mock(); + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, + ); + expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ + filter: [ + { + kind: 'group', + 'relations.hasMember': 'user:default/guest', + 'spec.type': 'team', + }, + ], + fields: ['metadata', 'kind'], }); }); }); From 9792e330b6d087979f311ff0ce99b0c2a49ab215 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Mon, 6 Jan 2025 15:46:32 +0000 Subject: [PATCH 5/8] test(MyGroupsSidebarItem): ensure Team A is not rendered in the document Signed-off-by: Dhruv Joshi --- .../components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx index 092f020c6b..9521bcc0a2 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx @@ -195,6 +195,7 @@ describe('MyGroupsSidebarItem Test', () => { expect(rendered.getByLabelText('My Squads')).toBeInTheDocument(); expect(rendered.getByLabelText('Team B')).toBeInTheDocument(); + expect(rendered.getByLabelText('Team A')).not.toBeInTheDocument(); expect(rendered.getByLabelText('Team C')).toHaveAttribute( 'href', '/catalog/default/Group/team-c', From 91b8a636a07bd1441c66a09376f594e48c37b3a8 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Tue, 7 Jan 2025 11:19:17 +0000 Subject: [PATCH 6/8] fix(MyGroupsSidebarItem): hide icon for group entity display names Signed-off-by: Dhruv Joshi --- .../src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx index bd515f8553..98b035000a 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx @@ -97,7 +97,7 @@ export const MyGroupsSidebarItem = (props: { {groups?.map(function groupsMap(group) { return ( } + title={} subtitle={ group.metadata.namespace !== DEFAULT_NAMESPACE ? group.metadata.namespace From ec990765fd9663986b54242cc72c430c6e3e9c8c Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Thu, 9 Jan 2025 16:07:40 +0000 Subject: [PATCH 7/8] fix(MyGroupsSidebarItem): integrate entityPresentationApi for improved group display names Signed-off-by: Dhruv Joshi --- .../MyGroupsSidebarItem.test.tsx | 355 ++++++++---------- .../MyGroupsSidebarItem.tsx | 13 +- 2 files changed, 160 insertions(+), 208 deletions(-) diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx index 9521bcc0a2..c870d58cc1 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.test.tsx @@ -24,8 +24,15 @@ import { MyGroupsSidebarItem } from './MyGroupsSidebarItem'; import GroupIcon from '@material-ui/icons/People'; import { identityApiRef } from '@backstage/core-plugin-api'; import { Entity } from '@backstage/catalog-model'; -import { catalogApiRef, entityRouteRef } from '@backstage/plugin-catalog-react'; +import { + catalogApiRef, + entityPresentationApiRef, + entityRouteRef, +} from '@backstage/plugin-catalog-react'; import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils'; +import { DefaultEntityPresentationApi } from '@backstage/plugin-catalog'; +import userEvent from '@testing-library/user-event'; +import { screen } from '@testing-library/react'; describe('MyGroupsSidebarItem Test', () => { describe('For guests or users with no groups', () => { @@ -40,6 +47,10 @@ describe('MyGroupsSidebarItem Test', () => { apis={[ [identityApiRef, identityApi], [catalogApiRef, catalogApi], + [ + entityPresentationApiRef, + DefaultEntityPresentationApi.create({ catalogApi }), + ], ]} > { spec: { type: 'team', children: [], - profile: { - displayName: 'Team A', - }, }, }, ] as Entity[], @@ -91,6 +99,10 @@ describe('MyGroupsSidebarItem Test', () => { apis={[ [identityApiRef, identityApi], [catalogApiRef, catalogApi], + [ + entityPresentationApiRef, + DefaultEntityPresentationApi.create({ catalogApi }), + ], ]} > { }); }); + async function renderSideBarWithUserGroups() { + const identityApi = mockApis.identity({ + userEntityRef: 'user:default/nigel.manning', + ownershipEntityRefs: ['user:default/nigel.manning'], + }); + const catalogApi = catalogApiMock.mock({ + getEntities: async () => ({ + items: [ + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-a', + namespace: 'default', + }, + spec: { + type: 'team', + children: [], + }, + }, + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-b', + title: 'Team B', + namespace: 'default', + }, + spec: { + type: 'team', + children: [], + }, + }, + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Group', + metadata: { + name: 'team-c', + namespace: 'default', + }, + spec: { + type: 'team', + children: [], + profile: { + displayName: 'Team C', + }, + }, + }, + ] as Entity[], + }), + }); + + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, + ); + } + describe('For users that are members of multiple groups', () => { - it('MyGroupsSidebarItem should display a sub-menu with all their groups, with displaying the title through displayName, and a link to each group', async () => { + beforeEach(async () => { + await renderSideBarWithUserGroups(); + }); + + it('MyGroupsSidebarItem should display a sub-menu with all their groups and a link to each group', async () => { + expect(screen.getByLabelText('My Squads')).toBeInTheDocument(); + }); + + it('MyGroupsSidebarItem should display the displayName for each group in the list instead of the metadata name using the entityPresentationApi', async () => { + await userEvent.hover(screen.getByLabelText('My Squads')); + expect(screen.getByText('team-a')).toBeInTheDocument(); + expect(screen.getByText('Team B')).toBeInTheDocument(); + expect(screen.getByText('Team C')).toBeInTheDocument(); + }); + }); + + describe('When an additional filter is not provided', () => { + const entityPresentationApi = { + forEntity: jest.fn(), + }; + it('catalogApi.getEntities() should be called with the default filter', async () => { const identityApi = mockApis.identity({ - userEntityRef: 'user:default/nigel.manning', - ownershipEntityRefs: ['user:default/nigel.manning'], + userEntityRef: 'user:default/guest', + ownershipEntityRefs: ['user:default/guest'], }); - const catalogApi = catalogApiMock.mock({ - getEntities: async () => ({ - items: [ - { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Group', - metadata: { - name: 'team-a', - title: 'Team A', - namespace: 'default', - }, - spec: { - type: 'team', - children: [], - profile: { - displayName: 'Team A', - }, - }, - }, - { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Group', - metadata: { - name: 'team-b', - title: 'Team B', - namespace: 'default', - }, - spec: { - type: 'team', - children: [], - profile: { - displayName: 'Team B', - }, - }, - }, - { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Group', - metadata: { - name: 'team-c', - title: 'Team C', - namespace: 'default', - }, - spec: { - type: 'team', - children: [], - profile: { - displayName: 'Team C', - }, - }, - }, - ] as Entity[], - }), - }); - const rendered = await renderInTestApp( + const mockCatalogApi = catalogApiMock.mock(); + await renderInTestApp( { }, }, ); - - expect(rendered.getByLabelText('My Squads')).toBeInTheDocument(); - expect(rendered.getByLabelText('Team B')).toBeInTheDocument(); - expect(rendered.getByLabelText('Team A')).not.toBeInTheDocument(); - expect(rendered.getByLabelText('Team C')).toHaveAttribute( - 'href', - '/catalog/default/Group/team-c', - ); + expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ + filter: [ + { + kind: 'group', + 'relations.hasMember': 'user:default/guest', + }, + ], + fields: ['metadata', 'kind'], + }); }); + }); - it('MyGroupsSidebarItem should display the metadata name when the displayName property is not available in the entity', async () => { + describe('When an additional filter is provided', () => { + const entityPresentationApi = { + forEntity: jest.fn(), + }; + + it('catalogApi.getEntities() should be called with an additional filter item', async () => { const identityApi = mockApis.identity({ - userEntityRef: 'user:default/nigel.manning', - ownershipEntityRefs: ['user:default/nigel.manning'], + userEntityRef: 'user:default/guest', + ownershipEntityRefs: ['user:default/guest'], }); - const catalogApi = catalogApiMock.mock({ - getEntities: async () => ({ - items: [ - { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Group', - metadata: { - name: 'team-a', - title: 'Team A', - namespace: 'default', - }, - spec: { - type: 'team', - children: [], - }, - }, - { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Group', - metadata: { - name: 'team-b', - title: 'Team B', - namespace: 'default', - }, - spec: { - type: 'team', - children: [], - }, - }, - { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Group', - metadata: { - name: 'team-c', - title: 'Team C', - namespace: 'default', - }, - spec: { - type: 'team', - children: [], - }, - }, - ] as Entity[], - }), - }); - const rendered = await renderInTestApp( + const mockCatalogApi = catalogApiMock.mock(); + await renderInTestApp( , { @@ -271,87 +293,16 @@ describe('MyGroupsSidebarItem Test', () => { }, }, ); - expect(rendered.getByLabelText('Team-a')).toBeInTheDocument(); - expect(rendered.getByLabelText('Team-b')).toBeInTheDocument(); - expect(rendered.getByLabelText('Team-c')).toBeInTheDocument(); - }); - }); -}); - -describe('When an additional filter is not provided', () => { - it('catalogApi.getEntities() should be called with the default filter', async () => { - const identityApi = mockApis.identity({ - userEntityRef: 'user:default/guest', - ownershipEntityRefs: ['user:default/guest'], - }); - const mockCatalogApi = catalogApiMock.mock(); - await renderInTestApp( - - - , - { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, - }, - }, - ); - expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ - filter: [ - { - kind: 'group', - 'relations.hasMember': 'user:default/guest', - }, - ], - fields: ['metadata', 'kind'], - }); - }); -}); - -describe('When an additional filter is provided', () => { - it('catalogApi.getEntities() should be called with an additional filter item', async () => { - const identityApi = mockApis.identity({ - userEntityRef: 'user:default/guest', - ownershipEntityRefs: ['user:default/guest'], - }); - const mockCatalogApi = catalogApiMock.mock(); - await renderInTestApp( - - - , - { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, - }, - }, - ); - expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ - filter: [ - { - kind: 'group', - 'relations.hasMember': 'user:default/guest', - 'spec.type': 'team', - }, - ], - fields: ['metadata', 'kind'], + expect(mockCatalogApi.getEntities).toHaveBeenCalledWith({ + filter: [ + { + kind: 'group', + 'relations.hasMember': 'user:default/guest', + 'spec.type': 'team', + }, + ], + fields: ['metadata', 'kind'], + }); }); }); }); diff --git a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx index 98b035000a..8292455115 100644 --- a/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx +++ b/plugins/org/src/components/MyGroupsSidebarItem/MyGroupsSidebarItem.tsx @@ -37,7 +37,8 @@ import { entityRouteRef, } from '@backstage/plugin-catalog-react'; import { getCompoundEntityRef } from '@backstage/catalog-model'; -import { EntityDisplayName } from '@backstage/plugin-catalog-react'; + +import { entityPresentationApiRef } from '@backstage/plugin-catalog-react'; /** * MyGroupsSidebarItem can be added to your sidebar providing quick access to groups the logged in user is a member of @@ -55,6 +56,7 @@ export const MyGroupsSidebarItem = (props: { const identityApi = useApi(identityApiRef); const catalogApi: CatalogApi = useApi(catalogApiRef); const catalogEntityRoute = useRouteRef(entityRouteRef); + const entityPresentationApi = useApi(entityPresentationApiRef); const { value: groups } = useAsync(async () => { const profile = await identityApi.getBackstageIdentity(); @@ -67,13 +69,11 @@ export const MyGroupsSidebarItem = (props: { ...(filter ?? {}), }, ], - fields: ['metadata', 'kind', 'spec'], + fields: ['metadata', 'kind'], }); - return response.items; }, []); - // Not a member of any groups if (!groups?.length) { return null; } @@ -94,10 +94,11 @@ export const MyGroupsSidebarItem = (props: { return ( - {groups?.map(function groupsMap(group) { + {groups?.map(group => { + const entityDisplayName = entityPresentationApi.forEntity(group); return ( } + title={entityDisplayName.snapshot.primaryTitle} subtitle={ group.metadata.namespace !== DEFAULT_NAMESPACE ? group.metadata.namespace From 7c62c8aec5fc6d348bdd0d2400fb003338662180 Mon Sep 17 00:00:00 2001 From: Dhruv Joshi Date: Fri, 10 Jan 2025 10:34:56 +0000 Subject: [PATCH 8/8] refactor(changeset): refactor purple-years-cross.md with prettier Signed-off-by: Dhruv Joshi --- .changeset/purple-years-cross.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/purple-years-cross.md b/.changeset/purple-years-cross.md index 47110e9bf7..e617e95204 100644 --- a/.changeset/purple-years-cross.md +++ b/.changeset/purple-years-cross.md @@ -2,4 +2,4 @@ '@backstage/plugin-org': patch --- -Added support for `spec.profile.displayName` to be used in the `MyGroupsSidebarItem` component via the `EntityDisplayName` component when you are a member of multiple Groups. +Added support for `spec.profile.displayName` to be used in the `MyGroupsSidebarItem` component via the `EntityDisplayName` component when you are a member of multiple Groups.