mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user