fix(ui): filter check for key and type (#1782)

This commit is contained in:
Shekar Siri 2023-12-15 20:07:33 +01:00 committed by GitHub
parent 3ae4983154
commit 0905726474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -146,7 +146,9 @@ function FilterAutoComplete(props: Props) {
const loadOptions = (inputValue: string, callback: (options: []) => void) => {
// remove underscore from params
const _params = Object.keys(params).reduce((acc: any, key: string) => {
acc[key] = params[key].replace(/^_/, '');
if (key === 'type' && params[key] === 'metadata') {
acc[key] = params[key].replace(/^_/, '');
}
return acc;
}, {});

View file

@ -642,7 +642,8 @@ export const addElementToLiveFiltersMap = (
icon = 'filters/metadata'
) => {
liveFiltersMap[key] = {
key, type, category, label: capitalize(key),
key, type, category,
label: key.replace(/^_/, '').charAt(0).toUpperCase() + key.slice(2),
operator: operator,
operatorOptions,
icon,