New: Add + Search on Discovery Bulk Add (#4657)

#4614
pull/4667/head
nitsua 4 years ago committed by GitHub
parent b7a617bc4e
commit c11928ffb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import AvailabilitySelectInput from 'Components/Form/AvailabilitySelectInput';
import CheckInput from 'Components/Form/CheckInput';
import QualityProfileSelectInputConnector from 'Components/Form/QualityProfileSelectInputConnector';
import RootFolderSelectInputConnector from 'Components/Form/RootFolderSelectInputConnector';
import SelectInput from 'Components/Form/SelectInput';
@ -25,7 +26,8 @@ class DiscoverMovieFooter extends Component {
defaultMonitor,
defaultQualityProfileId,
defaultMinimumAvailability,
defaultRootFolderPath
defaultRootFolderPath,
defaultSearchForMovie
} = props;
this.state = {
@ -33,6 +35,7 @@ class DiscoverMovieFooter extends Component {
qualityProfileId: defaultQualityProfileId,
minimumAvailability: defaultMinimumAvailability,
rootFolderPath: defaultRootFolderPath,
searchForMovie: defaultSearchForMovie,
isExcludeMovieModalOpen: false,
destinationRootFolder: null
};
@ -43,14 +46,16 @@ class DiscoverMovieFooter extends Component {
defaultMonitor,
defaultQualityProfileId,
defaultMinimumAvailability,
defaultRootFolderPath
defaultRootFolderPath,
defaultSearchForMovie
} = this.props;
const {
monitor,
qualityProfileId,
minimumAvailability,
rootFolderPath
rootFolderPath,
searchForMovie
} = this.state;
const newState = {};
@ -71,6 +76,10 @@ class DiscoverMovieFooter extends Component {
newState.rootFolderPath = defaultRootFolderPath;
}
if (searchForMovie !== defaultSearchForMovie) {
newState.searchForMovie = defaultSearchForMovie;
}
if (!_.isEmpty(newState)) {
this.setState(newState);
}
@ -79,9 +88,6 @@ class DiscoverMovieFooter extends Component {
//
// Listeners
//
// Listeners
onExcludeSelectedPress = () => {
this.setState({ isExcludeMovieModalOpen: true });
}
@ -95,14 +101,16 @@ class DiscoverMovieFooter extends Component {
monitor,
qualityProfileId,
minimumAvailability,
rootFolderPath
rootFolderPath,
searchForMovie
} = this.state;
const addOptions = {
monitor,
qualityProfileId,
minimumAvailability,
rootFolderPath
rootFolderPath,
searchForMovie
};
this.props.onAddMoviesPress({ addOptions });
@ -125,6 +133,7 @@ class DiscoverMovieFooter extends Component {
qualityProfileId,
minimumAvailability,
rootFolderPath,
searchForMovie,
isExcludeMovieModalOpen
} = this.state;
@ -193,6 +202,20 @@ class DiscoverMovieFooter extends Component {
/>
</div>
<div className={styles.inputContainer}>
<DiscoverMovieFooterLabel
label="Search on Add"
isSaving={isAdding}
/>
<CheckInput
name="searchForMovie"
isDisabled={!selectedCount}
value={searchForMovie}
onChange={onInputChange}
/>
</div>
<div className={styles.buttonContainer}>
<div className={styles.buttonContainerContent}>
<DiscoverMovieFooterLabel
@ -211,7 +234,6 @@ class DiscoverMovieFooter extends Component {
>
{translate('AddMovies')}
</SpinnerButton>
</div>
<SpinnerButton
className={styles.excludeSelectedButton}
@ -225,6 +247,7 @@ class DiscoverMovieFooter extends Component {
</div>
</div>
</div>
</div>
<ExcludeMovieModal
isOpen={isExcludeMovieModalOpen}
@ -245,6 +268,7 @@ DiscoverMovieFooter.propTypes = {
defaultQualityProfileId: PropTypes.number,
defaultMinimumAvailability: PropTypes.string,
defaultRootFolderPath: PropTypes.string,
defaultSearchForMovie: PropTypes.bool,
onInputChange: PropTypes.func.isRequired,
onAddMoviesPress: PropTypes.func.isRequired,
onExcludeMoviesPress: PropTypes.func.isRequired

@ -15,7 +15,8 @@ function createMapStateToProps() {
monitor: defaultMonitor,
qualityProfileId: defaultQualityProfileId,
minimumAvailability: defaultMinimumAvailability,
rootFolderPath: defaultRootFolderPath
rootFolderPath: defaultRootFolderPath,
searchForMovie: defaultSearchForMovie
} = discoverMovie.defaults;
const {
@ -33,7 +34,8 @@ function createMapStateToProps() {
defaultMonitor,
defaultQualityProfileId,
defaultMinimumAvailability,
defaultRootFolderPath
defaultRootFolderPath,
defaultSearchForMovie
};
}
);

@ -45,7 +45,8 @@ export const defaultState = {
monitor: 'true',
qualityProfileId: 0,
minimumAvailability: 'announced',
tags: []
tags: [],
searchForMovie: false
},
posterOptions: {

Loading…
Cancel
Save