fix(ui): conditional filters check for meta fields
This commit is contained in:
parent
f535870811
commit
727da3c25e
2 changed files with 18 additions and 3 deletions
|
|
@ -1,12 +1,13 @@
|
|||
import { FilterCategory, FilterKey, FilterType } from 'Types/filter/filterType';
|
||||
import {
|
||||
conditionalFiltersMap,
|
||||
filtersMap,
|
||||
mobileConditionalFiltersMap,
|
||||
filtersMap, getMetadataLabel,
|
||||
mobileConditionalFiltersMap
|
||||
} from 'Types/filter/newFilter';
|
||||
import { action, makeAutoObservable, observable } from 'mobx';
|
||||
|
||||
import { pageUrlOperators } from '../../constants/filterOptions';
|
||||
import filterOptions from '@/constants/filterOptions';
|
||||
|
||||
export default class FilterItem {
|
||||
type: string = '';
|
||||
|
|
@ -103,6 +104,20 @@ export default class FilterItem {
|
|||
// @ts-ignore
|
||||
_filter = subFilterMap[json.type];
|
||||
}
|
||||
|
||||
if (isMetadata && !_filter) {
|
||||
_filter = {
|
||||
key: json.source,
|
||||
type: FilterType.MULTIPLE,
|
||||
category: FilterCategory.METADATA,
|
||||
label: getMetadataLabel(json.source),
|
||||
operator: 'is',
|
||||
operatorOptions: filterOptions.stringConditional,
|
||||
isEvent: false,
|
||||
value: json.value,
|
||||
icon: 'filters/metadata',
|
||||
}
|
||||
}
|
||||
this.type = _filter.type;
|
||||
this.key = _filter.key;
|
||||
this.label = _filter.label;
|
||||
|
|
|
|||
|
|
@ -1032,7 +1032,7 @@ export const addOptionsToFilter = (
|
|||
}
|
||||
};
|
||||
|
||||
function getMetadataLabel(key) {
|
||||
export function getMetadataLabel(key) {
|
||||
return key.replace(/^_/, '').charAt(0).toUpperCase() + key.slice(2);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue