diff --git a/frontend/app/mstore/types/filterItem.ts b/frontend/app/mstore/types/filterItem.ts index f8785035d..da7ecea6b 100644 --- a/frontend/app/mstore/types/filterItem.ts +++ b/frontend/app/mstore/types/filterItem.ts @@ -1,12 +1,13 @@ import { FilterCategory, FilterKey, FilterType } from 'Types/filter/filterType'; import { conditionalFiltersMap, - filtersMap, - mobileConditionalFiltersMap, + filtersMap, getMetadataLabel, + mobileConditionalFiltersMap } from 'Types/filter/newFilter'; import { makeAutoObservable } from 'mobx'; import { pageUrlOperators } from '../../constants/filterOptions'; +import filterOptions from '@/constants/filterOptions'; export default class FilterItem { type: string = ''; @@ -122,6 +123,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; diff --git a/frontend/app/types/filter/newFilter.js b/frontend/app/types/filter/newFilter.js index c3adf6189..7226d9a27 100644 --- a/frontend/app/types/filter/newFilter.js +++ b/frontend/app/types/filter/newFilter.js @@ -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); }