From 3440e220625c2ce239e8f9d2f32af24cd1c20e25 Mon Sep 17 00:00:00 2001 From: Ym <173550318+MaxonT@users.noreply.github.com> Date: Wed, 25 Nov 2026 12:38:40 -0600 Subject: [PATCH] fix(designer): say that spaces are not allowed in the workflow name error Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com> --- Localize/lang/strings.json | 2 ++ .../templates/utils/__test__/validation.spec.ts | 14 ++++++++++++-- .../src/lib/core/templates/utils/helper.ts | 7 +++++++ .../templates/utils/__test__/validation.spec.ts | 14 ++++++++++++-- .../src/lib/core/templates/utils/helper.ts | 7 +++++++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Localize/lang/strings.json b/Localize/lang/strings.json index 67a005b9e8e..107d5b46c6f 100644 --- a/Localize/lang/strings.json +++ b/Localize/lang/strings.json @@ -5039,6 +5039,7 @@ "_rxMXmZ.comment": "Time zone value ", "_s+4LEa.comment": "Open folder label", "_s0Qaot.comment": "Workflow Parameters Panel", + "_s2XJ/T.comment": "Error message when the workflow name contains a space.", "_s2f0XK.comment": "Content for the toaster after creating a group in add files panel", "_s2ydQX.comment": "Error validation message for invalid JSON object. Do not remove the double single quotes around the display name, as it is needed to wrap the placeholder text.", "_s5AOpV.comment": "Label for the title for panel header card", @@ -6479,6 +6480,7 @@ "rxMXmZ": "(UTC+04:00) Port Louis", "s+4LEa": "Open folder", "s0Qaot": "Workflow Parameters Panel", + "s2XJ/T": "Workflow name cannot contain spaces. Use letters, numbers, dashes ('-') and underscores ('_') instead.", "s2f0XK": "Group {name} has been created and selected.", "s2ydQX": "''Value'' must be a valid JSON object", "s5AOpV": "Card title", diff --git a/libs/designer-v2/src/lib/core/templates/utils/__test__/validation.spec.ts b/libs/designer-v2/src/lib/core/templates/utils/__test__/validation.spec.ts index ddfa5507880..0d1ff5e668f 100644 --- a/libs/designer-v2/src/lib/core/templates/utils/__test__/validation.spec.ts +++ b/libs/designer-v2/src/lib/core/templates/utils/__test__/validation.spec.ts @@ -19,12 +19,22 @@ describe('Template Validation Tests', () => { id: 'zMKxg9', description: 'Error message when the workflow name is invalid regex.', }); - expect(checkWorkflowNameWithRegex(intl, 'workflow name')).toBe(nameDoesNotMath); expect(checkWorkflowNameWithRegex(intl, '1workflowName')).toBe(nameDoesNotMath); expect(checkWorkflowNameWithRegex(intl, '1_workflowName_1')).toBe(nameDoesNotMath); - expect(checkWorkflowNameWithRegex(intl, 'workflow_Name space')).toBe(nameDoesNotMath); expect(checkWorkflowNameWithRegex(intl, 'workflow_%7')).toBe(nameDoesNotMath); }); + + test('Names with a space get a message that says spaces are not allowed', async () => { + const nameHasSpace = intl.formatMessage({ + defaultMessage: "Workflow name cannot contain spaces. Use letters, numbers, dashes ('-') and underscores ('_') instead.", + id: 's2XJ/T', + description: 'Error message when the workflow name contains a space.', + }); + expect(checkWorkflowNameWithRegex(intl, 'workflow name')).toBe(nameHasSpace); + expect(checkWorkflowNameWithRegex(intl, 'My Workflow')).toBe(nameHasSpace); + expect(checkWorkflowNameWithRegex(intl, 'workflow_Name space')).toBe(nameHasSpace); + expect(checkWorkflowNameWithRegex(intl, ' workflow')).toBe(nameHasSpace); + }); }); describe('validateWorkflowData', () => { diff --git a/libs/designer-v2/src/lib/core/templates/utils/helper.ts b/libs/designer-v2/src/lib/core/templates/utils/helper.ts index 5f75dad2126..6cbe711e491 100644 --- a/libs/designer-v2/src/lib/core/templates/utils/helper.ts +++ b/libs/designer-v2/src/lib/core/templates/utils/helper.ts @@ -273,6 +273,13 @@ export const validateConnectionsValue = ( export const checkWorkflowNameWithRegex = (intl: IntlShape, workflowName: string) => { const regex = /^[A-Za-z][A-Za-z0-9]*(?:[_-][A-Za-z0-9]+)*$/; if (!regex.test(workflowName)) { + if (/\s/.test(workflowName)) { + return intl.formatMessage({ + defaultMessage: "Workflow name cannot contain spaces. Use letters, numbers, dashes ('-') and underscores ('_') instead.", + id: 's2XJ/T', + description: 'Error message when the workflow name contains a space.', + }); + } return intl.formatMessage({ defaultMessage: "Name can only contain letters, numbers, and '-', '(', ')', '_' or '.", id: 'TwBRcg', diff --git a/libs/designer/src/lib/core/templates/utils/__test__/validation.spec.ts b/libs/designer/src/lib/core/templates/utils/__test__/validation.spec.ts index dd8208eda98..4c25d65f9fe 100644 --- a/libs/designer/src/lib/core/templates/utils/__test__/validation.spec.ts +++ b/libs/designer/src/lib/core/templates/utils/__test__/validation.spec.ts @@ -20,12 +20,22 @@ describe('Template Validation Tests', () => { id: 'zMKxg9', description: 'Error message when the workflow name is invalid regex.', }); - expect(checkWorkflowNameWithRegex(intl, 'workflow name')).toBe(nameDoesNotMath); expect(checkWorkflowNameWithRegex(intl, '1workflowName')).toBe(nameDoesNotMath); expect(checkWorkflowNameWithRegex(intl, '1_workflowName_1')).toBe(nameDoesNotMath); - expect(checkWorkflowNameWithRegex(intl, 'workflow_Name space')).toBe(nameDoesNotMath); expect(checkWorkflowNameWithRegex(intl, 'workflow_%7')).toBe(nameDoesNotMath); }); + + test('Names with a space get a message that says spaces are not allowed', async () => { + const nameHasSpace = intl.formatMessage({ + defaultMessage: "Workflow name cannot contain spaces. Use letters, numbers, dashes ('-') and underscores ('_') instead.", + id: 's2XJ/T', + description: 'Error message when the workflow name contains a space.', + }); + expect(checkWorkflowNameWithRegex(intl, 'workflow name')).toBe(nameHasSpace); + expect(checkWorkflowNameWithRegex(intl, 'My Workflow')).toBe(nameHasSpace); + expect(checkWorkflowNameWithRegex(intl, 'workflow_Name space')).toBe(nameHasSpace); + expect(checkWorkflowNameWithRegex(intl, ' workflow')).toBe(nameHasSpace); + }); }); describe('validateWorkflowData', () => { diff --git a/libs/designer/src/lib/core/templates/utils/helper.ts b/libs/designer/src/lib/core/templates/utils/helper.ts index c0d63d628dc..7c9d89904ab 100644 --- a/libs/designer/src/lib/core/templates/utils/helper.ts +++ b/libs/designer/src/lib/core/templates/utils/helper.ts @@ -273,6 +273,13 @@ export const validateConnectionsValue = ( export const checkWorkflowNameWithRegex = (intl: IntlShape, workflowName: string) => { const regex = /^[A-Za-z][A-Za-z0-9]*(?:[_-][A-Za-z0-9]+)*$/; if (!regex.test(workflowName)) { + if (/\s/.test(workflowName)) { + return intl.formatMessage({ + defaultMessage: "Workflow name cannot contain spaces. Use letters, numbers, dashes ('-') and underscores ('_') instead.", + id: 's2XJ/T', + description: 'Error message when the workflow name contains a space.', + }); + } return intl.formatMessage({ defaultMessage: "Workflow name must start with a letter and can contain letters, numbers (0-9), dashes ('-'), and underscores ('_').", id: '/21RuK',