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

New: Option to not remove item from download client when removing from queue

Closes #1710
This commit is contained in:
Mark McDowall 2019-08-05 00:25:49 -07:00 committed by Mark McDowall
parent 3916495329
commit c6ea7d7e63
21 changed files with 281 additions and 55 deletions

View file

@ -10,7 +10,6 @@ import ModalContent from 'Components/Modal/ModalContent';
import ModalHeader from 'Components/Modal/ModalHeader';
import ModalBody from 'Components/Modal/ModalBody';
import ModalFooter from 'Components/Modal/ModalFooter';
import styles from './RemoveQueueItemModal.css';
class RemoveQueueItemModal extends Component {
@ -21,26 +20,41 @@ class RemoveQueueItemModal extends Component {
super(props, context);
this.state = {
remove: true,
blacklist: false
};
}
//
// Control
resetState = function() {
this.setState({
remove: true,
blacklist: false
});
}
//
// Listeners
onRemoveChange = ({ value }) => {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
}
onRemoveQueueItemConfirmed = () => {
const blacklist = this.state.blacklist;
onRemoveConfirmed = () => {
const state = this.state;
this.setState({ blacklist: false });
this.props.onRemovePress(blacklist);
this.resetState();
this.props.onRemovePress(state);
}
onModalClose = () => {
this.setState({ blacklist: false });
this.resetState();
this.props.onModalClose();
}
@ -50,10 +64,11 @@ class RemoveQueueItemModal extends Component {
render() {
const {
isOpen,
sourceTitle
sourceTitle,
canIgnore
} = this.props;
const blacklist = this.state.blacklist;
const { remove, blacklist } = this.state;
return (
<Modal
@ -73,17 +88,27 @@ class RemoveQueueItemModal extends Component {
Are you sure you want to remove '{sourceTitle}' from the queue?
</div>
<div className={styles.messageRemove}>
Removing will remove the download and the file(s) from the download client.
</div>
<FormGroup>
<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</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
helpText="Prevents Sonarr from automatically grabbing this release again"
helpText="Starts a search for this episode again and prevents this release from being grabbed again"
onChange={this.onBlacklistChange}
/>
</FormGroup>
@ -97,7 +122,7 @@ class RemoveQueueItemModal extends Component {
<Button
kind={kinds.DANGER}
onPress={this.onRemoveQueueItemConfirmed}
onPress={this.onRemoveConfirmed}
>
Remove
</Button>
@ -111,6 +136,7 @@ class RemoveQueueItemModal extends Component {
RemoveQueueItemModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
sourceTitle: PropTypes.string.isRequired,
canIgnore: PropTypes.bool.isRequired,
onRemovePress: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired
};