From 635008e1732789d0329be9389ffd2c40aceaca5d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 3 Nov 2023 11:05:05 +0000 Subject: [PATCH] unique name enforcement for automations --- .../AutomationBuilder/FlowChart/FlowItemHeader.svelte | 7 +++++++ .../automation/SetupPanel/AutomationBlockSetup.svelte | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte index d07093ad7a..4c72c57208 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte @@ -58,11 +58,18 @@ } const getAutomationNameError = name => { + for (const [key, value] of Object.entries(stepNames)) { + if (name === value && key !== block.id) { + return "This name already exists, please enter a unique name" + } + } + if (name !== block.name && name?.length > 0) { let invalidRoleName = !validRegex.test(name) if (invalidRoleName) { return "Please enter a role name consisting of only alphanumeric symbols and underscores" } + return null } } diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index a42cc34b9d..9260a197c2 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -282,7 +282,6 @@ } function shouldRenderField(value) { - console.log(value) return ( value.customType !== "row" && value.customType !== "code" &&