vmware-archive/vmware-cloud-director-ui-components

Incorrect validation message for vcd-input-with-units when max valus is Infinity

Closed this issue · 3 comments

Recent changes of vcd-input-with-units fixed all our issues and introduced build in validation which we would like to use. There is just one case which needs adjustment - when max value is unlimited the validation message says:
"Only numbers in the range of 10 MB to NaN are allowed" - see the NaN in the message.

As discussed offline:
if one needs to provide max value to the validator this should be 'Number.MAX_VALUE' and not 'Number.POSITIVE_INFINITY',
i.e. NumberWithUnitsFormValidators.isInRange(1, Number.MAX_VALUE, ...

Also if you want to restrict to any positive value, then just use the builtin angular validator Validator.min

Note that using Validator.min is not a good solution because the error message won't be properly formatted (without requiring callers to do duplicated work.

Creating another issue to allow callers to create a validator for just min/max that will properly format the error message. See #209

That's perfect. We will use Angular's min & max validations until these validations are provided.