New: Collection Column/Filter Movie Index

This commit is contained in:
Qstick
2019-11-03 00:11:03 -04:00
parent 1c91c9939f
commit f2fffe5304
7 changed files with 90 additions and 19 deletions

View File

@@ -110,6 +110,13 @@ export const filterPredicates = {
return dateFilterPredicate(item.added, filterValue, type);
},
collection: function(item, filterValue, type) {
const predicate = filterTypePredicates[type];
const { collection } = item;
return predicate(collection ? collection.name : '', filterValue);
},
inCinemas: function(item, filterValue, type) {
return dateFilterPredicate(item.inCinemas, filterValue, type);
},

View File

@@ -78,6 +78,12 @@ export const defaultState = {
isVisible: true,
isModifiable: false
},
{
name: 'collection',
label: 'Collection',
isSortable: true,
isVisible: false
},
{
name: 'studio',
label: 'Studio',
@@ -173,6 +179,12 @@ export const defaultState = {
return studio ? studio.toLowerCase() : '';
},
collection: function(item) {
const { collection ={} } = item;
return collection.name;
},
ratings: function(item) {
const { ratings = {} } = item;
@@ -215,6 +227,25 @@ export const defaultState = {
return tagList.sort(sortByName);
}
},
{
name: 'collection',
label: 'Collection',
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const collectionList = items.reduce((acc, movie) => {
if (movie.collection) {
acc.push({
id: movie.collection.name,
name: movie.collection.name
});
}
return acc;
}, []);
return collectionList.sort(sortByName);
}
},
{
name: 'qualityProfileId',
label: 'Quality Profile',
@@ -255,7 +286,7 @@ export const defaultState = {
label: 'Genres',
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const tagList = items.reduce((acc, movie) => {
const genreList = items.reduce((acc, movie) => {
movie.genres.forEach((genre) => {
acc.push({
id: genre,
@@ -266,7 +297,7 @@ export const defaultState = {
return acc;
}, []);
return tagList.sort(sortByName);
return genreList.sort(sortByName);
}
},
{