1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Fixed: Allow decimals for Custom Format size

(cherry picked from commit 7f5ddff568ce9f87bd45420cbd36690b190bd633)

Closes #9043
Fixes #6147
This commit is contained in:
Mark McDowall 2023-08-19 00:14:54 -07:00 committed by Bogdan
parent d8c1fe5486
commit 655f49b8c9
4 changed files with 9 additions and 1 deletions

View File

@ -41,7 +41,7 @@ class NumberInput extends Component {
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
const { value } = this.props; const { value } = this.props;
if (value !== prevProps.value && !this.state.isFocused) { if (!isNaN(value) && value !== prevProps.value && !this.state.isFocused) {
this.setState({ this.setState({
value: value == null ? '' : value.toString() value: value == null ? '' : value.toString()
}); });

View File

@ -5,6 +5,7 @@ export const CHECK = 'check';
export const DEVICE = 'device'; export const DEVICE = 'device';
export const KEY_VALUE_LIST = 'keyValueList'; export const KEY_VALUE_LIST = 'keyValueList';
export const MOVIE_MONITORED_SELECT = 'movieMonitoredSelect'; export const MOVIE_MONITORED_SELECT = 'movieMonitoredSelect';
export const FLOAT = 'float';
export const NUMBER = 'number'; export const NUMBER = 'number';
export const OAUTH = 'oauth'; export const OAUTH = 'oauth';
export const PASSWORD = 'password'; export const PASSWORD = 'password';
@ -32,6 +33,7 @@ export const all = [
DEVICE, DEVICE,
KEY_VALUE_LIST, KEY_VALUE_LIST,
MOVIE_MONITORED_SELECT, MOVIE_MONITORED_SELECT,
FLOAT,
NUMBER, NUMBER,
OAUTH, OAUTH,
PASSWORD, PASSWORD,

View File

@ -21,6 +21,7 @@ public class Field
public string Hidden { get; set; } public string Hidden { get; set; }
public PrivacyLevel Privacy { get; set; } public PrivacyLevel Privacy { get; set; }
public string Placeholder { get; set; } public string Placeholder { get; set; }
public bool IsFloat { get; set; }
public Field Clone() public Field Clone()
{ {

View File

@ -140,6 +140,11 @@ private static FieldMapping[] GetFieldMapping(Type type, string prefix, Func<obj
field.Hidden = fieldAttribute.Hidden.ToString().FirstCharToLower(); field.Hidden = fieldAttribute.Hidden.ToString().FirstCharToLower();
} }
if (fieldAttribute.Type is FieldType.Number && propertyInfo.PropertyType == typeof(double))
{
field.IsFloat = true;
}
var valueConverter = GetValueConverter(propertyInfo.PropertyType); var valueConverter = GetValueConverter(propertyInfo.PropertyType);
result.Add(new FieldMapping result.Add(new FieldMapping