From 9562b7bc8dda553a5a3e5b54f4f00c8086c7fa44 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 18 Feb 2021 15:28:22 -0500 Subject: [PATCH] Ref relations by constants Signed-off-by: Adam Harvey --- .../src/components/SystemDiagram/SystemDiagram.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/catalog/src/components/SystemDiagram/SystemDiagram.tsx b/plugins/catalog/src/components/SystemDiagram/SystemDiagram.tsx index 6cd37918e1..b466e28a0c 100644 --- a/plugins/catalog/src/components/SystemDiagram/SystemDiagram.tsx +++ b/plugins/catalog/src/components/SystemDiagram/SystemDiagram.tsx @@ -14,7 +14,11 @@ * limitations under the License. */ -import { Entity } from '@backstage/catalog-model'; +import { + Entity, + RELATION_PROVIDES_API, + RELATION_PART_OF, +} from '@backstage/catalog-model'; import { catalogApiRef } from '@backstage/plugin-catalog-react'; import { DependencyGraph, @@ -81,14 +85,14 @@ export function SystemDiagram({ entity }: SystemDiagramProps) { if (catalogItem.relations) { for (const relation of catalogItem.relations) { switch (relation.type) { - case 'providesApi': + case RELATION_PROVIDES_API: systemEdges.push({ to: `${catalogItem.kind}:${catalogItem.metadata.name}`.toLowerCase(), from: `${relation.target.kind}:${relation.target.name}`.toLowerCase(), label: 'provides API', }); break; - case 'partOf': + case RELATION_PART_OF: systemEdges.push({ from: `${catalogItem.kind}:${catalogItem.metadata.name}`.toLowerCase(), to: `${relation.target.kind}:${relation.target.name}`.toLowerCase(),