Option to ignore items when removing from queue instead of removing from client

This commit is contained in:
Mark McDowall
2019-10-24 21:42:41 +01:00
committed by ta264
parent 94ac75c6b7
commit d459a36591
21 changed files with 277 additions and 65 deletions
@@ -21,13 +21,29 @@ class RemoveQueueItemsModal extends Component {
super(props, context);
this.state = {
remove: true,
blacklist: false,
skipredownload: false
};
}
//
// Listeners
// Control
resetState = function() {
this.setState({
remove: true,
blacklist: false,
skipredownload: false
});
}
//
// Listeners
onRemoveChange = ({ value }) => {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
@@ -37,22 +53,15 @@ class RemoveQueueItemsModal extends Component {
this.setState({ skipredownload: value });
}
onRemoveQueueItemConfirmed = () => {
const blacklist = this.state.blacklist;
const skipredownload = this.state.skipredownload;
onRemoveConfirmed = () => {
const state = this.state;
this.setState({
blacklist: false,
skipredownload: false
});
this.props.onRemovePress(blacklist, skipredownload);
this.resetState();
this.props.onRemovePress(state);
}
onModalClose = () => {
this.setState({
blacklist: false,
skipredownload: false
});
this.resetState();
this.props.onModalClose();
}
@@ -62,11 +71,11 @@ class RemoveQueueItemsModal extends Component {
render() {
const {
isOpen,
selectedCount
selectedCount,
canIgnore
} = this.props;
const blacklist = this.state.blacklist;
const skipredownload = this.state.skipredownload;
const { remove, blacklist, skipredownload } = this.state;
return (
<Modal
@@ -87,7 +96,23 @@ class RemoveQueueItemsModal extends Component {
</div>
<FormGroup>
<FormLabel>Blacklist Release</FormLabel>
<FormLabel>Remove From Download Client</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="remove"
value={remove}
helpTextWarning="Removing will remove the download and the file(s) from the download client."
isDisabled={!canIgnore}
onChange={this.onRemoveChange}
/>
</FormGroup>
<FormGroup>
<FormLabel>
Blacklist Release{selectedCount > 1 ? 's' : ''}
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
@@ -120,7 +145,7 @@ class RemoveQueueItemsModal extends Component {
<Button
kind={kinds.DANGER}
onPress={this.onRemoveQueueItemConfirmed}
onPress={this.onRemoveConfirmed}
>
Remove
</Button>
@@ -134,6 +159,7 @@ class RemoveQueueItemsModal extends Component {
RemoveQueueItemsModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
selectedCount: PropTypes.number.isRequired,
canIgnore: PropTypes.bool.isRequired,
onRemovePress: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired
};