Catalog: Remove rendudant conditional rendering

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2021-05-19 10:13:57 +02:00
parent c023c72230
commit 0057ed31e3
2 changed files with 0 additions and 34 deletions
@@ -61,34 +61,4 @@ describe('<EntityOrphanWarning />', () => {
),
).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(
<ApiProvider apis={apis}>
<EntityProvider entity={entity}>
<EntityOrphanWarning />
</EntityProvider>
</ApiProvider>,
);
expect(
queryByText(
'This entity is not referenced by any location and is therefore not receiving updates. Click here to delete.',
),
).not.toBeInTheDocument();
});
});
@@ -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);