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
45 changed files with 1295 additions and 371 deletions
@@ -1,8 +1,9 @@
import _ from 'lodash';
import $ from 'jquery';
import { batchActions } from 'redux-batched-actions';
import createAjaxRequest from 'Utilities/createAjaxRequest';
import getProviderState from 'Utilities/State/getProviderState';
import { set, updateItem } from '../baseActions';
import { set, updateItem, removeItem } from '../baseActions';
const abortCurrentRequests = {};
@@ -15,7 +16,7 @@ export function createCancelSaveProviderHandler(section) {
};
}
function createSaveProviderHandler(section, url, options = {}) {
function createSaveProviderHandler(section, url, options = {}, removeStale = false) {
return function(getState, payload, dispatch) {
dispatch(set({ section, isSaving: true }));
@@ -50,8 +51,13 @@ function createSaveProviderHandler(section, url, options = {}) {
if (!Array.isArray(data)) {
data = [data];
}
const toRemove = removeStale && Array.isArray(id) ? _.difference(id, _.map(data, 'id')) : [];
dispatch(batchActions(
data.map((item) => updateItem({ section, ...item })).concat(
toRemove.map((item) => removeItem({ section, id: item }))
).concat(
set({
section,
isSaving: false,