Allow to change path when adding a new torrent
This commit is contained in:
parent
3ee4461410
commit
2579f7a9df
|
@ -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 })}
|
||||
/>
|
||||
</CardBlock>
|
||||
</Card>
|
||||
|
|
|
@ -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 {
|
|||
</Label>
|
||||
</FormGroup>
|
||||
}
|
||||
{typeof path !== "undefined" &&
|
||||
<FormGroup>
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Path"
|
||||
value={path}
|
||||
onChange={e => pathChanged(e.target.value)}
|
||||
/>
|
||||
</FormGroup>
|
||||
}
|
||||
<FormGroup>
|
||||
<Label for="priority">Priority</Label>
|
||||
<Input
|
||||
|
|
Loading…
Reference in New Issue
Block a user