Scheduler name optional

This commit is contained in:
MichaelDvP
2024-07-08 10:20:13 +02:00
parent 2f66fec748
commit d774591065
2 changed files with 3 additions and 3 deletions

View File

@@ -344,7 +344,7 @@ const SchedulerDialog = ({
<ValidatedTextField
fieldErrors={fieldErrors}
name="name"
label={LL.NAME(0)}
label={LL.NAME(0) + ' (' + LL.OPTIONAL() + ')'}
value={editItem.name}
fullWidth
margin="normal"

View File

@@ -288,6 +288,7 @@ export const uniqueNameValidator = (schedule: ScheduleItem[], o_name?: string) =
) {
if (
(o_name === undefined || o_name !== name) &&
name !== '' &&
schedule.find((si) => si.name === name)
) {
callback('Name already in use');
@@ -303,10 +304,9 @@ export const schedulerItemValidation = (
) =>
new Schema({
name: [
{ required: true, message: 'Name is required' },
{
type: 'string',
pattern: /^[a-zA-Z0-9_\\.]{1,15}$/,
pattern: /^[a-zA-Z0-9_\\.]{0,15}$/,
message: "Must be <15 characters: alpha numeric, '_' or '.'"
},
...[uniqueNameValidator(schedule, scheduleItem.o_name)]