diff --git a/src/fireedge/src/client/components/FormControl/AutocompleteController.js b/src/fireedge/src/client/components/FormControl/AutocompleteController.js index 3123e89038..3393f4d297 100644 --- a/src/fireedge/src/client/components/FormControl/AutocompleteController.js +++ b/src/fireedge/src/client/components/FormControl/AutocompleteController.js @@ -20,7 +20,7 @@ import { TextField, Chip, Autocomplete } from '@mui/material' import { useController } from 'react-hook-form' import { ErrorHelper } from 'client/components/FormControl' -import { Tr, labelCanBeTranslated } from 'client/components/HOC' +import { Tr, Translate } from 'client/components/HOC' import { generateKey } from 'client/utils' const AutocompleteController = memo( @@ -77,17 +77,17 @@ const AutocompleteController = memo( isOptionEqualToValue={(option) => option.value === renderValue} renderInput={({ inputProps, ...inputParams }) => ( } inputProps={{ ...inputProps, 'data-cy': cy }} InputProps={{ readOnly }} error={Boolean(error)} helperText={ Boolean(error) && ( - + + {tooltip && + inputProps?.value?.length > 0 && + `. ${Tr(tooltip)}`} + ) } FormHelperTextProps={{ 'data-cy': `${cy}-error` }} @@ -96,7 +96,7 @@ const AutocompleteController = memo( )} {...(tooltip && { loading: true, - loadingText: labelCanBeTranslated(tooltip) ? Tr(tooltip) : tooltip, + loadingText: , })} {...(Array.isArray(separators) && { autoSelect: true, diff --git a/src/fireedge/src/client/components/FormControl/ErrorHelper.js b/src/fireedge/src/client/components/FormControl/ErrorHelper.js index 50c8e040a2..5b14cab79e 100644 --- a/src/fireedge/src/client/components/FormControl/ErrorHelper.js +++ b/src/fireedge/src/client/components/FormControl/ErrorHelper.js @@ -27,7 +27,7 @@ const ErrorTypo = styled(Typography)(({ theme }) => ({ overflowWrap: 'anywhere', })) -const ErrorHelper = memo(({ label, ...rest }) => { +const ErrorHelper = memo(({ label, children, ...rest }) => { const ensuredLabel = Array.isArray(label) ? label[0] : label const translateProps = ensuredLabel?.word @@ -45,12 +45,14 @@ const ErrorHelper = memo(({ label, ...rest }) => { + {children} ) }) ErrorHelper.propTypes = { + children: PropTypes.any, label: PropTypes.oneOfType([ PropTypes.string, PropTypes.node, diff --git a/src/fireedge/src/client/constants/translates.js b/src/fireedge/src/client/constants/translates.js index c271303eb7..2c8db8360e 100644 --- a/src/fireedge/src/client/constants/translates.js +++ b/src/fireedge/src/client/constants/translates.js @@ -971,7 +971,7 @@ module.exports = { /* Validation - object */ 'validation.object.noUnknown': 'Has unspecified keys: %s', /* Validation - array */ - 'validation.array.min': 'Must have at least %s items', - 'validation.array.max': 'Must have less than or equal to %s items', - 'validation.array.length': 'Must have %s items', + 'validation.array.min': 'Must have at least %s item(s) to act as a default', + 'validation.array.max': 'Must have less than or equal to %s item(s)', + 'validation.array.length': 'Must have %s item(s)', }