Merge pull request #47 from emersion/torrent-options-path
Allow to change path when adding a new torrent
This commit is contained in:
commit
fdda72854a
|
@ -32,6 +32,7 @@ class AddTorrent extends Component {
|
||||||
torrent: null,
|
torrent: null,
|
||||||
files: [],
|
files: [],
|
||||||
start: true,
|
start: true,
|
||||||
|
path: null,
|
||||||
uploadThrottle: null,
|
uploadThrottle: null,
|
||||||
downloadThrottle: null,
|
downloadThrottle: null,
|
||||||
priority: 3,
|
priority: 3,
|
||||||
|
@ -100,7 +101,7 @@ class AddTorrent extends Component {
|
||||||
|
|
||||||
uploadFile() {
|
uploadFile() {
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
const { magnet, file, start } = this.state;
|
const { magnet, file, start, path } = this.state;
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
const customize =
|
const customize =
|
||||||
this.state.priority !== 3 ||
|
this.state.priority !== 3 ||
|
||||||
|
@ -119,12 +120,14 @@ class AddTorrent extends Component {
|
||||||
if (magnet) {
|
if (magnet) {
|
||||||
ws_send("UPLOAD_MAGNET", {
|
ws_send("UPLOAD_MAGNET", {
|
||||||
uri: magnet,
|
uri: magnet,
|
||||||
start: start && !customize
|
start: start && !customize,
|
||||||
|
path
|
||||||
}, handleOffer);
|
}, handleOffer);
|
||||||
} else {
|
} else {
|
||||||
ws_send("UPLOAD_TORRENT", {
|
ws_send("UPLOAD_TORRENT", {
|
||||||
size: file.size,
|
size: file.size,
|
||||||
start: start && !customize
|
start: start && !customize,
|
||||||
|
path
|
||||||
}, handleOffer);
|
}, handleOffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,6 +171,7 @@ class AddTorrent extends Component {
|
||||||
renderOptions() {
|
renderOptions() {
|
||||||
const {
|
const {
|
||||||
start,
|
start,
|
||||||
|
path,
|
||||||
priority,
|
priority,
|
||||||
downloadThrottle,
|
downloadThrottle,
|
||||||
uploadThrottle
|
uploadThrottle
|
||||||
|
@ -180,6 +184,8 @@ class AddTorrent extends Component {
|
||||||
id="new-torrent"
|
id="new-torrent"
|
||||||
start={start}
|
start={start}
|
||||||
startChanged={start => this.setState({ start })}
|
startChanged={start => this.setState({ start })}
|
||||||
|
path={path}
|
||||||
|
pathChanged={path => this.setState({ path: path || null })}
|
||||||
priority={priority}
|
priority={priority}
|
||||||
priorityChanged={priority => this.setState({ priority })}
|
priorityChanged={priority => this.setState({ priority })}
|
||||||
downloadThrottle={downloadThrottle}
|
downloadThrottle={downloadThrottle}
|
||||||
|
@ -187,7 +193,7 @@ class AddTorrent extends Component {
|
||||||
this.setState({ downloadThrottle })}
|
this.setState({ downloadThrottle })}
|
||||||
uploadThrottle={uploadThrottle}
|
uploadThrottle={uploadThrottle}
|
||||||
uploadThrottleChanged={uploadThrottle =>
|
uploadThrottleChanged={uploadThrottle =>
|
||||||
{ console.log(uploadThrottle); this.setState({ uploadThrottle }); }}
|
this.setState({ uploadThrottle })}
|
||||||
/>
|
/>
|
||||||
</CardBlock>
|
</CardBlock>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -12,6 +12,8 @@ export default class TorrentOptions extends Component {
|
||||||
id,
|
id,
|
||||||
start,
|
start,
|
||||||
startChanged,
|
startChanged,
|
||||||
|
path,
|
||||||
|
pathChanged,
|
||||||
priority,
|
priority,
|
||||||
priorityChanged,
|
priorityChanged,
|
||||||
downloadThrottle,
|
downloadThrottle,
|
||||||
|
@ -33,6 +35,16 @@ export default class TorrentOptions extends Component {
|
||||||
</Label>
|
</Label>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
}
|
}
|
||||||
|
{typeof path !== "undefined" &&
|
||||||
|
<FormGroup>
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
placeholder="Path"
|
||||||
|
value={path}
|
||||||
|
onChange={e => pathChanged(e.target.value)}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
}
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Label for="priority">Priority</Label>
|
<Label for="priority">Priority</Label>
|
||||||
<Input
|
<Input
|
||||||
|
|
Loading…
Reference in New Issue
Block a user