diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index c655e24122..f646992c97 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -41,6 +41,7 @@ import { isKind, EntityHasResourcesCard, EntityOrphanWarning, + isOrphan, } from '@backstage/plugin-catalog'; import { EntityCircleCIContent, @@ -215,9 +216,14 @@ const errorsContent = ( const overviewContent = ( - - - + + + + + + + + diff --git a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx index 6e4780f1a0..7f8ec8baf9 100644 --- a/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx +++ b/plugins/catalog/src/components/EntityOrphanWarning/EntityOrphanWarning.tsx @@ -14,12 +14,16 @@ * limitations under the License. */ +import { Entity } from '@backstage/catalog-model'; import { useEntity } from '@backstage/plugin-catalog-react'; import { Alert } from '@material-ui/lab'; import React, { useState } from 'react'; import { useNavigate } from 'react-router'; import { DeleteEntityDialog } from './DeleteEntityDialog'; +export const isOrphan = (entity: Entity) => + entity?.metadata?.annotations?.['backstage.io/orphan'] === 'true'; + /** * Displays a warning alert if the entity is marked as orphan with the ability to delete said entity. */ @@ -28,7 +32,7 @@ export const EntityOrphanWarning = () => { const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false); const { entity } = useEntity(); - if (entity.metadata?.annotations?.['backstage.io/orphan'] !== 'true') { + if (entity?.metadata?.annotations?.['backstage.io/orphan'] !== 'true') { return null; } diff --git a/plugins/catalog/src/components/EntityOrphanWarning/index.ts b/plugins/catalog/src/components/EntityOrphanWarning/index.ts index b632e6ada9..b64f8c1232 100644 --- a/plugins/catalog/src/components/EntityOrphanWarning/index.ts +++ b/plugins/catalog/src/components/EntityOrphanWarning/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export { EntityOrphanWarning } from './EntityOrphanWarning'; +export { EntityOrphanWarning, isOrphan } from './EntityOrphanWarning';