add UserSettingsIdentityCard

Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
Kiss Miklos
2022-06-10 15:25:39 +02:00
parent 4265e9dda9
commit 14c0a579a5
3 changed files with 56 additions and 0 deletions
@@ -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 = () => {
<Grid item xs={12} md={6}>
<UserSettingsAppearanceCard />
</Grid>
<Grid item xs={12} md={6}>
<UserSettingsIdentityCard />
</Grid>
</Grid>
);
};
@@ -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 (
<InfoCard title="Backstage Identity">
<Grid container spacing={6}>
<Grid item xs={12} sm container>
<Grid item xs container direction="column" spacing={2}>
<Grid item xs>
<Typography variant="subtitle1" gutterBottom>
User Entity:{' '}
<Chip
label={backstageIdentity?.userEntityRef}
variant="outlined"
size="small"
/>
</Typography>
<Typography variant="subtitle1">
Ownership Entities:{' '}
{backstageIdentity?.ownershipEntityRefs.map(it => (
<Chip label={it} variant="outlined" size="small" />
))}
</Typography>
</Grid>
</Grid>
</Grid>
</Grid>
</InfoCard>
);
};
@@ -53,6 +53,7 @@ export const useUserProfile = () => {
return {
profile: value!.profile,
backstageIdentity: value!.identity,
displayName: value!.profile.displayName ?? value!.identity.userEntityRef,
loading,
};