1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-22 16:02:43 +00:00

New: Language filter on manual search

Fixes #6921
This commit is contained in:
Qstick 2022-03-06 19:26:25 -06:00
parent b1d8763593
commit 2041797587

View file

@ -1,6 +1,7 @@
import { createAction } from 'redux-actions';
import { filterBuilderTypes, filterBuilderValueTypes, filterTypePredicates, filterTypes, sortDirections } from 'Helpers/Props';
import { createThunk, handleThunks } from 'Store/thunks';
import sortByName from 'Utilities/Array/sortByName';
import createAjaxRequest from 'Utilities/createAjaxRequest';
import translate from 'Utilities/String/translate';
import createFetchHandler from './Creators/createFetchHandler';
@ -92,6 +93,14 @@ export const defaultState = {
return false;
},
languages: function(item, filterValue, type) {
const predicate = filterTypePredicates[type];
const languages = item.languages.map((language) => language.name);
return predicate(languages, filterValue);
},
peers: function(item, value, type) {
const predicate = filterTypePredicates[type];
const seeders = item.seeders || 0;
@ -173,6 +182,25 @@ export const defaultState = {
type: filterBuilderTypes.EXACT,
valueType: filterBuilderValueTypes.QUALITY
},
{
name: 'languages',
label: translate('Languages'),
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const genreList = items.reduce((acc, release) => {
release.languages.forEach((language) => {
acc.push({
id: language.name,
name: language.name
});
});
return acc;
}, []);
return genreList.sort(sortByName);
}
},
{
name: 'rejectionCount',
label: translate('RejectionCount'),