mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-19 17:32:38 +01:00
New: Additional custom filter predicates for strings
(cherry picked from commit 6082253166b67d59d7907d83c362116d47bcdaeb)
This commit is contained in:
parent
c222a1a434
commit
16fcf0b56b
@ -47,6 +47,10 @@ export const possibleFilterTypes = {
|
|||||||
{ key: filterTypes.CONTAINS, value: 'contains' },
|
{ key: filterTypes.CONTAINS, value: 'contains' },
|
||||||
{ key: filterTypes.NOT_CONTAINS, value: 'does not contain' },
|
{ key: filterTypes.NOT_CONTAINS, value: 'does not contain' },
|
||||||
{ key: filterTypes.EQUAL, value: 'equal' },
|
{ key: filterTypes.EQUAL, value: 'equal' },
|
||||||
{ key: filterTypes.NOT_EQUAL, value: 'not equal' }
|
{ key: filterTypes.NOT_EQUAL, value: 'not equal' },
|
||||||
|
{ key: filterTypes.STARTS_WITH, value: 'starts with' },
|
||||||
|
{ key: filterTypes.NOT_STARTS_WITH, value: 'does not start with' },
|
||||||
|
{ key: filterTypes.ENDS_WITH, value: 'ends with' },
|
||||||
|
{ key: filterTypes.NOT_ENDS_WITH, value: 'does not end with' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@ -39,6 +39,22 @@ const filterTypePredicates = {
|
|||||||
|
|
||||||
[filterTypes.NOT_EQUAL]: function(itemValue, filterValue) {
|
[filterTypes.NOT_EQUAL]: function(itemValue, filterValue) {
|
||||||
return itemValue !== filterValue;
|
return itemValue !== filterValue;
|
||||||
|
},
|
||||||
|
|
||||||
|
[filterTypes.STARTS_WITH]: function(itemValue, filterValue) {
|
||||||
|
return itemValue.toLowerCase().startsWith(filterValue.toLowerCase());
|
||||||
|
},
|
||||||
|
|
||||||
|
[filterTypes.NOT_STARTS_WITH]: function(itemValue, filterValue) {
|
||||||
|
return !itemValue.toLowerCase().startsWith(filterValue.toLowerCase());
|
||||||
|
},
|
||||||
|
|
||||||
|
[filterTypes.ENDS_WITH]: function(itemValue, filterValue) {
|
||||||
|
return itemValue.toLowerCase().endsWith(filterValue.toLowerCase());
|
||||||
|
},
|
||||||
|
|
||||||
|
[filterTypes.NOT_ENDS_WITH]: function(itemValue, filterValue) {
|
||||||
|
return !itemValue.toLowerCase().endsWith(filterValue.toLowerCase());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,6 +10,10 @@ export const LESS_THAN = 'lessThan';
|
|||||||
export const LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
|
export const LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
|
||||||
export const NOT_CONTAINS = 'notContains';
|
export const NOT_CONTAINS = 'notContains';
|
||||||
export const NOT_EQUAL = 'notEqual';
|
export const NOT_EQUAL = 'notEqual';
|
||||||
|
export const STARTS_WITH = 'startsWith';
|
||||||
|
export const NOT_STARTS_WITH = 'notStartsWith';
|
||||||
|
export const ENDS_WITH = 'endsWith';
|
||||||
|
export const NOT_ENDS_WITH = 'notEndsWith';
|
||||||
|
|
||||||
export const all = [
|
export const all = [
|
||||||
CONTAINS,
|
CONTAINS,
|
||||||
@ -23,5 +27,9 @@ export const all = [
|
|||||||
IN_LAST,
|
IN_LAST,
|
||||||
NOT_IN_LAST,
|
NOT_IN_LAST,
|
||||||
IN_NEXT,
|
IN_NEXT,
|
||||||
NOT_IN_NEXT
|
NOT_IN_NEXT,
|
||||||
|
STARTS_WITH,
|
||||||
|
NOT_STARTS_WITH,
|
||||||
|
ENDS_WITH,
|
||||||
|
NOT_ENDS_WITH
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user