From 8d8bde24f6afe9c74cba5e355435aea994da7dd3 Mon Sep 17 00:00:00 2001 From: Andre Wanlin <67169551+awanlin@users.noreply.github.com> Date: Wed, 17 Aug 2022 12:54:02 -0500 Subject: [PATCH] Change so edit icon is not visible by default Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com> --- .../UserProfileCard/UserProfileCard.test.tsx | 8 ++--- .../User/UserProfileCard/UserProfileCard.tsx | 30 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx index acbd13703b..f339a5828c 100644 --- a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx +++ b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx @@ -75,7 +75,7 @@ describe('UserSummary Test', () => { }); describe('Edit Button', () => { - it('Should default to disabled', async () => { + it('Should not be present by default', async () => { const userEntity: UserEntity = { apiVersion: 'backstage.io/v1alpha1', kind: 'User', @@ -111,10 +111,10 @@ describe('Edit Button', () => { ), ); - expect(rendered.getByRole('button')).toBeDisabled(); + expect(rendered.queryByTitle('Edit Metadata')).not.toBeInTheDocument(); }); - it('Should be enabled when edit URL annotation is present', async () => { + it('Should be visible when edit URL annotation is present', async () => { const annotations: Record = { 'backstage.io/edit-url': 'https://example.com/user.yaml', }; @@ -153,6 +153,6 @@ describe('Edit Button', () => { }, ), ); - expect(rendered.getByRole('button')).toBeEnabled(); + expect(rendered.getByRole('button')).toBeInTheDocument(); }); }); diff --git a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx index 39565d99d5..dd75578687 100644 --- a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx +++ b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.tsx @@ -75,27 +75,25 @@ export const UserProfileCard = (props: { variant?: InfoCardVariants }) => { kind: 'Group', }); - const infoCardAction = entityMetadataEditUrl ? ( - - - - ) : ( - - - - ); - return ( } subheader={description} variant={props.variant} - action={infoCardAction} + action={ + <> + {entityMetadataEditUrl && ( + + + + )} + + } >