mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
[UI Work] Add Artist, Import Artist, Calendar
This commit is contained in:
parent
a747c5f135
commit
77f1d2e64c
109 changed files with 891 additions and 1082 deletions
|
@ -24,25 +24,25 @@ export const SET_APP_VALUE = 'SET_APP_VALUE';
|
|||
export const SET_IS_SIDEBAR_VISIBLE = 'SET_IS_SIDEBAR_VISIBLE';
|
||||
|
||||
//
|
||||
// Add Series
|
||||
// Add Artist
|
||||
|
||||
export const LOOKUP_SERIES = 'LOOKUP_SERIES';
|
||||
export const ADD_SERIES = 'ADD_SERIES';
|
||||
export const SET_ADD_SERIES_VALUE = 'SET_ADD_SERIES_VALUE';
|
||||
export const CLEAR_ADD_SERIES = 'CLEAR_ADD_SERIES';
|
||||
export const SET_ADD_SERIES_DEFAULT = 'SET_ADD_SERIES_DEFAULT';
|
||||
export const LOOKUP_ARTIST = 'LOOKUP_ARTIST';
|
||||
export const ADD_ARTIST = 'ADD_ARTIST';
|
||||
export const SET_ADD_ARTIST_VALUE = 'SET_ADD_ARTIST_VALUE';
|
||||
export const CLEAR_ADD_ARTIST = 'CLEAR_ADD_ARTIST';
|
||||
export const SET_ADD_ARTIST_DEFAULT = 'SET_ADD_ARTIST_DEFAULT';
|
||||
|
||||
//
|
||||
// Import Series
|
||||
// Import Artist
|
||||
|
||||
export const QUEUE_LOOKUP_SERIES = 'QUEUE_LOOKUP_SERIES';
|
||||
export const START_LOOKUP_SERIES = 'START_LOOKUP_SERIES';
|
||||
export const CLEAR_IMPORT_SERIES = 'CLEAR_IMPORT_SERIES';
|
||||
export const SET_IMPORT_SERIES_VALUE = 'SET_IMPORT_SERIES_VALUE';
|
||||
export const IMPORT_SERIES = 'IMPORT_SERIES';
|
||||
export const QUEUE_LOOKUP_ARTIST = 'QUEUE_LOOKUP_ARTIST';
|
||||
export const START_LOOKUP_ARTIST = 'START_LOOKUP_ARTIST';
|
||||
export const CLEAR_IMPORT_ARTIST = 'CLEAR_IMPORT_ARTIST';
|
||||
export const SET_IMPORT_ARTIST_VALUE = 'SET_IMPORT_ARTIST_VALUE';
|
||||
export const IMPORT_ARTIST = 'IMPORT_ARTIST';
|
||||
|
||||
//
|
||||
// Series
|
||||
// Artist
|
||||
|
||||
export const FETCH_ARTIST = 'FETCH_ARTIST';
|
||||
export const SET_ARTIST_VALUE = 'SET_ARTIST_VALUE';
|
||||
|
|
|
@ -7,10 +7,10 @@ import { set, update, updateItem } from './baseActions';
|
|||
|
||||
let currentXHR = null;
|
||||
let xhrCancelled = false;
|
||||
const section = 'addSeries';
|
||||
const section = 'addArtist';
|
||||
|
||||
const addSeriesActionHandlers = {
|
||||
[types.LOOKUP_SERIES]: function(payload) {
|
||||
const addArtistActionHandlers = {
|
||||
[types.LOOKUP_ARTIST]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
dispatch(set({ section, isFetching: true }));
|
||||
|
||||
|
@ -55,12 +55,12 @@ const addSeriesActionHandlers = {
|
|||
};
|
||||
},
|
||||
|
||||
[types.ADD_SERIES]: function(payload) {
|
||||
[types.ADD_ARTIST]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
dispatch(set({ section, isAdding: true }));
|
||||
|
||||
const foreignArtistId = payload.foreignArtistId;
|
||||
const items = getState().addSeries.items;
|
||||
const items = getState().addArtist.items;
|
||||
const newSeries = getNewSeries(_.cloneDeep(_.find(items, { foreignArtistId })), payload);
|
||||
|
||||
const promise = $.ajax({
|
||||
|
@ -95,4 +95,4 @@ const addSeriesActionHandlers = {
|
|||
}
|
||||
};
|
||||
|
||||
export default addSeriesActionHandlers;
|
||||
export default addArtistActionHandlers;
|
15
frontend/src/Store/Actions/addArtistActions.js
Normal file
15
frontend/src/Store/Actions/addArtistActions.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import addArtistActionHandlers from './addArtistActionHandlers';
|
||||
|
||||
export const lookupArtist = addArtistActionHandlers[types.LOOKUP_ARTIST];
|
||||
export const addArtist = addArtistActionHandlers[types.ADD_ARTIST];
|
||||
export const clearAddArtist = createAction(types.CLEAR_ADD_ARTIST);
|
||||
export const setAddArtistDefault = createAction(types.SET_ADD_ARTIST_DEFAULT);
|
||||
|
||||
export const setAddArtistValue = createAction(types.SET_ADD_ARTIST_VALUE, (payload) => {
|
||||
return {
|
||||
section: 'addArtist',
|
||||
...payload
|
||||
};
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import addSeriesActionHandlers from './addSeriesActionHandlers';
|
||||
|
||||
export const lookupSeries = addSeriesActionHandlers[types.LOOKUP_SERIES];
|
||||
export const addSeries = addSeriesActionHandlers[types.ADD_SERIES];
|
||||
export const clearAddSeries = createAction(types.CLEAR_ADD_SERIES);
|
||||
export const setAddSeriesDefault = createAction(types.SET_ADD_SERIES_DEFAULT);
|
||||
|
||||
export const setAddSeriesValue = createAction(types.SET_ADD_SERIES_VALUE, (payload) => {
|
||||
return {
|
||||
section: 'addSeries',
|
||||
...payload
|
||||
};
|
||||
});
|
|
@ -4,14 +4,14 @@ import { batchActions } from 'redux-batched-actions';
|
|||
import getNewSeries from 'Utilities/Series/getNewSeries';
|
||||
import * as types from './actionTypes';
|
||||
import { set, updateItem, removeItem } from './baseActions';
|
||||
import { startLookupSeries } from './importSeriesActions';
|
||||
import { startLookupSeries } from './importArtistActions';
|
||||
import { fetchRootFolders } from './rootFolderActions';
|
||||
|
||||
const section = 'importSeries';
|
||||
const section = 'importArtist';
|
||||
let concurrentLookups = 0;
|
||||
|
||||
const importSeriesActionHandlers = {
|
||||
[types.QUEUE_LOOKUP_SERIES]: function(payload) {
|
||||
const importArtistActionHandlers = {
|
||||
[types.QUEUE_LOOKUP_ARTIST]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
const {
|
||||
name,
|
||||
|
@ -19,7 +19,7 @@ const importSeriesActionHandlers = {
|
|||
term
|
||||
} = payload;
|
||||
|
||||
const state = getState().importSeries;
|
||||
const state = getState().importArtist;
|
||||
const item = _.find(state.items, { id: name }) || {
|
||||
id: name,
|
||||
term,
|
||||
|
@ -43,13 +43,13 @@ const importSeriesActionHandlers = {
|
|||
};
|
||||
},
|
||||
|
||||
[types.START_LOOKUP_SERIES]: function(payload) {
|
||||
[types.START_LOOKUP_ARTIST]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
if (concurrentLookups >= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const state = getState().importSeries;
|
||||
const state = getState().importArtist;
|
||||
const queued = _.find(state.items, { queued: true });
|
||||
|
||||
if (!queued) {
|
||||
|
@ -65,7 +65,7 @@ const importSeriesActionHandlers = {
|
|||
}));
|
||||
|
||||
const promise = $.ajax({
|
||||
url: '/series/lookup',
|
||||
url: '/artist/lookup',
|
||||
data: {
|
||||
term: queued.term
|
||||
}
|
||||
|
@ -102,12 +102,12 @@ const importSeriesActionHandlers = {
|
|||
};
|
||||
},
|
||||
|
||||
[types.IMPORT_SERIES]: function(payload) {
|
||||
[types.IMPORT_ARTIST]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
dispatch(set({ section, isImporting: true }));
|
||||
|
||||
const ids = payload.ids;
|
||||
const items = getState().importSeries.items;
|
||||
const items = getState().importArtist.items;
|
||||
const addedIds = [];
|
||||
|
||||
const allNewSeries = ids.reduce((acc, id) => {
|
||||
|
@ -128,7 +128,7 @@ const importSeriesActionHandlers = {
|
|||
}, []);
|
||||
|
||||
const promise = $.ajax({
|
||||
url: '/series/import',
|
||||
url: '/artist/import',
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(allNewSeries)
|
||||
|
@ -169,4 +169,4 @@ const importSeriesActionHandlers = {
|
|||
}
|
||||
};
|
||||
|
||||
export default importSeriesActionHandlers;
|
||||
export default importArtistActionHandlers;
|
16
frontend/src/Store/Actions/importArtistActions.js
Normal file
16
frontend/src/Store/Actions/importArtistActions.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import importArtistActionHandlers from './importArtistActionHandlers';
|
||||
|
||||
export const queueLookupSeries = importArtistActionHandlers[types.QUEUE_LOOKUP_ARTIST];
|
||||
export const startLookupSeries = importArtistActionHandlers[types.START_LOOKUP_ARTIST];
|
||||
export const importArtist = importArtistActionHandlers[types.IMPORT_ARTIST];
|
||||
export const clearImportArtist = createAction(types.CLEAR_IMPORT_ARTIST);
|
||||
|
||||
export const setImportArtistValue = createAction(types.SET_IMPORT_ARTIST_VALUE, (payload) => {
|
||||
return {
|
||||
|
||||
section: 'importArtist',
|
||||
...payload
|
||||
};
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import importSeriesActionHandlers from './importSeriesActionHandlers';
|
||||
|
||||
export const queueLookupSeries = importSeriesActionHandlers[types.QUEUE_LOOKUP_SERIES];
|
||||
export const startLookupSeries = importSeriesActionHandlers[types.START_LOOKUP_SERIES];
|
||||
export const importSeries = importSeriesActionHandlers[types.IMPORT_SERIES];
|
||||
export const clearImportSeries = createAction(types.CLEAR_IMPORT_SERIES);
|
||||
|
||||
export const setImportSeriesValue = createAction(types.SET_IMPORT_SERIES_VALUE, (payload) => {
|
||||
return {
|
||||
|
||||
section: 'importSeries',
|
||||
...payload
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue