New: Persist search settings in add new series

Closes #4245
This commit is contained in:
Michael Casey 2021-02-07 13:18:47 +10:00 committed by GitHub
parent a1ddcf2b7b
commit fc3bea370f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 28 deletions

View File

@ -30,9 +30,7 @@ class AddNewSeriesModalContent extends Component {
this.state = { this.state = {
seriesType: props.initialSeriesType === seriesTypes.STANDARD ? seriesType: props.initialSeriesType === seriesTypes.STANDARD ?
props.seriesType.value : props.seriesType.value :
props.initialSeriesType, props.initialSeriesType
searchForMissingEpisodes: false,
searchForCutoffUnmetEpisodes: false
}; };
} }
@ -45,14 +43,6 @@ class AddNewSeriesModalContent extends Component {
// //
// Listeners // Listeners
onSearchForMissingEpisodesChange = ({ value }) => {
this.setState({ searchForMissingEpisodes: value });
}
onSearchForCutoffUnmetEpisodesChange = ({ value }) => {
this.setState({ searchForCutoffUnmetEpisodes: value });
}
onQualityProfileIdChange = ({ value }) => { onQualityProfileIdChange = ({ value }) => {
this.props.onInputChange({ name: 'qualityProfileId', value: parseInt(value) }); this.props.onInputChange({ name: 'qualityProfileId', value: parseInt(value) });
} }
@ -63,14 +53,10 @@ class AddNewSeriesModalContent extends Component {
onAddSeriesPress = () => { onAddSeriesPress = () => {
const { const {
searchForMissingEpisodes,
searchForCutoffUnmetEpisodes,
seriesType seriesType
} = this.state; } = this.state;
this.props.onAddSeriesPress( this.props.onAddSeriesPress(
searchForMissingEpisodes,
searchForCutoffUnmetEpisodes,
seriesType seriesType
); );
} }
@ -91,6 +77,8 @@ class AddNewSeriesModalContent extends Component {
languageProfileId, languageProfileId,
seriesType, seriesType,
seasonFolder, seasonFolder,
searchForMissingEpisodes,
searchForCutoffUnmetEpisodes,
folder, folder,
tags, tags,
showLanguageProfile, showLanguageProfile,
@ -101,11 +89,6 @@ class AddNewSeriesModalContent extends Component {
...otherProps ...otherProps
} = this.props; } = this.props;
const {
searchForMissingEpisodes,
searchForCutoffUnmetEpisodes
} = this.state;
return ( return (
<ModalContent onModalClose={onModalClose}> <ModalContent onModalClose={onModalClose}>
<ModalHeader> <ModalHeader>
@ -271,8 +254,8 @@ class AddNewSeriesModalContent extends Component {
containerClassName={styles.searchInputContainer} containerClassName={styles.searchInputContainer}
className={styles.searchInput} className={styles.searchInput}
name="searchForMissingEpisodes" name="searchForMissingEpisodes"
value={searchForMissingEpisodes} onChange={onInputChange}
onChange={this.onSearchForMissingEpisodesChange} {...searchForMissingEpisodes}
/> />
</label> </label>
@ -285,8 +268,8 @@ class AddNewSeriesModalContent extends Component {
containerClassName={styles.searchInputContainer} containerClassName={styles.searchInputContainer}
className={styles.searchInput} className={styles.searchInput}
name="searchForCutoffUnmetEpisodes" name="searchForCutoffUnmetEpisodes"
value={searchForCutoffUnmetEpisodes} onChange={onInputChange}
onChange={this.onSearchForCutoffUnmetEpisodesChange} {...searchForCutoffUnmetEpisodes}
/> />
</label> </label>
</div> </div>
@ -319,6 +302,8 @@ AddNewSeriesModalContent.propTypes = {
languageProfileId: PropTypes.object, languageProfileId: PropTypes.object,
seriesType: PropTypes.object.isRequired, seriesType: PropTypes.object.isRequired,
seasonFolder: PropTypes.object.isRequired, seasonFolder: PropTypes.object.isRequired,
searchForMissingEpisodes: PropTypes.object.isRequired,
searchForCutoffUnmetEpisodes: PropTypes.object.isRequired,
folder: PropTypes.string.isRequired, folder: PropTypes.string.isRequired,
tags: PropTypes.object.isRequired, tags: PropTypes.object.isRequired,
showLanguageProfile: PropTypes.bool.isRequired, showLanguageProfile: PropTypes.bool.isRequired,

View File

@ -55,7 +55,7 @@ class AddNewSeriesModalContentConnector extends Component {
this.props.setAddSeriesDefault({ [name]: value }); this.props.setAddSeriesDefault({ [name]: value });
} }
onAddSeriesPress = (searchForMissingEpisodes, searchForCutoffUnmetEpisodes, seriesType) => { onAddSeriesPress = (seriesType) => {
const { const {
tvdbId, tvdbId,
rootFolderPath, rootFolderPath,
@ -63,6 +63,8 @@ class AddNewSeriesModalContentConnector extends Component {
qualityProfileId, qualityProfileId,
languageProfileId, languageProfileId,
seasonFolder, seasonFolder,
searchForMissingEpisodes,
searchForCutoffUnmetEpisodes,
tags tags
} = this.props; } = this.props;
@ -74,9 +76,9 @@ class AddNewSeriesModalContentConnector extends Component {
languageProfileId: languageProfileId.value, languageProfileId: languageProfileId.value,
seriesType, seriesType,
seasonFolder: seasonFolder.value, seasonFolder: seasonFolder.value,
tags: tags.value, searchForMissingEpisodes: searchForMissingEpisodes.value,
searchForMissingEpisodes, searchForCutoffUnmetEpisodes: searchForCutoffUnmetEpisodes.value,
searchForCutoffUnmetEpisodes tags: tags.value
}); });
} }
@ -102,6 +104,8 @@ AddNewSeriesModalContentConnector.propTypes = {
languageProfileId: PropTypes.object, languageProfileId: PropTypes.object,
seriesType: PropTypes.object.isRequired, seriesType: PropTypes.object.isRequired,
seasonFolder: PropTypes.object.isRequired, seasonFolder: PropTypes.object.isRequired,
searchForMissingEpisodes: PropTypes.object.isRequired,
searchForCutoffUnmetEpisodes: PropTypes.object.isRequired,
tags: PropTypes.object.isRequired, tags: PropTypes.object.isRequired,
onModalClose: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired,
setAddSeriesDefault: PropTypes.func.isRequired, setAddSeriesDefault: PropTypes.func.isRequired,

View File

@ -37,6 +37,8 @@ export const defaultState = {
languageProfileId: 0, languageProfileId: 0,
seriesType: seriesTypes.STANDARD, seriesType: seriesTypes.STANDARD,
seasonFolder: true, seasonFolder: true,
searchForMissingEpisodes: false,
searchForCutoffUnmetEpisodes: false,
tags: [] tags: []
} }
}; };