mirror of https://github.com/Radarr/Radarr
100 lines
2.4 KiB
JavaScript
100 lines
2.4 KiB
JavaScript
import { createAction } from 'redux-actions';
|
|
import createFetchHandler from 'Store/Actions/Creators/createFetchHandler';
|
|
import createRemoveItemHandler from 'Store/Actions/Creators/createRemoveItemHandler';
|
|
import createSaveProviderHandler from 'Store/Actions/Creators/createSaveProviderHandler';
|
|
import createSetSettingValueReducer from 'Store/Actions/Creators/Reducers/createSetSettingValueReducer';
|
|
import { createThunk } from 'Store/thunks';
|
|
import translate from 'Utilities/String/translate';
|
|
|
|
//
|
|
// Variables
|
|
|
|
const section = 'settings.importExclusions';
|
|
|
|
//
|
|
// Actions Types
|
|
|
|
export const FETCH_IMPORT_EXCLUSIONS = 'settings/importExclusions/fetchImportExclusions';
|
|
export const SAVE_IMPORT_EXCLUSION = 'settings/importExclusions/saveImportExclusion';
|
|
export const DELETE_IMPORT_EXCLUSION = 'settings/importExclusions/deleteImportExclusion';
|
|
export const SET_IMPORT_EXCLUSION_VALUE = 'settings/importExclusions/setImportExclusionValue';
|
|
|
|
//
|
|
// Action Creators
|
|
|
|
export const fetchImportExclusions = createThunk(FETCH_IMPORT_EXCLUSIONS);
|
|
|
|
export const saveImportExclusion = createThunk(SAVE_IMPORT_EXCLUSION);
|
|
export const deleteImportExclusion = createThunk(DELETE_IMPORT_EXCLUSION);
|
|
|
|
export const setImportExclusionValue = createAction(SET_IMPORT_EXCLUSION_VALUE, (payload) => {
|
|
return {
|
|
section,
|
|
...payload
|
|
};
|
|
});
|
|
|
|
//
|
|
// Details
|
|
|
|
export default {
|
|
|
|
//
|
|
// State
|
|
|
|
defaultState: {
|
|
isFetching: false,
|
|
isPopulated: false,
|
|
error: null,
|
|
items: [],
|
|
isSaving: false,
|
|
saveError: null,
|
|
pendingChanges: {},
|
|
|
|
columns: [
|
|
{
|
|
name: 'tmdbId',
|
|
label: 'TmdbId',
|
|
isSortable: true,
|
|
isVisible: true
|
|
},
|
|
{
|
|
name: 'movieTitle',
|
|
label: translate('Title'),
|
|
isSortable: true,
|
|
isVisible: true
|
|
},
|
|
{
|
|
name: 'movieYear',
|
|
label: translate('Year'),
|
|
isSortable: true,
|
|
isVisible: true
|
|
},
|
|
{
|
|
name: 'actions',
|
|
columnLabel: translate('Actions'),
|
|
isVisible: true,
|
|
isModifiable: false
|
|
}
|
|
]
|
|
},
|
|
|
|
//
|
|
// Action Handlers
|
|
|
|
actionHandlers: {
|
|
[FETCH_IMPORT_EXCLUSIONS]: createFetchHandler(section, '/exclusions'),
|
|
|
|
[SAVE_IMPORT_EXCLUSION]: createSaveProviderHandler(section, '/exclusions'),
|
|
[DELETE_IMPORT_EXCLUSION]: createRemoveItemHandler(section, '/exclusions')
|
|
},
|
|
|
|
//
|
|
// Reducers
|
|
|
|
reducers: {
|
|
[SET_IMPORT_EXCLUSION_VALUE]: createSetSettingValueReducer(section)
|
|
}
|
|
|
|
};
|