From 35cb3c21cf789e77bdbf20532ee83c1a5a3b9ab4 Mon Sep 17 00:00:00 2001 From: RISHABH BUDHIRAJA Date: Fri, 21 May 2021 01:36:28 +0530 Subject: [PATCH 1/5] FIx: Diagram component using hardcoded namespace Signed-off-by: RISHABH BUDHIRAJA --- .../src/components/SystemDiagramCard/SystemDiagramCard.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx index 5fd32a6298..42d493912c 100644 --- a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx +++ b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx @@ -149,6 +149,7 @@ export function SystemDiagramCard() { const currentSystemNode = stringifyEntityRef(entity); const systemNodes = new Array<{ id: string; kind: string; name: string }>(); const systemEdges = new Array<{ from: string; to: string; label: string }>(); + const ref = parseEntityRef(currentSystemNode); const catalogApi = useApi(catalogApiRef); const { loading, error, value: catalogResponse } = useAsync(() => { @@ -157,7 +158,7 @@ export function SystemDiagramCard() { kind: ['Component', 'API', 'Resource', 'System', 'Domain'], 'spec.system': [ currentSystemName, - `${ENTITY_DEFAULT_NAMESPACE}/${currentSystemName}`, + `${ref.namespace || 'Current Namespace'}/${currentSystemName}`, ], }, }); From 804a605ad84593411c69d9729c301a867987e0d0 Mon Sep 17 00:00:00 2001 From: RISHABH BUDHIRAJA Date: Wed, 26 May 2021 01:20:05 +0530 Subject: [PATCH 2/5] Revert "FIx: Diagram component using hardcoded namespace" This reverts commit dd3fc3e6616ab801e7fc1c9deeb7270f07cb3892. Signed-off-by: RISHABH BUDHIRAJA --- .../src/components/SystemDiagramCard/SystemDiagramCard.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx index 42d493912c..5fd32a6298 100644 --- a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx +++ b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx @@ -149,7 +149,6 @@ export function SystemDiagramCard() { const currentSystemNode = stringifyEntityRef(entity); const systemNodes = new Array<{ id: string; kind: string; name: string }>(); const systemEdges = new Array<{ from: string; to: string; label: string }>(); - const ref = parseEntityRef(currentSystemNode); const catalogApi = useApi(catalogApiRef); const { loading, error, value: catalogResponse } = useAsync(() => { @@ -158,7 +157,7 @@ export function SystemDiagramCard() { kind: ['Component', 'API', 'Resource', 'System', 'Domain'], 'spec.system': [ currentSystemName, - `${ref.namespace || 'Current Namespace'}/${currentSystemName}`, + `${ENTITY_DEFAULT_NAMESPACE}/${currentSystemName}`, ], }, }); From 6a584214360aaff67670bde6ccfb7d9738dd3792 Mon Sep 17 00:00:00 2001 From: RISHABH BUDHIRAJA Date: Wed, 26 May 2021 01:20:59 +0530 Subject: [PATCH 3/5] Fix: Diagram component using hardcoded namespace Signed-off-by: RISHABH BUDHIRAJA --- .../src/components/SystemDiagramCard/SystemDiagramCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx index 5fd32a6298..4e34fb1910 100644 --- a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx +++ b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx @@ -157,7 +157,7 @@ export function SystemDiagramCard() { kind: ['Component', 'API', 'Resource', 'System', 'Domain'], 'spec.system': [ currentSystemName, - `${ENTITY_DEFAULT_NAMESPACE}/${currentSystemName}`, + `${entity.metadata.namespace || ENTITY_DEFAULT_NAMESPACE}/${currentSystemName}`, ], }, }); From d2d42a7fa29ed9d83b750e5177b5606d725a943b Mon Sep 17 00:00:00 2001 From: RISHABH BUDHIRAJA Date: Wed, 26 May 2021 18:44:15 +0530 Subject: [PATCH 4/5] adds changeset for patch Signed-off-by: RISHABH BUDHIRAJA --- .changeset/thick-donkeys-fold.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thick-donkeys-fold.md diff --git a/.changeset/thick-donkeys-fold.md b/.changeset/thick-donkeys-fold.md new file mode 100644 index 0000000000..4720439479 --- /dev/null +++ b/.changeset/thick-donkeys-fold.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Fix for Diagram component using hardcoded namespace From 311bd449bd15bba7299a9a40c8147d46c5967e3c Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 15 Jun 2021 18:07:43 +0200 Subject: [PATCH 5/5] Apply suggestions from code review Signed-off-by: Patrik Oldsberg --- .changeset/thick-donkeys-fold.md | 2 +- .../src/components/SystemDiagramCard/SystemDiagramCard.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.changeset/thick-donkeys-fold.md b/.changeset/thick-donkeys-fold.md index 4720439479..f341724188 100644 --- a/.changeset/thick-donkeys-fold.md +++ b/.changeset/thick-donkeys-fold.md @@ -2,4 +2,4 @@ '@backstage/plugin-catalog': patch --- -Fix for Diagram component using hardcoded namespace +Fix for Diagram component using hard coded namespace. diff --git a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx index 4e34fb1910..36fac17d0a 100644 --- a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx +++ b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.tsx @@ -157,7 +157,9 @@ export function SystemDiagramCard() { kind: ['Component', 'API', 'Resource', 'System', 'Domain'], 'spec.system': [ currentSystemName, - `${entity.metadata.namespace || ENTITY_DEFAULT_NAMESPACE}/${currentSystemName}`, + `${ + entity.metadata.namespace || ENTITY_DEFAULT_NAMESPACE + }/${currentSystemName}`, ], }, });