diff --git a/frontend/src/Components/Form/NumberInput.js b/frontend/src/Components/Form/NumberInput.js index 454aad997..cac274d95 100644 --- a/frontend/src/Components/Form/NumberInput.js +++ b/frontend/src/Components/Form/NumberInput.js @@ -41,7 +41,7 @@ class NumberInput extends Component { componentDidUpdate(prevProps, prevState) { const { value } = this.props; - if (value !== prevProps.value && !this.state.isFocused) { + if (!isNaN(value) && value !== prevProps.value && !this.state.isFocused) { this.setState({ value: value == null ? '' : value.toString() }); diff --git a/frontend/src/Helpers/Props/inputTypes.js b/frontend/src/Helpers/Props/inputTypes.js index 1b5c6c6fd..8ebbd540b 100644 --- a/frontend/src/Helpers/Props/inputTypes.js +++ b/frontend/src/Helpers/Props/inputTypes.js @@ -6,6 +6,7 @@ export const PLAYLIST = 'playlist'; export const KEY_VALUE_LIST = 'keyValueList'; export const MONITOR_ALBUMS_SELECT = 'monitorAlbumsSelect'; export const MONITOR_NEW_ITEMS_SELECT = 'monitorNewItemsSelect'; +export const FLOAT = 'float'; export const NUMBER = 'number'; export const OAUTH = 'oauth'; export const PASSWORD = 'password'; @@ -35,6 +36,7 @@ export const all = [ KEY_VALUE_LIST, MONITOR_ALBUMS_SELECT, MONITOR_NEW_ITEMS_SELECT, + FLOAT, NUMBER, OAUTH, PASSWORD, diff --git a/src/Lidarr.Http/ClientSchema/Field.cs b/src/Lidarr.Http/ClientSchema/Field.cs index a05cbffcd..2973521c2 100644 --- a/src/Lidarr.Http/ClientSchema/Field.cs +++ b/src/Lidarr.Http/ClientSchema/Field.cs @@ -19,6 +19,7 @@ namespace Lidarr.Http.ClientSchema public string Section { get; set; } public string Hidden { get; set; } public string Placeholder { get; set; } + public bool IsFloat { get; set; } public Field Clone() { diff --git a/src/Lidarr.Http/ClientSchema/SchemaBuilder.cs b/src/Lidarr.Http/ClientSchema/SchemaBuilder.cs index f6f9a1557..933925054 100644 --- a/src/Lidarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Lidarr.Http/ClientSchema/SchemaBuilder.cs @@ -124,6 +124,11 @@ namespace Lidarr.Http.ClientSchema field.Hidden = fieldAttribute.Hidden.ToString().FirstCharToLower(); } + if (fieldAttribute.Type is FieldType.Number && propertyInfo.PropertyType == typeof(double)) + { + field.IsFloat = true; + } + var valueConverter = GetValueConverter(propertyInfo.PropertyType); result.Add(new FieldMapping