mirror of
https://github.com/Readarr/Readarr
synced 2025-12-15 04:46:13 +01:00
New: Add book custom filters for author and automatic release switching
Fixes #1355
This commit is contained in:
parent
15dee29057
commit
8f965a7cd5
1 changed files with 34 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { createAction } from 'redux-actions';
|
||||
import { batchActions } from 'redux-batched-actions';
|
||||
import { filterBuilderTypes, filterBuilderValueTypes, sortDirections } from 'Helpers/Props';
|
||||
import { filterBuilderTypes, filterBuilderValueTypes, filterTypePredicates, sortDirections } from 'Helpers/Props';
|
||||
import { createThunk, handleThunks } from 'Store/thunks';
|
||||
import sortByName from 'Utilities/Array/sortByName';
|
||||
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||
|
|
@ -151,6 +151,10 @@ export const defaultState = {
|
|||
sortPredicates: {
|
||||
...sortPredicates,
|
||||
|
||||
authorName: function(item) {
|
||||
return item.author.sortName;
|
||||
},
|
||||
|
||||
bookFileCount: function(item) {
|
||||
const { statistics = {} } = item;
|
||||
|
||||
|
|
@ -169,16 +173,44 @@ export const defaultState = {
|
|||
filters,
|
||||
|
||||
filterPredicates: {
|
||||
...filterPredicates
|
||||
...filterPredicates,
|
||||
|
||||
author: function(item, filterValue, type) {
|
||||
const predicate = filterTypePredicates[type];
|
||||
|
||||
return predicate(item.author.authorName, filterValue);
|
||||
},
|
||||
|
||||
anyEditionOk: function(item, filterValue, type) {
|
||||
const predicate = filterTypePredicates[type];
|
||||
|
||||
return predicate(item.anyEditionOk, filterValue);
|
||||
}
|
||||
},
|
||||
|
||||
filterBuilderProps: [
|
||||
{
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
type: filterBuilderTypes.STRING
|
||||
},
|
||||
{
|
||||
name: 'title',
|
||||
label: 'Title',
|
||||
type: filterBuilderTypes.STRING
|
||||
},
|
||||
{
|
||||
name: 'monitored',
|
||||
label: 'Monitored',
|
||||
type: filterBuilderTypes.EXACT,
|
||||
valueType: filterBuilderValueTypes.BOOL
|
||||
},
|
||||
{
|
||||
name: 'anyEditionOk',
|
||||
label: 'Automatic Release Switching',
|
||||
type: filterBuilderTypes.EXACT,
|
||||
valueType: filterBuilderValueTypes.BOOL
|
||||
},
|
||||
{
|
||||
name: 'qualityProfileId',
|
||||
label: 'Quality Profile',
|
||||
|
|
|
|||
Loading…
Reference in a new issue