diff --git a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooter.js b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooter.js index 8353d9be2..76fe864f8 100644 --- a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooter.js +++ b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooter.js @@ -23,14 +23,18 @@ class ImportArtistFooter extends Component { defaultMonitor, defaultQualityProfileId, defaultLanguageProfileId, - defaultAlbumFolder + defaultAlbumFolder, + defaultPrimaryAlbumTypes, + defaultSecondaryAlbumTypes } = props; this.state = { monitor: defaultMonitor, qualityProfileId: defaultQualityProfileId, languageProfileId: defaultLanguageProfileId, - albumFolder: defaultAlbumFolder + albumFolder: defaultAlbumFolder, + primaryAlbumTypes: defaultPrimaryAlbumTypes, + secondaryAlbumTypes: defaultSecondaryAlbumTypes }; } @@ -40,17 +44,23 @@ class ImportArtistFooter extends Component { defaultQualityProfileId, defaultLanguageProfileId, defaultAlbumFolder, + defaultPrimaryAlbumTypes, + defaultSecondaryAlbumTypes, isMonitorMixed, isQualityProfileIdMixed, isLanguageProfileIdMixed, - isAlbumFolderMixed + isAlbumFolderMixed, + isPrimaryAlbumTypesMixed, + isSecondaryAlbumTypesMixed } = this.props; const { monitor, qualityProfileId, languageProfileId, - albumFolder + albumFolder, + primaryAlbumTypes, + secondaryAlbumTypes } = this.state; const newState = {}; @@ -79,6 +89,18 @@ class ImportArtistFooter extends Component { newState.albumFolder = defaultAlbumFolder; } + if (isPrimaryAlbumTypesMixed && primaryAlbumTypes != null) { + newState.primaryAlbumTypes = null; + } else if (!isPrimaryAlbumTypesMixed && primaryAlbumTypes !== defaultPrimaryAlbumTypes) { + newState.primaryAlbumTypes = defaultPrimaryAlbumTypes; + } + + if (isSecondaryAlbumTypesMixed && secondaryAlbumTypes != null) { + newState.secondaryAlbumTypes = null; + } else if (!isSecondaryAlbumTypesMixed && secondaryAlbumTypes !== defaultSecondaryAlbumTypes) { + newState.secondaryAlbumTypes = defaultSecondaryAlbumTypes; + } + if (!_.isEmpty(newState)) { this.setState(newState); } @@ -111,7 +133,9 @@ class ImportArtistFooter extends Component { monitor, qualityProfileId, languageProfileId, - albumFolder + albumFolder, + primaryAlbumTypes, + secondaryAlbumTypes } = this.state; return ( @@ -221,10 +245,14 @@ ImportArtistFooter.propTypes = { defaultQualityProfileId: PropTypes.number, defaultLanguageProfileId: PropTypes.number, defaultAlbumFolder: PropTypes.bool.isRequired, + defaultPrimaryAlbumTypes: PropTypes.arrayOf(PropTypes.string).isRequired, + defaultSecondaryAlbumTypes: PropTypes.arrayOf(PropTypes.string).isRequired, isMonitorMixed: PropTypes.bool.isRequired, isQualityProfileIdMixed: PropTypes.bool.isRequired, isLanguageProfileIdMixed: PropTypes.bool.isRequired, isAlbumFolderMixed: PropTypes.bool.isRequired, + isPrimaryAlbumTypesMixed: PropTypes.bool.isRequired, + isSecondaryAlbumTypesMixed: PropTypes.bool.isRequired, showLanguageProfile: PropTypes.bool.isRequired, onInputChange: PropTypes.func.isRequired, onImportPress: PropTypes.func.isRequired diff --git a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooterConnector.js b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooterConnector.js index 7b45a4b31..938efd916 100644 --- a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooterConnector.js +++ b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistFooterConnector.js @@ -19,7 +19,9 @@ function createMapStateToProps() { monitor: defaultMonitor, qualityProfileId: defaultQualityProfileId, languageProfileId: defaultLanguageProfileId, - albumFolder: defaultAlbumFolder + albumFolder: defaultAlbumFolder, + primaryAlbumTypes: defaultPrimaryAlbumTypes, + secondaryAlbumTypes: defaultSecondaryAlbumTypes } = addArtist.defaults; const items = importArtist.items; @@ -32,6 +34,8 @@ function createMapStateToProps() { const isQualityProfileIdMixed = isMixed(items, selectedIds, defaultQualityProfileId, 'qualityProfileId'); const isLanguageProfileIdMixed = isMixed(items, selectedIds, defaultLanguageProfileId, 'languageProfileId'); const isAlbumFolderMixed = isMixed(items, selectedIds, defaultAlbumFolder, 'albumFolder'); + const isPrimaryAlbumTypesMixed = isMixed(items, selectedIds, defaultPrimaryAlbumTypes, 'primaryAlbumTypes'); + const isSecondaryAlbumTypesMixed = isMixed(items, selectedIds, defaultSecondaryAlbumTypes, 'secondaryAlbumTypes'); return { selectedCount: selectedIds.length, @@ -41,10 +45,14 @@ function createMapStateToProps() { defaultQualityProfileId, defaultLanguageProfileId, defaultAlbumFolder, + defaultPrimaryAlbumTypes, + defaultSecondaryAlbumTypes, isMonitorMixed, isQualityProfileIdMixed, isLanguageProfileIdMixed, - isAlbumFolderMixed + isAlbumFolderMixed, + isPrimaryAlbumTypesMixed, + isSecondaryAlbumTypesMixed }; } ); diff --git a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTable.js b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTable.js index 120a19dc7..724be157d 100644 --- a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTable.js +++ b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTable.js @@ -23,6 +23,8 @@ class ImportArtistTable extends Component { defaultQualityProfileId, defaultLanguageProfileId, defaultAlbumFolder, + defaultPrimaryAlbumTypes, + defaultSecondaryAlbumTypes, onArtistLookup, onSetImportArtistValue } = this.props; @@ -31,7 +33,9 @@ class ImportArtistTable extends Component { monitor: defaultMonitor, qualityProfileId: defaultQualityProfileId, languageProfileId: defaultLanguageProfileId, - albumFolder: defaultAlbumFolder + albumFolder: defaultAlbumFolder, + primaryAlbumTypes: defaultPrimaryAlbumTypes, + secondaryAlbumTypes: defaultSecondaryAlbumTypes }; unmappedFolders.forEach((unmappedFolder) => { @@ -191,6 +195,8 @@ ImportArtistTable.propTypes = { defaultQualityProfileId: PropTypes.number, defaultLanguageProfileId: PropTypes.number, defaultAlbumFolder: PropTypes.bool.isRequired, + defaultPrimaryAlbumTypes: PropTypes.arrayOf(PropTypes.string).isRequired, + defaultSecondaryAlbumTypes: PropTypes.arrayOf(PropTypes.string).isRequired, allSelected: PropTypes.bool.isRequired, allUnselected: PropTypes.bool.isRequired, selectedState: PropTypes.object.isRequired, diff --git a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTableConnector.js b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTableConnector.js index 950555219..c232db77f 100644 --- a/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTableConnector.js +++ b/frontend/src/AddArtist/ImportArtist/Import/ImportArtistTableConnector.js @@ -16,6 +16,8 @@ function createMapStateToProps() { defaultQualityProfileId: addArtist.defaults.qualityProfileId, defaultLanguageProfileId: addArtist.defaults.languageProfileId, defaultAlbumFolder: addArtist.defaults.albumFolder, + defaultPrimaryAlbumTypes: addArtist.defaults.primaryAlbumTypes, + defaultSecondaryAlbumTypes: addArtist.defaults.secondaryAlbumTypes, items: importArtist.items, isSmallScreen: dimensions.isSmallScreen, allArtists