mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
improve device value helper text
This commit is contained in:
@@ -170,14 +170,10 @@ export const deviceValueItemValidation = (dv: DeviceValue) =>
|
||||
{
|
||||
validator(rule: InternalRuleItem, value: string, callback: (error?: string) => void) {
|
||||
if (dv.u !== DeviceValueUOM.NONE && isNaN(+value)) {
|
||||
// not a number
|
||||
dv.m && dv.x
|
||||
? callback('Value must be a number between ' + dv.m + ' and ' + dv.x)
|
||||
: callback('Value must be a number');
|
||||
callback('Not a valid number');
|
||||
}
|
||||
// is a number
|
||||
(dv.m && Number(value) < dv.m) || (dv.x && Number(value) > dv.x)
|
||||
? callback('Value must be between ' + dv.m + ' and ' + dv.x)
|
||||
? callback('Value out of range')
|
||||
: callback();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user