mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Movie Certifications
This commit is contained in:
64
frontend/src/Store/Actions/Settings/metadataOptions.js
Normal file
64
frontend/src/Store/Actions/Settings/metadataOptions.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import { createAction } from 'redux-actions';
|
||||
import { createThunk } from 'Store/thunks';
|
||||
import createSetSettingValueReducer from 'Store/Actions/Creators/Reducers/createSetSettingValueReducer';
|
||||
import createFetchHandler from 'Store/Actions/Creators/createFetchHandler';
|
||||
import createSaveHandler from 'Store/Actions/Creators/createSaveHandler';
|
||||
|
||||
//
|
||||
// Variables
|
||||
|
||||
const section = 'settings.metadataOptions';
|
||||
|
||||
//
|
||||
// Actions Types
|
||||
|
||||
export const FETCH_METADATA_OPTIONS = 'settings/metadataOptions/fetchMetadataOptions';
|
||||
export const SAVE_METADATA_OPTIONS = 'settings/metadataOptions/saveMetadataOptions';
|
||||
export const SET_METADATA_OPTIONS_VALUE = 'settings/metadataOptions/setMetadataOptionsValue';
|
||||
|
||||
//
|
||||
// Action Creators
|
||||
|
||||
export const fetchMetadataOptions = createThunk(FETCH_METADATA_OPTIONS);
|
||||
export const saveMetadataOptions = createThunk(SAVE_METADATA_OPTIONS);
|
||||
export const setMetadataOptionsValue = createAction(SET_METADATA_OPTIONS_VALUE, (payload) => {
|
||||
return {
|
||||
section,
|
||||
...payload
|
||||
};
|
||||
});
|
||||
|
||||
//
|
||||
// Details
|
||||
|
||||
export default {
|
||||
|
||||
//
|
||||
// State
|
||||
|
||||
defaultState: {
|
||||
isFetching: false,
|
||||
isPopulated: false,
|
||||
error: null,
|
||||
pendingChanges: {},
|
||||
isSaving: false,
|
||||
saveError: null,
|
||||
item: {}
|
||||
},
|
||||
|
||||
//
|
||||
// Action Handlers
|
||||
|
||||
actionHandlers: {
|
||||
[FETCH_METADATA_OPTIONS]: createFetchHandler(section, '/config/metadata'),
|
||||
[SAVE_METADATA_OPTIONS]: createSaveHandler(section, '/config/metadata')
|
||||
},
|
||||
|
||||
//
|
||||
// Reducers
|
||||
|
||||
reducers: {
|
||||
[SET_METADATA_OPTIONS_VALUE]: createSetSettingValueReducer(section)
|
||||
}
|
||||
|
||||
};
|
@@ -158,7 +158,7 @@ export const defaultState = {
|
||||
{
|
||||
name: 'certification',
|
||||
label: 'Certification',
|
||||
isSortable: false,
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
@@ -320,7 +320,21 @@ export const defaultState = {
|
||||
{
|
||||
name: 'certification',
|
||||
label: 'Certification',
|
||||
type: filterBuilderTypes.EXACT
|
||||
type: filterBuilderTypes.EXACT,
|
||||
optionsSelector: function(items) {
|
||||
const certificationList = items.reduce((acc, movie) => {
|
||||
if (movie.certification) {
|
||||
acc.push({
|
||||
id: movie.certification,
|
||||
name: movie.certification
|
||||
});
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
return certificationList.sort(sortByName);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
|
@@ -15,6 +15,7 @@ import netImportOptions from './Settings/netImportOptions';
|
||||
import netImports from './Settings/netImports';
|
||||
import mediaManagement from './Settings/mediaManagement';
|
||||
import metadata from './Settings/metadata';
|
||||
import metadataOptions from './Settings/metadataOptions';
|
||||
import naming from './Settings/naming';
|
||||
import namingExamples from './Settings/namingExamples';
|
||||
import notifications from './Settings/notifications';
|
||||
@@ -38,6 +39,7 @@ export * from './Settings/netImportOptions';
|
||||
export * from './Settings/netImports';
|
||||
export * from './Settings/mediaManagement';
|
||||
export * from './Settings/metadata';
|
||||
export * from './Settings/metadataOptions';
|
||||
export * from './Settings/naming';
|
||||
export * from './Settings/namingExamples';
|
||||
export * from './Settings/notifications';
|
||||
@@ -72,6 +74,7 @@ export const defaultState = {
|
||||
netImports: netImports.defaultState,
|
||||
mediaManagement: mediaManagement.defaultState,
|
||||
metadata: metadata.defaultState,
|
||||
metadataOptions: metadataOptions.defaultState,
|
||||
naming: naming.defaultState,
|
||||
namingExamples: namingExamples.defaultState,
|
||||
notifications: notifications.defaultState,
|
||||
@@ -114,6 +117,7 @@ export const actionHandlers = handleThunks({
|
||||
...netImports.actionHandlers,
|
||||
...mediaManagement.actionHandlers,
|
||||
...metadata.actionHandlers,
|
||||
...metadataOptions.actionHandlers,
|
||||
...naming.actionHandlers,
|
||||
...namingExamples.actionHandlers,
|
||||
...notifications.actionHandlers,
|
||||
@@ -147,6 +151,7 @@ export const reducers = createHandleActions({
|
||||
...netImports.reducers,
|
||||
...mediaManagement.reducers,
|
||||
...metadata.reducers,
|
||||
...metadataOptions.reducers,
|
||||
...naming.reducers,
|
||||
...namingExamples.reducers,
|
||||
...notifications.reducers,
|
||||
|
Reference in New Issue
Block a user