From 14c0a579a509137cbe6a0a0b3a8fbbef2d5d1630 Mon Sep 17 00:00:00 2001 From: Kiss Miklos Date: Fri, 10 Jun 2022 15:25:39 +0200 Subject: [PATCH] add UserSettingsIdentityCard Signed-off-by: Kiss Miklos --- .../General/UserSettingsGeneral.tsx | 4 ++ .../General/UserSettingsIdentityCard.tsx | 51 +++++++++++++++++++ .../src/components/useUserProfileInfo.ts | 1 + 3 files changed, 56 insertions(+) create mode 100644 plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx diff --git a/plugins/user-settings/src/components/General/UserSettingsGeneral.tsx b/plugins/user-settings/src/components/General/UserSettingsGeneral.tsx index 6705997d1c..db7fdd7be6 100644 --- a/plugins/user-settings/src/components/General/UserSettingsGeneral.tsx +++ b/plugins/user-settings/src/components/General/UserSettingsGeneral.tsx @@ -17,6 +17,7 @@ import { Grid } from '@material-ui/core'; import React from 'react'; import { UserSettingsProfileCard } from './UserSettingsProfileCard'; import { UserSettingsAppearanceCard } from './UserSettingsAppearanceCard'; +import { UserSettingsIdentityCard } from './UserSettingsIdentityCard'; export const UserSettingsGeneral = () => { return ( @@ -27,6 +28,9 @@ export const UserSettingsGeneral = () => { + + + ); }; diff --git a/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx b/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx new file mode 100644 index 0000000000..b656c6b861 --- /dev/null +++ b/plugins/user-settings/src/components/General/UserSettingsIdentityCard.tsx @@ -0,0 +1,51 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { InfoCard } from '@backstage/core-components'; +import { Grid, Typography } from '@material-ui/core'; +import React from 'react'; +import { useUserProfile } from '../useUserProfileInfo'; +import Chip from '@material-ui/core/Chip'; + +export const UserSettingsIdentityCard = () => { + const { backstageIdentity } = useUserProfile(); + + return ( + + + + + + + User Entity:{' '} + + + + Ownership Entities:{' '} + {backstageIdentity?.ownershipEntityRefs.map(it => ( + + ))} + + + + + + + ); +}; diff --git a/plugins/user-settings/src/components/useUserProfileInfo.ts b/plugins/user-settings/src/components/useUserProfileInfo.ts index f893520cd2..c168fc12b4 100644 --- a/plugins/user-settings/src/components/useUserProfileInfo.ts +++ b/plugins/user-settings/src/components/useUserProfileInfo.ts @@ -53,6 +53,7 @@ export const useUserProfile = () => { return { profile: value!.profile, + backstageIdentity: value!.identity, displayName: value!.profile.displayName ?? value!.identity.userEntityRef, loading, };