mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
UI Action Handler Changes, Misc Fixes
This commit is contained in:
parent
7825319d89
commit
cd5b658196
193 changed files with 6992 additions and 6341 deletions
|
@ -1,8 +1,111 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import * as types from './actionTypes';
|
||||
import trackActionHandlers from './trackActionHandlers';
|
||||
import { sortDirections } from 'Helpers/Props';
|
||||
import { createThunk, handleThunks } from 'Store/thunks';
|
||||
import createSetClientSideCollectionSortReducer from './Creators/Reducers/createSetClientSideCollectionSortReducer';
|
||||
import createSetTableOptionReducer from './Creators/Reducers/createSetTableOptionReducer';
|
||||
import createFetchHandler from './Creators/createFetchHandler';
|
||||
import createHandleActions from './Creators/createHandleActions';
|
||||
|
||||
export const fetchTracks = trackActionHandlers[types.FETCH_TRACKS];
|
||||
export const setTracksSort = createAction(types.SET_TRACKS_SORT);
|
||||
export const setTracksTableOption = createAction(types.SET_TRACKS_TABLE_OPTION);
|
||||
export const clearTracks = createAction(types.CLEAR_TRACKS);
|
||||
//
|
||||
// Variables
|
||||
|
||||
export const section = 'tracks';
|
||||
|
||||
//
|
||||
// State
|
||||
|
||||
export const defaultState = {
|
||||
isFetching: false,
|
||||
isPopulated: false,
|
||||
error: null,
|
||||
sortKey: 'mediumNumber',
|
||||
sortDirection: sortDirections.DESCENDING,
|
||||
items: [],
|
||||
|
||||
columns: [
|
||||
{
|
||||
name: 'medium',
|
||||
label: 'Medium',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'absoluteTrackNumber',
|
||||
label: 'Track',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'title',
|
||||
label: 'Title',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'duration',
|
||||
label: 'Duration',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'audioInfo',
|
||||
label: 'Audio Info',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
label: 'Status',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'actions',
|
||||
columnLabel: 'Actions',
|
||||
isVisible: true,
|
||||
isModifiable: false
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const persistState = [
|
||||
'tracks.columns'
|
||||
];
|
||||
|
||||
//
|
||||
// Actions Types
|
||||
|
||||
export const FETCH_TRACKS = 'tracks/fetchTracks';
|
||||
export const SET_TRACKS_SORT = 'tracks/setTracksSort';
|
||||
export const SET_TRACKS_TABLE_OPTION = 'tracks/setTracksTableOption';
|
||||
export const CLEAR_TRACKS = 'tracks/clearTracks';
|
||||
|
||||
//
|
||||
// Action Creators
|
||||
|
||||
export const fetchTracks = createThunk(FETCH_TRACKS);
|
||||
export const setTracksSort = createAction(SET_TRACKS_SORT);
|
||||
export const setTracksTableOption = createAction(SET_TRACKS_TABLE_OPTION);
|
||||
export const clearTracks = createAction(CLEAR_TRACKS);
|
||||
|
||||
//
|
||||
// Action Handlers
|
||||
|
||||
export const actionHandlers = handleThunks({
|
||||
[FETCH_TRACKS]: createFetchHandler(section, '/track')
|
||||
|
||||
});
|
||||
|
||||
//
|
||||
// Reducers
|
||||
|
||||
export const reducers = createHandleActions({
|
||||
|
||||
[SET_TRACKS_TABLE_OPTION]: createSetTableOptionReducer(section),
|
||||
|
||||
[FETCH_TRACKS]: (state) => {
|
||||
return Object.assign({}, state, {
|
||||
isFetching: false,
|
||||
isPopulated: false,
|
||||
error: null,
|
||||
items: []
|
||||
});
|
||||
},
|
||||
|
||||
[SET_TRACKS_SORT]: createSetClientSideCollectionSortReducer(section)
|
||||
|
||||
}, defaultState, section);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue