Implement {Pause,Resume} all buttons
This commit is contained in:
parent
be9e6a621d
commit
06561f9580
|
@ -7,14 +7,6 @@ export const SUBTRACT = 'SUBTRACT';
|
|||
export const EXCLUSIVE = 'EXCLUSIVE';
|
||||
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) {
|
||||
return (dispatch, getState) => {
|
||||
const previous = new Set(getState().selection);
|
||||
|
|
|
@ -4,6 +4,7 @@ import ReactDOM from 'react-dom';
|
|||
import { Provider } from 'react-redux';
|
||||
import { ConnectedRouter } from 'react-router-redux';
|
||||
import 'preact/devtools';
|
||||
import './polyfills';
|
||||
|
||||
import store, { history } from './store';
|
||||
import scss from '../scss/main.scss';
|
||||
|
|
10
src/polyfills.js
Normal file
10
src/polyfills.js
Normal file
|
@ -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 selectTorrent, { UNION, NONE } from '../actions/selection';
|
||||
|
||||
// TODO: fix navigating directly to torrent pages
|
||||
|
||||
function File({ file }) {
|
||||
// TODO: show progress bar
|
||||
// TODO: edit priority
|
||||
|
@ -168,8 +166,18 @@ class TorrentDetails extends Component {
|
|||
<div>
|
||||
<h3>{selection.length} torrents</h3>
|
||||
<ButtonGroup>
|
||||
<button className="btn btn-default btn-sm">Pause all</button>
|
||||
<button className="btn btn-default btn-sm">Resume all</button>
|
||||
<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
|
||||
isOpen={this.state.removeDropdown}
|
||||
toggle={() => this.setState({ removeDropdown: !this.state.removeDropdown })}
|
||||
|
|
Loading…
Reference in New Issue
Block a user