diff --git a/src/ui/add_torrent.js b/src/ui/add_torrent.js index 75b386d..dcc3015 100644 --- a/src/ui/add_torrent.js +++ b/src/ui/add_torrent.js @@ -31,8 +31,22 @@ class Throttle extends Component { invokeChange() { const { onChange } = this.props; + if (!onChange) { + return; + } + const { strategy, limit, unit } = this.state; - this.onChange && this.onChange(strategy, convertToBitrate(limit, unit)); + switch (strategy) { + case "global": + onChange(null); + break; + case "unlimited": + onChange(-1); + break; + default: + onChange(convertToBitrate(limit, unit)); + break; + } } setStrategy(strategy) { @@ -132,7 +146,10 @@ class AddTorrent extends Component { file: null, torrent: null, files: [], - startImmediately: true + startImmediately: true, + uploadThrottle: -1, + downloadThrottle: -1, + priority: 3, }; } @@ -218,16 +235,31 @@ class AddTorrent extends Component { - - - - - - + + this.setState({ priority: parseInt(e.target.value)}) + } + > + + + + + - - + this.setState({ downloadThrottle: limit })} + /> + this.setState({ uploadThrottle: limit })} + /> );