Fixed: Allow decimals for Custom Format size

Closes #5809
This commit is contained in:
Mark McDowall 2023-08-19 00:14:54 -07:00
parent 566fae9d58
commit 7f5ddff568
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

@ -4,6 +4,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 MONITOR_EPISODES_SELECT = 'monitorEpisodesSelect'; export const MONITOR_EPISODES_SELECT = 'monitorEpisodesSelect';
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';
@ -30,6 +31,7 @@ export const all = [
DEVICE, DEVICE,
KEY_VALUE_LIST, KEY_VALUE_LIST,
MONITOR_EPISODES_SELECT, MONITOR_EPISODES_SELECT,
FLOAT,
NUMBER, NUMBER,
OAUTH, OAUTH,
PASSWORD, PASSWORD,

View File

@ -21,6 +21,7 @@ namespace Sonarr.Http.ClientSchema
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 @@ namespace Sonarr.Http.ClientSchema
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