mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-31 12:10:19 -07:00
Fix Interactive Import, Add Track Actions and Reducers
This commit is contained in:
parent
8f45fe0afe
commit
90d9741056
13 changed files with 193 additions and 27 deletions
70
frontend/src/Store/Reducers/trackReducers.js
Normal file
70
frontend/src/Store/Reducers/trackReducers.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
import { handleActions } from 'redux-actions';
|
||||
import * as types from 'Store/Actions/actionTypes';
|
||||
import { sortDirections } from 'Helpers/Props';
|
||||
import createSetReducer from './Creators/createSetReducer';
|
||||
import createSetTableOptionReducer from './Creators/createSetTableOptionReducer';
|
||||
import createUpdateReducer from './Creators/createUpdateReducer';
|
||||
import createUpdateItemReducer from './Creators/createUpdateItemReducer';
|
||||
import createSetClientSideCollectionSortReducer from './Creators/createSetClientSideCollectionSortReducer';
|
||||
|
||||
export const defaultState = {
|
||||
isFetching: false,
|
||||
isPopulated: false,
|
||||
error: null,
|
||||
sortKey: 'trackNumber',
|
||||
sortDirection: sortDirections.DESCENDING,
|
||||
items: [],
|
||||
|
||||
columns: [
|
||||
{
|
||||
name: 'trackNumber',
|
||||
label: 'Track Number',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'title',
|
||||
label: 'Title',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'duration',
|
||||
label: 'Duration',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'actions',
|
||||
columnLabel: 'Actions',
|
||||
isVisible: true,
|
||||
isModifiable: false
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const persistState = [
|
||||
'tracks.columns'
|
||||
];
|
||||
|
||||
const reducerSection = 'tracks';
|
||||
|
||||
const trackReducers = handleActions({
|
||||
|
||||
[types.SET]: createSetReducer(reducerSection),
|
||||
[types.UPDATE]: createUpdateReducer(reducerSection),
|
||||
[types.UPDATE_ITEM]: createUpdateItemReducer(reducerSection),
|
||||
|
||||
[types.SET_TRACKS_TABLE_OPTION]: createSetTableOptionReducer(reducerSection),
|
||||
|
||||
[types.CLEAR_TRACKS]: (state) => {
|
||||
return Object.assign({}, state, {
|
||||
isFetching: false,
|
||||
isPopulated: false,
|
||||
error: null,
|
||||
items: []
|
||||
});
|
||||
},
|
||||
|
||||
[types.SET_TRACKS_SORT]: createSetClientSideCollectionSortReducer(reducerSection)
|
||||
|
||||
}, defaultState);
|
||||
|
||||
export default trackReducers;
|
Loading…
Add table
Add a link
Reference in a new issue