From 0d03e42a89efdf5b318c13dba522a9a9294ced6c Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 15 Feb 2022 14:50:37 +0100 Subject: [PATCH] catalog-model: deprecate compareEntityToRef Signed-off-by: Johan Haals --- .changeset/fair-emus-check.md | 5 +++++ .changeset/fair-eyes-collect.md | 5 +++++ packages/catalog-model/api-report.md | 2 +- packages/catalog-model/src/entity/ref.ts | 1 + .../EntityProcessingErrorsPanel.tsx | 7 ++----- 5 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 .changeset/fair-emus-check.md create mode 100644 .changeset/fair-eyes-collect.md diff --git a/.changeset/fair-emus-check.md b/.changeset/fair-emus-check.md new file mode 100644 index 0000000000..328d5498b9 --- /dev/null +++ b/.changeset/fair-emus-check.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Replaced use of deprecated `compareEntityToRef` utility. diff --git a/.changeset/fair-eyes-collect.md b/.changeset/fair-eyes-collect.md new file mode 100644 index 0000000000..5a0cfafaab --- /dev/null +++ b/.changeset/fair-eyes-collect.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-model': patch +--- + +Deprecated `compareEntityToRef` due to low usage and provided value. diff --git a/packages/catalog-model/api-report.md b/packages/catalog-model/api-report.md index 655d01fef1..e8ed7a8f05 100644 --- a/packages/catalog-model/api-report.md +++ b/packages/catalog-model/api-report.md @@ -66,7 +66,7 @@ export class CommonValidatorFunctions { static isValidUrl(value: unknown): boolean; } -// @public +// @public @deprecated export function compareEntityToRef( entity: Entity, ref: EntityRef | EntityName, diff --git a/packages/catalog-model/src/entity/ref.ts b/packages/catalog-model/src/entity/ref.ts index 1996616077..9dcd17916e 100644 --- a/packages/catalog-model/src/entity/ref.ts +++ b/packages/catalog-model/src/entity/ref.ts @@ -234,6 +234,7 @@ export function stringifyEntityRef( * @param context - An optional context of default kind and namespace, that apply * to the ref if given * @returns True if matching, false otherwise + * @deprecated compare using stringifyEntityRef instead. */ export function compareEntityToRef( entity: Entity, diff --git a/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx b/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx index e4df011b38..d73685655c 100644 --- a/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx +++ b/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx @@ -19,7 +19,6 @@ import { AlphaEntity, stringifyEntityRef, EntityStatusItem, - compareEntityToRef, } from '@backstage/catalog-model'; import { catalogApiRef, @@ -110,10 +109,8 @@ export const EntityProcessingErrorsPanel = () => { <> {value.items.map((ancestorError, index) => ( - {!compareEntityToRef( - entity, - stringifyEntityRef(ancestorError.entity), - ) && ( + {stringifyEntityRef(entity) !== + stringifyEntityRef(ancestorError.entity) && ( The error below originates from{' '}