receptor/src/ui/torrent_options.js

69 lines
1.8 KiB
JavaScript
Raw Normal View History

2017-09-10 13:17:32 +02:00
import React, { Component } from 'react';
import {
FormGroup,
Label,
Input
} from 'reactstrap';
2017-09-10 14:21:08 +02:00
import Throttle from './throttle';
2017-09-10 13:17:32 +02:00
export default class TorrentOptions extends Component {
render() {
const {
2017-09-10 14:21:08 +02:00
id,
2017-09-10 13:17:32 +02:00
start,
startChanged,
priority,
priorityChanged,
downloadThrottle,
downloadThrottleChanged,
uploadThrottle,
uploadThrottleChanged,
} = this.props;
return (
<div>
2017-09-10 13:34:39 +02:00
{typeof start !== "undefined" &&
2017-09-10 13:17:32 +02:00
<FormGroup>
<Label for="start-immediately" check style={{paddingLeft: 0}}>
<input
type="checkbox"
checked={start}
onChange={e => startChanged(!start)}
id="start-immediately"
/> Start immediately
</Label>
</FormGroup>
}
<FormGroup>
<Label for="priority">Priority</Label>
<Input
type="select"
id="priority"
value={priority}
onChange={e => priorityChanged(parseInt(e.target.value))}
>
<option value="1">Lowest</option>
<option value="2">Low</option>
<option value="3">Normal</option>
<option value="4">High</option>
<option value="5">Highest</option>
</Input>
</FormGroup>
<Throttle
2017-09-10 14:21:08 +02:00
prop={`dl-throttle-${id}`}
2017-09-10 13:17:32 +02:00
legend="Download throttle"
limit={downloadThrottle}
global={true}
2017-09-10 13:17:32 +02:00
onChange={limit => downloadThrottleChanged(limit)}
/>
<Throttle
2017-09-10 14:21:08 +02:00
prop={`ul-throttle-${id}`}
2017-09-10 13:17:32 +02:00
legend="Upload throttle"
limit={uploadThrottle}
global={true}
2017-09-10 13:17:32 +02:00
onChange={limit => uploadThrottleChanged(limit)}
/>
</div>
);
}
}