mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-30 03:38:26 -07:00
[UI] Fix Album History Showing for Every Album
This commit is contained in:
parent
6e7299cdf2
commit
9f689c0233
12 changed files with 103 additions and 103 deletions
|
@ -96,9 +96,9 @@ export const UPDATE_EPISODE_FILES = 'UPDATE_EPISODE_FILES';
|
|||
//
|
||||
// Episode History
|
||||
|
||||
export const FETCH_EPISODE_HISTORY = 'FETCH_EPISODE_HISTORY';
|
||||
export const CLEAR_EPISODE_HISTORY = 'CLEAR_EPISODE_HISTORY';
|
||||
export const EPISODE_HISTORY_MARK_AS_FAILED = 'EPISODE_HISTORY_MARK_AS_FAILED';
|
||||
export const FETCH_ALBUM_HISTORY = 'FETCH_ALBUM_HISTORY';
|
||||
export const CLEAR_ALBUM_HISTORY = 'CLEAR_ALBUM_HISTORY';
|
||||
export const ALBUM_HISTORY_MARK_AS_FAILED = 'ALBUM_HISTORY_MARK_AS_FAILED';
|
||||
|
||||
//
|
||||
// Releases
|
||||
|
|
|
@ -3,11 +3,11 @@ import { batchActions } from 'redux-batched-actions';
|
|||
import { sortDirections } from 'Helpers/Props';
|
||||
import * as types from './actionTypes';
|
||||
import { set, update } from './baseActions';
|
||||
import { fetchEpisodeHistory } from './episodeHistoryActions';
|
||||
import { fetchAlbumHistory } from './albumHistoryActions';
|
||||
|
||||
const episodeHistoryActionHandlers = {
|
||||
[types.FETCH_EPISODE_HISTORY]: function(payload) {
|
||||
const section = 'episodeHistory';
|
||||
const albumHistoryActionHandlers = {
|
||||
[types.FETCH_ALBUM_HISTORY]: function(payload) {
|
||||
const section = 'albumHistory';
|
||||
|
||||
return function(dispatch, getState) {
|
||||
dispatch(set({ section, isFetching: true }));
|
||||
|
@ -15,8 +15,8 @@ const episodeHistoryActionHandlers = {
|
|||
const queryParams = {
|
||||
pageSize: 1000,
|
||||
page: 1,
|
||||
filterKey: 'episodeId',
|
||||
filterValue: payload.episodeId,
|
||||
filterKey: 'albumId',
|
||||
filterValue: payload.albumId,
|
||||
sortKey: 'date',
|
||||
sortDirection: sortDirections.DESCENDING
|
||||
};
|
||||
|
@ -50,11 +50,11 @@ const episodeHistoryActionHandlers = {
|
|||
};
|
||||
},
|
||||
|
||||
[types.EPISODE_HISTORY_MARK_AS_FAILED]: function(payload) {
|
||||
[types.ALBUM_HISTORY_MARK_AS_FAILED]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
const {
|
||||
historyId,
|
||||
episodeId
|
||||
albumId
|
||||
} = payload;
|
||||
|
||||
const promise = $.ajax({
|
||||
|
@ -66,10 +66,10 @@ const episodeHistoryActionHandlers = {
|
|||
});
|
||||
|
||||
promise.done(() => {
|
||||
dispatch(fetchEpisodeHistory({ episodeId }));
|
||||
dispatch(fetchAlbumHistory({ albumId }));
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default episodeHistoryActionHandlers;
|
||||
export default albumHistoryActionHandlers;
|
7
frontend/src/Store/Actions/albumHistoryActions.js
Normal file
7
frontend/src/Store/Actions/albumHistoryActions.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import albumHistoryActionHandlers from './albumHistoryActionHandlers';
|
||||
|
||||
export const fetchAlbumHistory = albumHistoryActionHandlers[types.FETCH_ALBUM_HISTORY];
|
||||
export const clearAlbumHistory = createAction(types.CLEAR_ALBUM_HISTORY);
|
||||
export const albumHistoryMarkAsFailed = albumHistoryActionHandlers[types.ALBUM_HISTORY_MARK_AS_FAILED];
|
|
@ -1,7 +0,0 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import episodeHistoryActionHandlers from './episodeHistoryActionHandlers';
|
||||
|
||||
export const fetchEpisodeHistory = episodeHistoryActionHandlers[types.FETCH_EPISODE_HISTORY];
|
||||
export const clearEpisodeHistory = createAction(types.CLEAR_EPISODE_HISTORY);
|
||||
export const episodeHistoryMarkAsFailed = episodeHistoryActionHandlers[types.EPISODE_HISTORY_MARK_AS_FAILED];
|
|
@ -10,17 +10,17 @@ export const defaultState = {
|
|||
items: []
|
||||
};
|
||||
|
||||
const reducerSection = 'episodeHistory';
|
||||
const reducerSection = 'albumHistory';
|
||||
|
||||
const episodeHistoryReducers = handleActions({
|
||||
const albumHistoryReducers = handleActions({
|
||||
|
||||
[types.SET]: createSetReducer(reducerSection),
|
||||
[types.UPDATE]: createUpdateReducer(reducerSection),
|
||||
|
||||
[types.CLEAR_EPISODE_HISTORY]: (state) => {
|
||||
[types.CLEAR_ALBUM_HISTORY]: (state) => {
|
||||
return Object.assign({}, state, defaultState);
|
||||
}
|
||||
|
||||
}, defaultState);
|
||||
|
||||
export default episodeHistoryReducers;
|
||||
export default albumHistoryReducers;
|
|
@ -14,7 +14,7 @@ import queue, { defaultState as defaultQueueState } from './queueReducers';
|
|||
import blacklist, { defaultState as defaultBlacklistState } from './blacklistReducers';
|
||||
import episodes, { defaultState as defaultEpisodesState } from './episodeReducers';
|
||||
import episodeFiles, { defaultState as defaultEpisodeFilesState } from './episodeFileReducers';
|
||||
import episodeHistory, { defaultState as defaultEpisodeHistoryState } from './episodeHistoryReducers';
|
||||
import albumHistory, { defaultState as defaultAlbumHistoryState } from './albumHistoryReducers';
|
||||
import releases, { defaultState as defaultReleasesState } from './releaseReducers';
|
||||
import wanted, { defaultState as defaultWantedState } from './wantedReducers';
|
||||
import settings, { defaultState as defaultSettingsState } from './settingsReducers';
|
||||
|
@ -42,7 +42,7 @@ export const defaultState = {
|
|||
blacklist: defaultBlacklistState,
|
||||
episodes: defaultEpisodesState,
|
||||
episodeFiles: defaultEpisodeFilesState,
|
||||
episodeHistory: defaultEpisodeHistoryState,
|
||||
albumHistory: defaultAlbumHistoryState,
|
||||
releases: defaultReleasesState,
|
||||
wanted: defaultWantedState,
|
||||
settings: defaultSettingsState,
|
||||
|
@ -71,7 +71,7 @@ export default enableBatching(combineReducers({
|
|||
blacklist,
|
||||
episodes,
|
||||
episodeFiles,
|
||||
episodeHistory,
|
||||
albumHistory,
|
||||
releases,
|
||||
wanted,
|
||||
settings,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue