catalog,catalog-backend: update to catalog-model status change
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Internal update to match status field changes in `@backstage/catalog-model`.
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
import { ENTITY_STATUS_CATALOG_PROCESSING_TYPE } from '@backstage/catalog-client';
|
||||
import {
|
||||
Entity,
|
||||
AlphaEntity,
|
||||
parseEntityRef,
|
||||
UNSTABLE_EntityStatusItem,
|
||||
EntityStatusItem,
|
||||
} from '@backstage/catalog-model';
|
||||
import { SerializedError, stringifyError } from '@backstage/errors';
|
||||
import { Knex } from 'knex';
|
||||
@@ -152,9 +152,9 @@ export class Stitcher {
|
||||
|
||||
// Grab the processed entity and stitch all of the relevant data into
|
||||
// it
|
||||
const entity = JSON.parse(processedEntity) as Entity;
|
||||
const entity = JSON.parse(processedEntity) as AlphaEntity;
|
||||
const isOrphan = Number(incomingReferenceCount) === 0;
|
||||
let statusItems: UNSTABLE_EntityStatusItem[] = [];
|
||||
let statusItems: EntityStatusItem[] = [];
|
||||
|
||||
if (isOrphan) {
|
||||
this.logger.debug(`${entityRef} is an orphan`);
|
||||
|
||||
+4
-4
@@ -24,7 +24,7 @@ import {
|
||||
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { EntityProcessingErrorsPanel } from './EntityProcessingErrorsPanel';
|
||||
import { Entity, getEntityName } from '@backstage/catalog-model';
|
||||
import { AlphaEntity, getEntityName } from '@backstage/catalog-model';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
|
||||
describe('<EntityProcessErrors />', () => {
|
||||
@@ -34,7 +34,7 @@ describe('<EntityProcessErrors />', () => {
|
||||
const apis = TestApiRegistry.from([catalogApiRef, { getEntityAncestors }]);
|
||||
|
||||
it('renders EntityProcessErrors if the entity has errors', async () => {
|
||||
const entity: Entity = {
|
||||
const entity: AlphaEntity = {
|
||||
apiVersion: 'v1',
|
||||
kind: 'Component',
|
||||
metadata: {
|
||||
@@ -122,7 +122,7 @@ describe('<EntityProcessErrors />', () => {
|
||||
});
|
||||
|
||||
it('renders EntityProcessErrors if the parent entity has errors', async () => {
|
||||
const entity: Entity = {
|
||||
const entity: AlphaEntity = {
|
||||
apiVersion: 'v1',
|
||||
kind: 'Component',
|
||||
metadata: {
|
||||
@@ -136,7 +136,7 @@ describe('<EntityProcessErrors />', () => {
|
||||
},
|
||||
};
|
||||
|
||||
const parent: Entity = {
|
||||
const parent: AlphaEntity = {
|
||||
apiVersion: 'v1',
|
||||
kind: 'Component',
|
||||
metadata: {
|
||||
|
||||
+4
-3
@@ -16,8 +16,9 @@
|
||||
|
||||
import {
|
||||
Entity,
|
||||
AlphaEntity,
|
||||
stringifyEntityRef,
|
||||
UNSTABLE_EntityStatusItem,
|
||||
EntityStatusItem,
|
||||
compareEntityToRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -36,7 +37,7 @@ import { useApi, ApiHolder } from '@backstage/core-plugin-api';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { SerializedError } from '@backstage/errors';
|
||||
|
||||
const errorFilter = (i: UNSTABLE_EntityStatusItem) =>
|
||||
const errorFilter = (i: EntityStatusItem) =>
|
||||
i.error &&
|
||||
i.level === 'error' &&
|
||||
i.type === ENTITY_STATUS_CATALOG_PROCESSING_TYPE;
|
||||
@@ -55,7 +56,7 @@ async function getOwnAndAncestorsErrors(
|
||||
const ancestors = await catalogApi.getEntityAncestors({ entityRef });
|
||||
const items = ancestors.items
|
||||
.map(item => {
|
||||
const statuses = item.entity.status?.items ?? [];
|
||||
const statuses = (item.entity as AlphaEntity).status?.items ?? [];
|
||||
const errors = statuses
|
||||
.filter(errorFilter)
|
||||
.map(e => e.error)
|
||||
|
||||
Reference in New Issue
Block a user