From b7f3348256dec857d0acb49e1a2a8014cbf74732 Mon Sep 17 00:00:00 2001 From: rashidakanchwala Date: Tue, 22 Oct 2024 10:08:46 +0100 Subject: [PATCH 1/4] done on FE Signed-off-by: rashidakanchwala --- src/selectors/tags.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/selectors/tags.js b/src/selectors/tags.js index d2a55869d7..e736169e22 100644 --- a/src/selectors/tags.js +++ b/src/selectors/tags.js @@ -14,7 +14,7 @@ export const getTagData = createSelector( (tagIDs, tagName, tagActive, tagEnabled) => tagIDs.sort().map((id) => ({ id, - name: tagName[id], + name: tagName[id] || id, active: Boolean(tagActive[id]), enabled: Boolean(tagEnabled[id]), })) From f6fd0377f1cfb19c395a39d8a881dbb149482d36 Mon Sep 17 00:00:00 2001 From: rashidakanchwala Date: Tue, 22 Oct 2024 10:28:44 +0100 Subject: [PATCH 2/4] prettified the name Signed-off-by: rashidakanchwala --- src/selectors/tags.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/selectors/tags.js b/src/selectors/tags.js index e736169e22..7f040c7c4d 100644 --- a/src/selectors/tags.js +++ b/src/selectors/tags.js @@ -1,5 +1,6 @@ import { createSelector } from 'reselect'; import { getPipelineTagIDs } from './pipeline'; +import { prettifyName } from '../utils'; const getNodeTags = (state) => state.node.tags; const getTagName = (state) => state.tag.name; @@ -14,7 +15,7 @@ export const getTagData = createSelector( (tagIDs, tagName, tagActive, tagEnabled) => tagIDs.sort().map((id) => ({ id, - name: tagName[id] || id, + name: tagName[id] || prettifyName(id), active: Boolean(tagActive[id]), enabled: Boolean(tagEnabled[id]), })) From b2b9a0096fd84f729ff9ff3c29f6126de84d615a Mon Sep 17 00:00:00 2001 From: rashidakanchwala Date: Tue, 22 Oct 2024 17:42:42 +0100 Subject: [PATCH 3/4] changes based on comments Signed-off-by: rashidakanchwala --- src/utils/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 2b3e1b9061..971de643aa 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -120,7 +120,7 @@ export const stripNamespace = (str) => { * @param {String} str The string to check * @returns {String} The string with or without replaced values */ -export const prettifyName = (str) => { +export const prettifyName = (str = '') => { const replacedString = str .replace(/-/g, ' ') .replace(/_/g, ' ') From b1528e0198e3aaf02791f66eb908e12ac3b5177b Mon Sep 17 00:00:00 2001 From: rashidakanchwala Date: Fri, 25 Oct 2024 10:26:39 +0100 Subject: [PATCH 4/4] done Signed-off-by: rashidakanchwala --- src/utils/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 971de643aa..83804e0a6c 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -120,7 +120,10 @@ export const stripNamespace = (str) => { * @param {String} str The string to check * @returns {String} The string with or without replaced values */ -export const prettifyName = (str = '') => { +export const prettifyName = (str) => { + if (!str) { + return ''; + } const replacedString = str .replace(/-/g, ' ') .replace(/_/g, ' ')