Implement {Pause,Resume} all buttons
parent
be9e6a621d
commit
06561f9580
|
@ -7,14 +7,6 @@ export const SUBTRACT = 'SUBTRACT';
|
||||||
export const EXCLUSIVE = 'EXCLUSIVE';
|
export const EXCLUSIVE = 'EXCLUSIVE';
|
||||||
export const NONE = 'NONE';
|
export const NONE = 'NONE';
|
||||||
|
|
||||||
Set.prototype.difference = function(set) {
|
|
||||||
var diff = new Set(this);
|
|
||||||
for (var v of set) {
|
|
||||||
diff.delete(v);
|
|
||||||
}
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function selectTorrent(id, action) {
|
export default function selectTorrent(id, action) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const previous = new Set(getState().selection);
|
const previous = new Set(getState().selection);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { ConnectedRouter } from 'react-router-redux';
|
import { ConnectedRouter } from 'react-router-redux';
|
||||||
import 'preact/devtools';
|
import 'preact/devtools';
|
||||||
|
import './polyfills';
|
||||||
|
|
||||||
import store, { history } from './store';
|
import store, { history } from './store';
|
||||||
import scss from '../scss/main.scss';
|
import scss from '../scss/main.scss';
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Set.prototype.difference = function(set) {
|
||||||
|
var diff = new Set(this);
|
||||||
|
for (var v of set) {
|
||||||
|
diff.delete(v);
|
||||||
|
}
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required by ES6 spec
|
||||||
|
export const _ = null;
|
|
@ -15,8 +15,6 @@ import {
|
||||||
import ws_send from '../socket';
|
import ws_send from '../socket';
|
||||||
import selectTorrent, { UNION, NONE } from '../actions/selection';
|
import selectTorrent, { UNION, NONE } from '../actions/selection';
|
||||||
|
|
||||||
// TODO: fix navigating directly to torrent pages
|
|
||||||
|
|
||||||
function File({ file }) {
|
function File({ file }) {
|
||||||
// TODO: show progress bar
|
// TODO: show progress bar
|
||||||
// TODO: edit priority
|
// TODO: edit priority
|
||||||
|
@ -168,8 +166,18 @@ class TorrentDetails extends Component {
|
||||||
<div>
|
<div>
|
||||||
<h3>{selection.length} torrents</h3>
|
<h3>{selection.length} torrents</h3>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<button className="btn btn-default btn-sm">Pause all</button>
|
<button
|
||||||
<button className="btn btn-default btn-sm">Resume all</button>
|
className="btn btn-default btn-sm"
|
||||||
|
onClick={() => {
|
||||||
|
selection.forEach(id => ws_send("PAUSE_TORRENT", { id }));
|
||||||
|
}}
|
||||||
|
>Pause all</button>
|
||||||
|
<button
|
||||||
|
className="btn btn-default btn-sm"
|
||||||
|
onClick={() => {
|
||||||
|
selection.forEach(id => ws_send("RESUME_TORRENT", { id }));
|
||||||
|
}}
|
||||||
|
>Resume all</button>
|
||||||
<ButtonDropdown
|
<ButtonDropdown
|
||||||
isOpen={this.state.removeDropdown}
|
isOpen={this.state.removeDropdown}
|
||||||
toggle={() => this.setState({ removeDropdown: !this.state.removeDropdown })}
|
toggle={() => this.setState({ removeDropdown: !this.state.removeDropdown })}
|
||||||
|
|
Loading…
Reference in New Issue