mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
New: UI Updates, Tag manager, More custom filters (#437)
* New: UI Updates, Tag manager, More custom filters * fixup! Fix ScanFixture Unit Tests * Fixed: Sentry Errors from UI don't have release, branch, environment * Changed: Bump Mobile Detect for New Device Detection * Fixed: Build on changes to package.json * fixup! Add MetadataProfile filter option * fixup! Tag Note, Blacklist, Manual Import * fixup: Remove connectSection * fixup: root folder comment
This commit is contained in:
@@ -1,33 +1,50 @@
|
||||
import * as filterTypes from './filterTypes';
|
||||
|
||||
export const ARRAY = 'array';
|
||||
export const DATE = 'date';
|
||||
export const EXACT = 'exact';
|
||||
export const NUMBER = 'number';
|
||||
export const STRING = 'string';
|
||||
|
||||
export const all = [
|
||||
ARRAY,
|
||||
DATE,
|
||||
EXACT,
|
||||
NUMBER,
|
||||
STRING
|
||||
];
|
||||
|
||||
export const possibleFilterTypes = {
|
||||
[ARRAY]: [
|
||||
{ key: filterTypes.CONTAINS, value: 'contains' },
|
||||
{ key: filterTypes.NOT_CONTAINS, value: 'does not contain' }
|
||||
],
|
||||
|
||||
[DATE]: [
|
||||
{ key: filterTypes.LESS_THAN, value: 'is before' },
|
||||
{ key: filterTypes.GREATER_THAN, value: 'is after' },
|
||||
{ key: filterTypes.IN_LAST, value: 'in the last' },
|
||||
{ key: filterTypes.IN_NEXT, value: 'in the next' }
|
||||
],
|
||||
|
||||
[EXACT]: [
|
||||
{ key: filterTypes.EQUAL, value: 'Is' },
|
||||
{ key: filterTypes.NOT_EQUAL, value: 'Is Not' }
|
||||
{ key: filterTypes.EQUAL, value: 'is' },
|
||||
{ key: filterTypes.NOT_EQUAL, value: 'is not' }
|
||||
],
|
||||
|
||||
[NUMBER]: [
|
||||
{ key: filterTypes.EQUAL, value: 'Equal' },
|
||||
{ key: filterTypes.GREATER_THAN, value: 'Greater Than' },
|
||||
{ key: filterTypes.GREATER_THAN_OR_EQUAL, value: 'Greater Than or Equal' },
|
||||
{ key: filterTypes.LESS_THAN, value: 'Less Than' },
|
||||
{ key: filterTypes.LESS_THAN_OR_EQUAL, value: 'Less Than or Equal' },
|
||||
{ key: filterTypes.NOT_EQUAL, value: 'Not Equal' }
|
||||
{ key: filterTypes.EQUAL, value: 'equal' },
|
||||
{ key: filterTypes.GREATER_THAN, value: 'greater than' },
|
||||
{ key: filterTypes.GREATER_THAN_OR_EQUAL, value: 'greater than or equal' },
|
||||
{ key: filterTypes.LESS_THAN, value: 'less than' },
|
||||
{ key: filterTypes.LESS_THAN_OR_EQUAL, value: 'less than or equal' },
|
||||
{ key: filterTypes.NOT_EQUAL, value: 'not equal' }
|
||||
],
|
||||
|
||||
[STRING]: [
|
||||
{ key: filterTypes.CONTAINS, value: 'Contains' },
|
||||
{ key: filterTypes.EQUAL, value: 'Equal' },
|
||||
{ key: filterTypes.NOT_EQUAL, value: 'Not Equal' }
|
||||
{ key: filterTypes.CONTAINS, value: 'contains' },
|
||||
{ key: filterTypes.NOT_CONTAINS, value: 'does not contain' },
|
||||
{ key: filterTypes.EQUAL, value: 'equal' },
|
||||
{ key: filterTypes.NOT_EQUAL, value: 'not equal' }
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
export const BOOL = 'bool';
|
||||
export const DATE = 'date';
|
||||
export const DEFAULT = 'default';
|
||||
export const INDEXER = 'indexer';
|
||||
export const LANGUAGE_PROFILE = 'languageProfile';
|
||||
export const METADATA_PROFILE = 'metadataProfile';
|
||||
export const PROTOCOL = 'protocol';
|
||||
export const QUALITY = 'quality';
|
||||
export const QUALITY_PROFILE = 'qualityProfile';
|
||||
export const ARTIST_STATUS = 'artistStatus';
|
||||
export const TAG = 'tag';
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import * as filterTypes from './filterTypes';
|
||||
|
||||
const filterTypePredicates = {
|
||||
[filterTypes.CONTAINS]: function(itemValue, filterValue) {
|
||||
if (Array.isArray(itemValue)) {
|
||||
return itemValue.some((v) => v === filterValue);
|
||||
}
|
||||
|
||||
return itemValue.toLowerCase().contains(filterValue.toLowerCase());
|
||||
},
|
||||
|
||||
[filterTypes.EQUAL]: function(itemValue, filterValue) {
|
||||
return itemValue === filterValue;
|
||||
},
|
||||
|
||||
[filterTypes.GREATER_THAN]: function(itemValue, filterValue) {
|
||||
return itemValue > filterValue;
|
||||
},
|
||||
|
||||
[filterTypes.GREATER_THAN_OR_EQUAL]: function(itemValue, filterValue) {
|
||||
return itemValue >= filterValue;
|
||||
},
|
||||
|
||||
[filterTypes.LESS_THAN]: function(itemValue, filterValue) {
|
||||
return itemValue < filterValue;
|
||||
},
|
||||
|
||||
[filterTypes.LESS_THAN_OR_EQUAL]: function(itemValue, filterValue) {
|
||||
return itemValue <= filterValue;
|
||||
},
|
||||
|
||||
[filterTypes.NOT_CONTAINS]: function(itemValue, filterValue) {
|
||||
if (Array.isArray(itemValue)) {
|
||||
return !itemValue.some((v) => v === filterValue);
|
||||
}
|
||||
|
||||
return !itemValue.toLowerCase().contains(filterValue.toLowerCase());
|
||||
},
|
||||
|
||||
[filterTypes.NOT_EQUAL]: function(itemValue, filterValue) {
|
||||
return itemValue !== filterValue;
|
||||
}
|
||||
};
|
||||
|
||||
export default filterTypePredicates;
|
||||
@@ -2,8 +2,11 @@ export const CONTAINS = 'contains';
|
||||
export const EQUAL = 'equal';
|
||||
export const GREATER_THAN = 'greaterThan';
|
||||
export const GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';
|
||||
export const IN_LAST = 'inLast';
|
||||
export const IN_NEXT = 'inNext';
|
||||
export const LESS_THAN = 'lessThan';
|
||||
export const LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
|
||||
export const NOT_CONTAINS = 'notContains';
|
||||
export const NOT_EQUAL = 'notEqual';
|
||||
|
||||
export const all = [
|
||||
@@ -13,5 +16,6 @@ export const all = [
|
||||
GREATER_THAN_OR_EQUAL,
|
||||
LESS_THAN,
|
||||
LESS_THAN_OR_EQUAL,
|
||||
NOT_CONTAINS,
|
||||
NOT_EQUAL
|
||||
];
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as align from './align';
|
||||
import * as inputTypes from './inputTypes';
|
||||
import * as filterBuilderTypes from './filterBuilderTypes';
|
||||
import * as filterBuilderValueTypes from './filterBuilderValueTypes';
|
||||
import filterTypePredicates from './filterTypePredicates';
|
||||
import * as filterTypes from './filterTypes';
|
||||
import * as icons from './icons';
|
||||
import * as kinds from './kinds';
|
||||
@@ -16,6 +17,7 @@ export {
|
||||
inputTypes,
|
||||
filterBuilderTypes,
|
||||
filterBuilderValueTypes,
|
||||
filterTypePredicates,
|
||||
filterTypes,
|
||||
icons,
|
||||
kinds,
|
||||
|
||||
Reference in New Issue
Block a user