New: Don't require artist mapping

This commit is contained in:
ta264 2020-02-09 19:15:43 +00:00 committed by Qstick
parent 1cc434a498
commit be4e748977
159 changed files with 2934 additions and 4208 deletions

View file

@ -69,7 +69,8 @@ class UnmappedFilesTable extends Component {
sortDirection,
onTableOptionChange,
onSortPress,
deleteUnmappedFile,
isScanningFolders,
onAddMissingArtistsPress,
...otherProps
} = this.props;
@ -80,6 +81,16 @@ class UnmappedFilesTable extends Component {
return (
<PageContent title="UnmappedFiles">
<PageToolbar>
<PageToolbarSection>
<PageToolbarButton
label="Add missing"
iconName={icons.ADD_MISSING_ARTISTS}
isDisabled={isPopulated && !error && !items.length}
isSpinning={isScanningFolders}
onPress={onAddMissingArtistsPress}
/>
</PageToolbarSection>
<PageToolbarSection alignContent={align.RIGHT}>
<TableOptionsModalWrapper
{...otherProps}
@ -148,7 +159,9 @@ UnmappedFilesTable.propTypes = {
sortDirection: PropTypes.oneOf(sortDirections.all),
onTableOptionChange: PropTypes.func.isRequired,
onSortPress: PropTypes.func.isRequired,
deleteUnmappedFile: PropTypes.func.isRequired
deleteUnmappedFile: PropTypes.func.isRequired,
isScanningFolders: PropTypes.bool.isRequired,
onAddMissingArtistsPress: PropTypes.func.isRequired
};
export default UnmappedFilesTable;

View file

@ -5,17 +5,22 @@ import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
import { fetchTrackFiles, deleteTrackFile, setTrackFilesSort, setTrackFilesTableOption } from 'Store/Actions/trackFileActions';
import { executeCommand } from 'Store/Actions/commandActions';
import * as commandNames from 'Commands/commandNames';
import withCurrentPage from 'Components/withCurrentPage';
import UnmappedFilesTable from './UnmappedFilesTable';
function createMapStateToProps() {
return createSelector(
createClientSideCollectionSelector('trackFiles'),
createCommandExecutingSelector(commandNames.RESCAN_FOLDERS),
createDimensionsSelector(),
(
trackFiles,
isScanningFolders,
dimensionsState
) => {
// trackFiles could pick up mapped entries via signalR so filter again here
@ -27,6 +32,7 @@ function createMapStateToProps() {
return {
items: unmappedFiles,
...otherProps,
isScanningFolders,
isSmallScreen: dimensionsState.isSmallScreen
};
}
@ -49,6 +55,13 @@ function createMapDispatchToProps(dispatch, props) {
deleteUnmappedFile(id) {
dispatch(deleteTrackFile({ id }));
},
onAddMissingArtistsPress() {
dispatch(executeCommand({
name: commandNames.RESCAN_FOLDERS,
filter: 'matched'
}));
}
};
}