diff --git a/.changeset/large-tools-collect.md b/.changeset/large-tools-collect.md new file mode 100644 index 0000000000..1b3f31fbd2 --- /dev/null +++ b/.changeset/large-tools-collect.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-user-settings': patch +--- + +Minor update to the `UserSettingsIdentityCard` to have clickable entity refs diff --git a/plugins/user-settings/package.json b/plugins/user-settings/package.json index 2b1366b2ed..cf611dd41b 100644 --- a/plugins/user-settings/package.json +++ b/plugins/user-settings/package.json @@ -36,6 +36,7 @@ "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", "@backstage/errors": "workspace:^", + "@backstage/plugin-catalog-react": "workspace:^", "@backstage/theme": "workspace:^", "@backstage/types": "workspace:^", "@material-ui/core": "^4.12.2", diff --git a/plugins/user-settings/src/components/General/UserSettingsIdentityCard.test.tsx b/plugins/user-settings/src/components/General/UserSettingsIdentityCard.test.tsx index 19c3eb2182..026e0517bb 100644 --- a/plugins/user-settings/src/components/General/UserSettingsIdentityCard.test.tsx +++ b/plugins/user-settings/src/components/General/UserSettingsIdentityCard.test.tsx @@ -24,6 +24,7 @@ import React from 'react'; import { UserSettingsIdentityCard } from './UserSettingsIdentityCard'; import { ApiProvider } from '@backstage/core-app-api'; import { identityApiRef } from '@backstage/core-plugin-api'; +import { entityRouteRef } from '@backstage/plugin-catalog-react'; const apiRegistry = TestApiRegistry.from([ identityApiRef, @@ -32,7 +33,7 @@ const apiRegistry = TestApiRegistry.from([ getBackstageIdentity: jest.fn(async () => ({ type: 'user' as const, userEntityRef: 'foo:bar/foobar', - ownershipEntityRefs: ['test-ownership'], + ownershipEntityRefs: ['user:default/test-ownership'], })), }, ]); @@ -44,10 +45,13 @@ describe('', () => { , + { + mountedRoutes: { '/catalog/:namespace/:kind/:name': entityRouteRef }, + }, ), ); - expect(screen.getByText('test-ownership')).toBeInTheDocument(); + expect(screen.getByText('user:default/test-ownership')).toBeInTheDocument(); expect(screen.getByText('foo:bar/foobar')).toBeInTheDocument(); }); }); diff --git a/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx b/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx index 1369f4aab8..a398877ce9 100644 --- a/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx +++ b/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx @@ -15,40 +15,46 @@ */ import { InfoCard } from '@backstage/core-components'; -import React from 'react'; -import { useUserProfile } from '../useUserProfileInfo'; -import Chip from '@material-ui/core/Chip'; +import { EntityRefLinks } from '@backstage/plugin-catalog-react'; import Grid from '@material-ui/core/Grid'; import Typography from '@material-ui/core/Typography'; +import React from 'react'; +import { useUserProfile } from '../useUserProfileInfo'; -/** @public */ -export const UserSettingsIdentityCard = () => { +const Contents = () => { const { backstageIdentity } = useUserProfile(); + if (!backstageIdentity) { + return No Backstage Identity; + } + return ( - - - - - - - User Entity:{' '} - - - - Ownership Entities:{' '} - {backstageIdentity?.ownershipEntityRefs.map(it => ( - - ))} - - - - + + + + User Entity:{' '} + ref} + /> + - + + + Ownership Entities:{' '} + ref} + /> + + + ); }; + +/** @public */ +export const UserSettingsIdentityCard = () => ( + + + +); diff --git a/yarn.lock b/yarn.lock index 00a59c3350..07bc1f7f81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8424,6 +8424,7 @@ __metadata: "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" "@backstage/errors": "workspace:^" + "@backstage/plugin-catalog-react": "workspace:^" "@backstage/test-utils": "workspace:^" "@backstage/theme": "workspace:^" "@backstage/types": "workspace:^"