diff --git a/packages/@sparrow-workspaces/src/features/testflow-schedule-explorer/components/configurations/Configurations.svelte b/packages/@sparrow-workspaces/src/features/testflow-schedule-explorer/components/configurations/Configurations.svelte index eb7865c42..dfa07d407 100644 --- a/packages/@sparrow-workspaces/src/features/testflow-schedule-explorer/components/configurations/Configurations.svelte +++ b/packages/@sparrow-workspaces/src/features/testflow-schedule-explorer/components/configurations/Configurations.svelte @@ -92,6 +92,9 @@ let scheduleName = ""; let selectedEnvironment = ""; let isError = false; + let isErrors = { + scheduleNameError: false, + }; let isUpdating = false; let selectedTestData = "none"; @@ -511,6 +514,24 @@ $: if (formattedDate) { selectedDate = parseDateString(formattedDate); } + + const isValidScheduleName = (name: string) => { + // Regex: 1–30 characters, allows letters, numbers, spaces, hyphens, and underscores + const regex = /^[A-Za-z0-9 _-]{1,30}$/; + return regex.test(name); + }; + + $: { + if (scheduleName && scheduleName.trim()) { + if (!isValidScheduleName(scheduleName.trim())) { + isErrors.scheduleNameError = true; + } else { + isErrors.scheduleNameError = false; + } + } else { + isErrors.scheduleNameError = false; + } + }
+ Schedule name must be 1-30 characters and can only contain letters, + numbers, spaces, hyphens (-), and underscores (_). +
{/if}