Skip to content

Commit

Permalink
Fix FE when tag name is undefined (#2146)
Browse files Browse the repository at this point in the history
Partly resolves #2106
  • Loading branch information
rashidakanchwala authored Oct 25, 2024
1 parent 9996c99 commit ddb2386
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/selectors/tags.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,7 +15,7 @@ export const getTagData = createSelector(
(tagIDs, tagName, tagActive, tagEnabled) =>
tagIDs.sort().map((id) => ({
id,
name: tagName[id],
name: tagName[id] || prettifyName(id),
active: Boolean(tagActive[id]),
enabled: Boolean(tagEnabled[id]),
}))
Expand Down
3 changes: 3 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export const stripNamespace = (str) => {
* @returns {String} The string with or without replaced values
*/
export const prettifyName = (str) => {
if (!str) {
return '';
}
const replacedString = str
.replace(/-/g, ' ')
.replace(/_/g, ' ')
Expand Down

0 comments on commit ddb2386

Please sign in to comment.