Implement editing live torrents
This commit is contained in:
parent
176312617c
commit
f44e7a3001
|
@ -1,2 +1,10 @@
|
||||||
export const UPDATE_RESOURCES = 'UPDATE_RESOURCES';
|
export const UPDATE_RESOURCES = 'UPDATE_RESOURCES';
|
||||||
export const RESOURCES_REMOVED = 'RESOURCES_REMOVED';
|
export const RESOURCES_REMOVED = 'RESOURCES_REMOVED';
|
||||||
|
import ws_send from '../socket';
|
||||||
|
|
||||||
|
export const updateResource = (resource, cb) => dispatch => {
|
||||||
|
dispatch({ type: UPDATE_RESOURCES, resources: [resource] });
|
||||||
|
ws_send("UPDATE_RESOURCE", { resource }, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: More resource actions (delete, etc) through this reducer?
|
||||||
|
|
|
@ -12,13 +12,17 @@ import {
|
||||||
CardBlock,
|
CardBlock,
|
||||||
Progress
|
Progress
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
|
import moment from 'moment';
|
||||||
|
import TorrentOptions from './torrent_options';
|
||||||
import ws_send from '../socket';
|
import ws_send from '../socket';
|
||||||
|
import date from '../date';
|
||||||
import selectTorrent, {
|
import selectTorrent, {
|
||||||
EXCLUSIVE,
|
EXCLUSIVE,
|
||||||
UNION,
|
UNION,
|
||||||
SUBTRACT,
|
SUBTRACT,
|
||||||
NONE
|
NONE
|
||||||
} from '../actions/selection';
|
} from '../actions/selection';
|
||||||
|
import { updateResource } from '../actions/resources';
|
||||||
|
|
||||||
function File({ file }) {
|
function File({ file }) {
|
||||||
// TODO: show progress bar
|
// TODO: show progress bar
|
||||||
|
@ -138,12 +142,27 @@ class Torrent extends Component {
|
||||||
/>
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
<Collapse isOpen={this.state.infoShown}>
|
<Collapse isOpen={this.state.infoShown}>
|
||||||
<dl>
|
<Card>
|
||||||
<dt>Downloading to</dt>
|
<CardBlock>
|
||||||
<dd>{torrent.path}</dd>
|
<dl>
|
||||||
<dt>Created</dt>
|
<dt>Downloading to</dt>
|
||||||
<dd>{torrent.created}</dd>
|
<dd>{torrent.path}</dd>
|
||||||
</dl>
|
<dt>Created</dt>
|
||||||
|
<dd>{date(moment(torrent.created))}</dd>
|
||||||
|
</dl>
|
||||||
|
<TorrentOptions
|
||||||
|
priority={torrent.priority}
|
||||||
|
priorityChanged={priority =>
|
||||||
|
dispatch(updateResource({ id: torrent.id, priority }))}
|
||||||
|
downloadThrottle={torrent.throttle_down}
|
||||||
|
downloadThrottleChanged={throttle_down =>
|
||||||
|
dispatch(updateResource({ id: torrent.id, throttle_down }))}
|
||||||
|
uploadThrottle={torrent.throttle_up}
|
||||||
|
uploadThrottleChanged={throttle_up =>
|
||||||
|
dispatch(updateResource({ id: torrent.id, throttle_up }))}
|
||||||
|
/>
|
||||||
|
</CardBlock>
|
||||||
|
</Card>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
<Collapse isOpen={this.state.filesShown}>
|
<Collapse isOpen={this.state.filesShown}>
|
||||||
<Card style={{marginBottom: "1rem"}}>
|
<Card style={{marginBottom: "1rem"}}>
|
||||||
|
|
|
@ -112,7 +112,7 @@ export default class TorrentOptions extends Component {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{typeof start !== undefined &&
|
{typeof start !== "undefined" &&
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Label for="start-immediately" check style={{paddingLeft: 0}}>
|
<Label for="start-immediately" check style={{paddingLeft: 0}}>
|
||||||
<input
|
<input
|
||||||
|
|
Loading…
Reference in New Issue
Block a user