mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Fixed: Additional UI number input fixes
This commit is contained in:
parent
8cb8059b2f
commit
b5339b75ff
3 changed files with 29 additions and 14 deletions
|
@ -8,24 +8,36 @@ class NumberInput extends Component {
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onChange = ({ name, value }) => {
|
onChange = ({ name, value }) => {
|
||||||
const {
|
|
||||||
min,
|
|
||||||
max
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
let newValue = null;
|
let newValue = null;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
newValue = this.props.isFloat ? parseFloat(value) : parseInt(value);
|
newValue = this.props.isFloat ? parseFloat(value) : parseInt(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min != null && newValue < min) {
|
this.props.onChange({
|
||||||
|
name,
|
||||||
|
value: newValue
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onBlur = () => {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
value,
|
||||||
|
min,
|
||||||
|
max,
|
||||||
|
onChange
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
let newValue = value;
|
||||||
|
|
||||||
|
if (min != null && newValue != null && newValue < min) {
|
||||||
newValue = min;
|
newValue = min;
|
||||||
} else if (max != null && newValue > max) {
|
} else if (max != null && newValue != null && newValue > max) {
|
||||||
newValue = max;
|
newValue = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.onChange({
|
onChange({
|
||||||
name,
|
name,
|
||||||
value: newValue
|
value: newValue
|
||||||
});
|
});
|
||||||
|
@ -44,12 +56,14 @@ class NumberInput extends Component {
|
||||||
type="number"
|
type="number"
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
|
onBlur={this.onBlur}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberInput.propTypes = {
|
NumberInput.propTypes = {
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
value: PropTypes.number,
|
value: PropTypes.number,
|
||||||
min: PropTypes.number,
|
min: PropTypes.number,
|
||||||
max: PropTypes.number,
|
max: PropTypes.number,
|
||||||
|
|
|
@ -122,7 +122,8 @@ class TextInput extends Component {
|
||||||
value,
|
value,
|
||||||
hasError,
|
hasError,
|
||||||
hasWarning,
|
hasWarning,
|
||||||
hasButton
|
hasButton,
|
||||||
|
onBlur
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -143,6 +144,7 @@ class TextInput extends Component {
|
||||||
value={value}
|
value={value}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onFocus={this.onFocus}
|
onFocus={this.onFocus}
|
||||||
|
onBlur={onBlur}
|
||||||
onKeyUp={this.onKeyUp}
|
onKeyUp={this.onKeyUp}
|
||||||
onMouseDown={this.onMouseDown}
|
onMouseDown={this.onMouseDown}
|
||||||
onMouseUp={this.onMouseUp}
|
onMouseUp={this.onMouseUp}
|
||||||
|
@ -164,6 +166,7 @@ TextInput.propTypes = {
|
||||||
hasButton: PropTypes.bool,
|
hasButton: PropTypes.bool,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
onFocus: PropTypes.func,
|
onFocus: PropTypes.func,
|
||||||
|
onBlur: PropTypes.func,
|
||||||
onSelectionChange: PropTypes.func
|
onSelectionChange: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
|
||||||
|
@ -26,15 +24,15 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
|
|
||||||
var monoVersion = _platformInfo.Version;
|
var monoVersion = _platformInfo.Version;
|
||||||
|
|
||||||
if (monoVersion == new Version("4.4") || monoVersion == new Version("4.4.1"))
|
if (monoVersion == new Version("4.4.0") || monoVersion == new Version("4.4.1"))
|
||||||
{
|
{
|
||||||
_logger.Debug("Mono version {0}", monoVersion);
|
_logger.Debug("Mono version {0}", monoVersion);
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Your Mono version {monoVersion} has a bug that causes issues connecting to indexers/download clients. You should upgrade to a higher version");
|
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Your Mono version {monoVersion} has a bug that causes issues connecting to indexers/download clients. You should upgrade to a higher version");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monoVersion >= new Version("4.4"))
|
if (monoVersion >= new Version("4.4.2"))
|
||||||
{
|
{
|
||||||
_logger.Debug("Mono version is 4.4 or better: {0}", monoVersion);
|
_logger.Debug("Mono version is 4.4.2 or better: {0}", monoVersion);
|
||||||
return new HealthCheck(GetType());
|
return new HealthCheck(GetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue