update pr to remove profile changes

Signed-off-by: Joe Patterson <jrwpatterson@gmail.com>
This commit is contained in:
Joe Patterson
2022-10-19 15:09:49 +10:00
parent 97a4561f53
commit 0b11500151
14 changed files with 32 additions and 135 deletions
@@ -112,8 +112,6 @@ const extraDetailsEntity: GroupEntity = {
email: 'team-a@example.com',
picture:
'https://avatars.dicebear.com/api/identicon/team-a@example.com.svg?background=%23fff&margin=25',
Telephone: '123456789',
Location: 'London',
},
type: 'group',
children: [],
@@ -52,7 +52,7 @@ import {
Link,
} from '@backstage/core-components';
import { alertApiRef, useApi } from '@backstage/core-plugin-api';
import { LinksGroup, ProfileInfoGroup } from '../../Meta';
import { LinksGroup } from '../../Meta';
const CardTitle = (props: { title: string }) => (
<Box display="flex" alignItems="center">
@@ -192,7 +192,6 @@ export const GroupProfileCard = (props: { variant?: InfoCardVariants }) => {
/>
</ListItem>
<LinksGroup links={links} />
<ProfileInfoGroup profile={profile} />
</List>
</Grid>
</Grid>
@@ -1,56 +0,0 @@
/*
* 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 { ListItem, ListItemText, Divider } from '@material-ui/core';
import React, { useMemo } from 'react';
const staticProfileKeys = ['displayName', 'email', 'picture'];
export const ProfileInfoGroup = ({
profile,
}: {
profile?: Record<string, string>;
}) => {
const profileKeys = useMemo(
() =>
profile !== undefined
? Object.keys(profile).filter(key => !staticProfileKeys.includes(key))
: [],
[profile],
);
if (profile === undefined || profileKeys.length === 0) {
return null;
}
return (
<>
<Divider />
{profileKeys.map(key => {
const value = profile[key];
return (
<ListItem key={key}>
<ListItemText style={{ width: '25%', flexGrow: 0 }}>
{key}
</ListItemText>
<ListItemText>{value}</ListItemText>
</ListItem>
);
})}
</>
);
};
@@ -14,4 +14,3 @@
* limitations under the License.
*/
export * from './LinksGroup';
export * from './ProfileInfoGroup';
@@ -127,9 +127,6 @@ const extraDetailsEntity: UserEntity = {
email: 'guest@example.com',
picture:
'https://avatars.dicebear.com/api/avataaars/guest@example.com.svg?background=%23fff',
'Job Title': 'Software Engineer',
Department: 'Engineering',
Location: 'San Francisco, CA',
},
memberOf: ['team-a'],
},
@@ -183,9 +183,6 @@ describe('Edit Button', () => {
profile: {
displayName: 'Calum Leavy',
email: 'calum-leavy@example.com',
'Job Title': 'Software Engineer',
Department: 'Engineering',
Location: 'San Francisco, CA',
},
memberOf: ['ExampleGroup'],
},
@@ -209,10 +206,6 @@ describe('Edit Button', () => {
},
),
);
expect(rendered.getByText('Software Engineer')).toBeInTheDocument();
expect(rendered.getByText('Department')).toBeInTheDocument();
expect(rendered.getByText('San Francisco, CA')).toBeInTheDocument();
expect(rendered.getByText('Location')).toBeInTheDocument();
expect(rendered.getByText('Slack')).toBeInTheDocument();
expect(rendered.getByText('Google')).toBeInTheDocument();
});
@@ -46,7 +46,7 @@ import {
InfoCardVariants,
Link,
} from '@backstage/core-components';
import { LinksGroup, ProfileInfoGroup } from '../../Meta';
import { LinksGroup } from '../../Meta';
const CardTitle = (props: { title?: string }) =>
props.title ? (
@@ -131,7 +131,6 @@ export const UserProfileCard = (props: { variant?: InfoCardVariants }) => {
</ListItem>
<LinksGroup links={links} />
<ProfileInfoGroup profile={profile} />
</List>
</Grid>
</Grid>