org: Do not render links by default
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -65,7 +65,7 @@ const CardTitle = (props: { title: string }) => (
|
||||
/** @public */
|
||||
export const GroupProfileCard = (props: {
|
||||
variant?: InfoCardVariants;
|
||||
hideLinks?: boolean;
|
||||
showLinks?: boolean;
|
||||
}) => {
|
||||
const catalogApi = useApi(catalogApiRef);
|
||||
const alertApi = useApi(alertApiRef);
|
||||
@@ -195,7 +195,7 @@ export const GroupProfileCard = (props: {
|
||||
secondary="Child Groups"
|
||||
/>
|
||||
</ListItem>
|
||||
{!props?.hideLinks && <LinksGroup links={links} />}
|
||||
{props?.showLinks && <LinksGroup links={links} />}
|
||||
</List>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -156,7 +156,7 @@ describe('Edit Button', () => {
|
||||
expect(rendered.getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Should show the extra fields if either links', async () => {
|
||||
it('Should not show links by default', async () => {
|
||||
const annotations: Record<string, string> = {
|
||||
'backstage.io/edit-url': 'https://example.com/user.yaml',
|
||||
};
|
||||
@@ -206,11 +206,11 @@ describe('Edit Button', () => {
|
||||
},
|
||||
),
|
||||
);
|
||||
expect(rendered.getByText('Slack')).toBeInTheDocument();
|
||||
expect(rendered.getByText('Google')).toBeInTheDocument();
|
||||
expect(rendered.queryByText('Slack')).toBeNull();
|
||||
expect(rendered.queryByText('Google')).toBeNull();
|
||||
});
|
||||
|
||||
it('Should hide the links if hidelinks', async () => {
|
||||
it('Should show the links if showLinks is set', async () => {
|
||||
const annotations: Record<string, string> = {
|
||||
'backstage.io/edit-url': 'https://example.com/user.yaml',
|
||||
};
|
||||
@@ -251,7 +251,7 @@ describe('Edit Button', () => {
|
||||
const rendered = await renderWithEffects(
|
||||
wrapInTestApp(
|
||||
<EntityProvider entity={userEntity}>
|
||||
<UserProfileCard variant="gridItem" hideLinks />
|
||||
<UserProfileCard showLinks variant="gridItem" />
|
||||
</EntityProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
@@ -260,7 +260,7 @@ describe('Edit Button', () => {
|
||||
},
|
||||
),
|
||||
);
|
||||
expect(rendered.queryByText('Slack')).toBeNull();
|
||||
expect(rendered.queryByText('Google')).toBeNull();
|
||||
expect(rendered.getByText('Slack')).toBeInTheDocument();
|
||||
expect(rendered.getByText('Google')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ const CardTitle = (props: { title?: string }) =>
|
||||
/** @public */
|
||||
export const UserProfileCard = (props: {
|
||||
variant?: InfoCardVariants;
|
||||
hideLinks?: boolean;
|
||||
showLinks?: boolean;
|
||||
}) => {
|
||||
const { entity: user } = useEntity<UserEntity>();
|
||||
if (!user) {
|
||||
@@ -134,7 +134,7 @@ export const UserProfileCard = (props: {
|
||||
</ListItemText>
|
||||
</ListItem>
|
||||
|
||||
{!props?.hideLinks && <LinksGroup links={links} />}
|
||||
{props?.showLinks && <LinksGroup links={links} />}
|
||||
</List>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user