From 2579f7a9dfd5d80b33fc7807b7cb6660c7df4869 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 14 Mar 2018 22:00:08 +0100 Subject: [PATCH] Allow to change path when adding a new torrent --- src/ui/add_torrent.js | 14 ++++++++++---- src/ui/torrent_options.js | 12 ++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/ui/add_torrent.js b/src/ui/add_torrent.js index 6ab60a2..fb5c9b2 100644 --- a/src/ui/add_torrent.js +++ b/src/ui/add_torrent.js @@ -32,6 +32,7 @@ class AddTorrent extends Component { torrent: null, files: [], start: true, + path: null, uploadThrottle: null, downloadThrottle: null, priority: 3, @@ -100,7 +101,7 @@ class AddTorrent extends Component { uploadFile() { this.setState({ loading: true }); - const { magnet, file, start } = this.state; + const { magnet, file, start, path } = this.state; const { dispatch } = this.props; const customize = this.state.priority !== 3 || @@ -119,12 +120,14 @@ class AddTorrent extends Component { if (magnet) { ws_send("UPLOAD_MAGNET", { uri: magnet, - start: start && !customize + start: start && !customize, + path }, handleOffer); } else { ws_send("UPLOAD_TORRENT", { size: file.size, - start: start && !customize + start: start && !customize, + path }, handleOffer); } } @@ -168,6 +171,7 @@ class AddTorrent extends Component { renderOptions() { const { start, + path, priority, downloadThrottle, uploadThrottle @@ -180,6 +184,8 @@ class AddTorrent extends Component { id="new-torrent" start={start} startChanged={start => this.setState({ start })} + path={path} + pathChanged={path => this.setState({ path: path || null })} priority={priority} priorityChanged={priority => this.setState({ priority })} downloadThrottle={downloadThrottle} @@ -187,7 +193,7 @@ class AddTorrent extends Component { this.setState({ downloadThrottle })} uploadThrottle={uploadThrottle} uploadThrottleChanged={uploadThrottle => - { console.log(uploadThrottle); this.setState({ uploadThrottle }); }} + this.setState({ uploadThrottle })} /> diff --git a/src/ui/torrent_options.js b/src/ui/torrent_options.js index a2e1f87..ad47d5a 100644 --- a/src/ui/torrent_options.js +++ b/src/ui/torrent_options.js @@ -12,6 +12,8 @@ export default class TorrentOptions extends Component { id, start, startChanged, + path, + pathChanged, priority, priorityChanged, downloadThrottle, @@ -33,6 +35,16 @@ export default class TorrentOptions extends Component { } + {typeof path !== "undefined" && + + pathChanged(e.target.value)} + /> + + }