feat(catalog): add overview warning components

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2024-02-12 12:20:43 +01:00
parent 57397e7d6d
commit 1f8c2fa8b5
3 changed files with 51 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': minor
---
Add entity warning components to the default entity overview page.
+4 -3
View File
@@ -29,13 +29,14 @@ app:
- entity-card:api-docs/providing-components
- entity-card:api-docs/consuming-components
# - entity-card:azure-devops/readme
# Entity page content
- entity-content:api-docs/definition
- entity-content:api-docs/apis
- entity-content:techdocs
- entity-content:azure-devops/pipelines
- entity-content:azure-devops/pull-requests
- entity-content:azure-devops/git-tags
# - entity-content:azure-devops/pipelines
# - entity-content:azure-devops/pull-requests
# - entity-content:azure-devops/git-tags
# Org Plugin
- entity-card:org/group-profile
@@ -19,6 +19,19 @@ import { useEntity } from '@backstage/plugin-catalog-react';
import Grid from '@material-ui/core/Grid';
import React from 'react';
import { FilterWrapper } from './filter/FilterWrapper';
import { EntitySwitch } from '../components/EntitySwitch';
import {
EntityOrphanWarning,
isOrphan,
} from '../components/EntityOrphanWarning';
import {
EntityRelationWarning,
hasRelationWarnings,
} from '../components/EntityRelationWarning';
import {
EntityProcessingErrorsPanel,
hasCatalogProcessingErrors,
} from '../components/EntityProcessingErrorsPanel';
interface EntityOverviewPageProps {
cards: Array<{
@@ -28,10 +41,39 @@ interface EntityOverviewPageProps {
}>;
}
const entityWarningContent = (
<>
<EntitySwitch>
<EntitySwitch.Case if={isOrphan}>
<Grid item xs={12}>
<EntityOrphanWarning />
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
<EntitySwitch>
<EntitySwitch.Case if={hasRelationWarnings}>
<Grid item xs={12}>
<EntityRelationWarning />
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
<EntitySwitch>
<EntitySwitch.Case if={hasCatalogProcessingErrors}>
<Grid item xs={12}>
<EntityProcessingErrorsPanel />
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
</>
);
export function EntityOverviewPage(props: EntityOverviewPageProps) {
const { entity } = useEntity();
return (
<Grid container spacing={3} alignItems="stretch">
{entityWarningContent}
{props.cards.map((card, index) => (
<FilterWrapper key={index} entity={entity} {...card} />
))}