diff --git a/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx b/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx index 38597983a0..e839cf4b2b 100644 --- a/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx +++ b/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx @@ -163,8 +163,8 @@ export const CustomRules: React.FC = () => { filteredItems?.forEach((item) => { const { source, target, total } = parseRules(item); - const sourceLabelName = source ? getParsedLabel(source)?.labelValue : ""; - const targetLabelName = target ? getParsedLabel(target)?.labelValue : ""; + const sourceLabelName = getParsedLabel(source)?.labelValue ?? ""; + const targetLabelName = getParsedLabel(target)?.labelValue ?? ""; const sourceTargetLabel = `${sourceLabelName} / ${targetLabelName}`; rows.push({ diff --git a/client/src/app/utils/rules-utils.ts b/client/src/app/utils/rules-utils.ts index a04dc88583..3c460d6587 100644 --- a/client/src/app/utils/rules-utils.ts +++ b/client/src/app/utils/rules-utils.ts @@ -104,16 +104,25 @@ interface ParsedLabel { labelValue: string; } -export const getParsedLabel = (label: string): ParsedLabel => { +export const getParsedLabel = (label: string | null): ParsedLabel => { + if (label === null) { + return { + labelType: "", + labelValue: "", + }; + } + const char1 = label.indexOf("/") + 1; const char2 = label.lastIndexOf("="); const type = label.substring(char1, char2); const value = label.split("=").pop(); + return { labelType: type || "", labelValue: value || "", }; }; + export const getLabels = (labels: string[]) => labels.reduce( (map: ILabelMap, label) => {