From 655f49b8c99975b505ee7df05b1fee5727ceb8db Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 19 Aug 2023 00:14:54 -0700 Subject: [PATCH] Fixed: Allow decimals for Custom Format size (cherry picked from commit 7f5ddff568ce9f87bd45420cbd36690b190bd633) Closes #9043 Fixes #6147 --- frontend/src/Components/Form/NumberInput.js | 2 +- frontend/src/Helpers/Props/inputTypes.js | 2 ++ src/Radarr.Http/ClientSchema/Field.cs | 1 + src/Radarr.Http/ClientSchema/SchemaBuilder.cs | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) 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 f3423c507..33928075b 100644 --- a/frontend/src/Helpers/Props/inputTypes.js +++ b/frontend/src/Helpers/Props/inputTypes.js @@ -5,6 +5,7 @@ export const CHECK = 'check'; export const DEVICE = 'device'; export const KEY_VALUE_LIST = 'keyValueList'; export const MOVIE_MONITORED_SELECT = 'movieMonitoredSelect'; +export const FLOAT = 'float'; export const NUMBER = 'number'; export const OAUTH = 'oauth'; export const PASSWORD = 'password'; @@ -32,6 +33,7 @@ export const all = [ DEVICE, KEY_VALUE_LIST, MOVIE_MONITORED_SELECT, + FLOAT, NUMBER, OAUTH, PASSWORD, diff --git a/src/Radarr.Http/ClientSchema/Field.cs b/src/Radarr.Http/ClientSchema/Field.cs index 8bcb3424a..688135aac 100644 --- a/src/Radarr.Http/ClientSchema/Field.cs +++ b/src/Radarr.Http/ClientSchema/Field.cs @@ -21,6 +21,7 @@ public class Field public string Hidden { get; set; } public PrivacyLevel Privacy { get; set; } public string Placeholder { get; set; } + public bool IsFloat { get; set; } public Field Clone() { diff --git a/src/Radarr.Http/ClientSchema/SchemaBuilder.cs b/src/Radarr.Http/ClientSchema/SchemaBuilder.cs index 1d5856bad..7fe9e8b57 100644 --- a/src/Radarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Radarr.Http/ClientSchema/SchemaBuilder.cs @@ -140,6 +140,11 @@ private static FieldMapping[] GetFieldMapping(Type type, string prefix, Func