fix: custom requirements and machine name comparison standardization
This commit is contained in:
parent
348260931e
commit
9760f02a0e
2 changed files with 7 additions and 3 deletions
|
|
@ -125,7 +125,11 @@ const validationSchema = Yup.object().shape({
|
||||||
.test(
|
.test(
|
||||||
'unique-name',
|
'unique-name',
|
||||||
'Machine name is already in use.',
|
'Machine name is already in use.',
|
||||||
(value, context) => !context.options.context.machineNames.includes(value)
|
(value, context) =>
|
||||||
|
!R.any(
|
||||||
|
it => R.equals(R.toLower(it), R.toLower(value)),
|
||||||
|
context.options.context.machineNames
|
||||||
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ const validationSchema = existingRequirements =>
|
||||||
'unique-name',
|
'unique-name',
|
||||||
'A custom information requirement with that name already exists',
|
'A custom information requirement with that name already exists',
|
||||||
(value, _context) =>
|
(value, _context) =>
|
||||||
!R.includes(
|
!R.any(
|
||||||
value,
|
it => R.equals(R.toLower(it), R.toLower(value)),
|
||||||
R.map(it => it.customRequest.name, existingRequirements)
|
R.map(it => it.customRequest.name, existingRequirements)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue