New: Manual import improvements (#683)

* New: Manual import improvements

 - Detect and merge import with files already in library.
 - Allow selection of album release from Manual Import modal.
 - Loading indicator while fetching updated decisions

* Disable release switching if user manually overrode release
This commit is contained in:
ta264 2019-04-04 09:20:47 +01:00 committed by GitHub
parent 61cea37f05
commit 188e0e1040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 1295 additions and 371 deletions

View file

@ -17,6 +17,7 @@ import { set, update } from './baseActions';
export const section = 'interactiveImport';
const albumsSection = `${section}.albums`;
const trackFilesSection = `${section}.trackFiles`;
//
// State
@ -24,6 +25,7 @@ const albumsSection = `${section}.albums`;
export const defaultState = {
isFetching: false,
isPopulated: false,
isSaving: false,
error: null,
items: [],
pendingChanges: {},
@ -54,7 +56,16 @@ export const defaultState = {
isPopulated: false,
error: null,
sortKey: 'albumTitle',
sortDirection: sortDirections.DESCENDING,
sortDirection: sortDirections.ASCENDING,
items: []
},
trackFiles: {
isFetching: false,
isPopulated: false,
error: null,
sortKey: 'relataivePath',
sortDirection: sortDirections.ASCENDING,
items: []
}
};
@ -80,6 +91,9 @@ export const FETCH_INTERACTIVE_IMPORT_ALBUMS = 'FETCH_INTERACTIVE_IMPORT_ALBUMS'
export const SET_INTERACTIVE_IMPORT_ALBUMS_SORT = 'SET_INTERACTIVE_IMPORT_ALBUMS_SORT';
export const CLEAR_INTERACTIVE_IMPORT_ALBUMS = 'CLEAR_INTERACTIVE_IMPORT_ALBUMS';
export const FETCH_INTERACTIVE_IMPORT_TRACKFILES = 'FETCH_INTERACTIVE_IMPORT_TRACKFILES';
export const CLEAR_INTERACTIVE_IMPORT_TRACKFILES = 'CLEAR_INTERACTIVE_IMPORT_TRACKFILES';
//
// Action Creators
@ -96,6 +110,9 @@ export const fetchInteractiveImportAlbums = createThunk(FETCH_INTERACTIVE_IMPORT
export const setInteractiveImportAlbumsSort = createAction(SET_INTERACTIVE_IMPORT_ALBUMS_SORT);
export const clearInteractiveImportAlbums = createAction(CLEAR_INTERACTIVE_IMPORT_ALBUMS);
export const fetchInteractiveImportTrackFiles = createThunk(FETCH_INTERACTIVE_IMPORT_TRACKFILES);
export const clearInteractiveImportTrackFiles = createAction(CLEAR_INTERACTIVE_IMPORT_TRACKFILES);
//
// Action Handlers
export const actionHandlers = handleThunks({
@ -135,9 +152,11 @@ export const actionHandlers = handleThunks({
});
},
[SAVE_INTERACTIVE_IMPORT_ITEM]: createSaveProviderHandler(section, '/manualimport'),
[SAVE_INTERACTIVE_IMPORT_ITEM]: createSaveProviderHandler(section, '/manualimport', {}, true),
[FETCH_INTERACTIVE_IMPORT_ALBUMS]: createFetchHandler('interactiveImport.albums', '/album')
[FETCH_INTERACTIVE_IMPORT_ALBUMS]: createFetchHandler(albumsSection, '/album'),
[FETCH_INTERACTIVE_IMPORT_TRACKFILES]: createFetchHandler(trackFilesSection, '/trackFile')
});
//
@ -205,6 +224,12 @@ export const reducers = createHandleActions({
return updateSectionState(state, albumsSection, {
...defaultState.albums
});
},
[CLEAR_INTERACTIVE_IMPORT_TRACKFILES]: (state) => {
return updateSectionState(state, trackFilesSection, {
...defaultState.trackFiles
});
}
}, defaultState, section);