diff --git a/src/actions/resources.js b/src/actions/resources.js index b4afc58..37e346a 100644 --- a/src/actions/resources.js +++ b/src/actions/resources.js @@ -1,2 +1,10 @@ export const UPDATE_RESOURCES = 'UPDATE_RESOURCES'; 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? diff --git a/src/ui/torrent_details.js b/src/ui/torrent_details.js index 27a059c..1c97bf4 100644 --- a/src/ui/torrent_details.js +++ b/src/ui/torrent_details.js @@ -12,13 +12,17 @@ import { CardBlock, Progress } from 'reactstrap'; +import moment from 'moment'; +import TorrentOptions from './torrent_options'; import ws_send from '../socket'; +import date from '../date'; import selectTorrent, { EXCLUSIVE, UNION, SUBTRACT, NONE } from '../actions/selection'; +import { updateResource } from '../actions/resources'; function File({ file }) { // TODO: show progress bar @@ -138,12 +142,27 @@ class Torrent extends Component { /> -
-
Downloading to
-
{torrent.path}
-
Created
-
{torrent.created}
-
+ + +
+
Downloading to
+
{torrent.path}
+
Created
+
{date(moment(torrent.created))}
+
+ + 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 }))} + /> +
+
diff --git a/src/ui/torrent_options.js b/src/ui/torrent_options.js index 99587e3..0722eb7 100644 --- a/src/ui/torrent_options.js +++ b/src/ui/torrent_options.js @@ -112,7 +112,7 @@ export default class TorrentOptions extends Component { } = this.props; return (
- {typeof start !== undefined && + {typeof start !== "undefined" &&