This commit is contained in:
Shekar Siri 2025-06-08 07:53:26 +00:00 committed by GitHub
commit 15c4da0a7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View file

@ -1,12 +1,13 @@
import { FilterCategory, FilterKey, FilterType } from 'Types/filter/filterType'; import { FilterCategory, FilterKey, FilterType } from 'Types/filter/filterType';
import { import {
conditionalFiltersMap, conditionalFiltersMap,
filtersMap, filtersMap, getMetadataLabel,
mobileConditionalFiltersMap, mobileConditionalFiltersMap
} from 'Types/filter/newFilter'; } from 'Types/filter/newFilter';
import { makeAutoObservable } from 'mobx'; import { makeAutoObservable } from 'mobx';
import { pageUrlOperators } from '../../constants/filterOptions'; import { pageUrlOperators } from '../../constants/filterOptions';
import filterOptions from '@/constants/filterOptions';
export default class FilterItem { export default class FilterItem {
type: string = ''; type: string = '';
@ -122,6 +123,20 @@ export default class FilterItem {
// @ts-ignore // @ts-ignore
_filter = subFilterMap[json.type]; _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.type = _filter.type;
this.key = _filter.key; this.key = _filter.key;
this.label = _filter.label; this.label = _filter.label;

View file

@ -1091,7 +1091,7 @@ export const addOptionsToFilter = (key, options) => {
} }
}; };
function getMetadataLabel(key) { export function getMetadataLabel(key) {
return key.replace(/^_/, '').charAt(0).toUpperCase() + key.slice(2); return key.replace(/^_/, '').charAt(0).toUpperCase() + key.slice(2);
} }