fix: custom requirements and machine name comparison standardization

This commit is contained in:
Sérgio Salgado 2022-03-08 15:15:46 +00:00
parent 348260931e
commit 9760f02a0e
2 changed files with 7 additions and 3 deletions

View file

@ -125,7 +125,11 @@ const validationSchema = Yup.object().shape({
.test(
'unique-name',
'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
)
)
})

View file

@ -34,8 +34,8 @@ const validationSchema = existingRequirements =>
'unique-name',
'A custom information requirement with that name already exists',
(value, _context) =>
!R.includes(
value,
!R.any(
it => R.equals(R.toLower(it), R.toLower(value)),
R.map(it => it.customRequest.name, existingRequirements)
)
)