From a5e067c01f7b7b3e56accfd4400143ec4f81e600 Mon Sep 17 00:00:00 2001 From: Long Zhang Date: Tue, 18 Jul 2023 15:37:19 +0200 Subject: [PATCH] propagate entity spec to EntityNode Signed-off-by: Long Zhang --- .../src/components/EntityRelationsGraph/types.ts | 5 +++++ .../EntityRelationsGraph/useEntityRelationNodesAndEdges.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/plugins/catalog-graph/src/components/EntityRelationsGraph/types.ts b/plugins/catalog-graph/src/components/EntityRelationsGraph/types.ts index caf6c8c501..1ce32fc523 100644 --- a/plugins/catalog-graph/src/components/EntityRelationsGraph/types.ts +++ b/plugins/catalog-graph/src/components/EntityRelationsGraph/types.ts @@ -15,6 +15,7 @@ */ import { DependencyGraphTypes } from '@backstage/core-components'; +import { JsonObject } from '@backstage/types'; import { MouseEventHandler } from 'react'; /** @@ -63,6 +64,10 @@ export type EntityNodeData = { * Namespace of the entity. */ namespace: string; + /** + * Optional spec of the entity. + */ + spec?: JsonObject; /** * Whether the entity is focused, optional, defaults to false. Focused * entities are highlighted in the graph. diff --git a/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.ts b/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.ts index a1c3416d4f..2e177e2b75 100644 --- a/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.ts +++ b/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.ts @@ -75,6 +75,7 @@ export function useEntityRelationNodesAndEdges({ kind: entity.kind, name: entity.metadata.name, namespace: entity.metadata.namespace ?? DEFAULT_NAMESPACE, + spec: entity.spec ?? undefined, focused, color: focused ? 'secondary' : 'primary', };