From 0057ed31e36dedfdde16223a74af503c4fc5427e Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 19 May 2021 10:13:57 +0200 Subject: [PATCH] Catalog: Remove rendudant conditional rendering Signed-off-by: Johan Haals --- .../EntityOrphanWarning.test.tsx | 30 ------------------- .../EntityOrphanWarning.tsx | 4 --- 2 files changed, 34 deletions(-) diff --git a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx index 482be1dd25..b33c026d4e 100644 --- a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx +++ b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.test.tsx @@ -61,34 +61,4 @@ describe('', () => { ), ).toBeInTheDocument(); }); - - it('does not render EntityOrphanWarning if the entity is not orphan', async () => { - const entity = { - apiVersion: 'v1', - kind: 'Component', - metadata: { - name: 'software', - description: 'This is the description', - }, - - spec: { - owner: 'guest', - type: 'service', - lifecycle: 'production', - }, - }; - - const { queryByText } = await renderInTestApp( - - - - - , - ); - expect( - queryByText( - 'This entity is not referenced by any location and is therefore not receiving updates. Click here to delete.', - ), - ).not.toBeInTheDocument(); - }); }); diff --git a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx index 7f8ec8baf9..173e9093fc 100644 --- a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx +++ b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx @@ -30,11 +30,7 @@ export const isOrphan = (entity: Entity) => export const EntityOrphanWarning = () => { const navigate = useNavigate(); const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false); - const { entity } = useEntity(); - if (entity?.metadata?.annotations?.['backstage.io/orphan'] !== 'true') { - return null; - } const cleanUpAfterRemoval = async () => { setConfirmationDialogOpen(false);