fix(ui): filter keys conflcit with metadata, path analysis 4 col

This commit is contained in:
Shekar Siri 2023-11-21 19:15:12 +01:00
parent 94e571a4f0
commit f8b0417fb9
4 changed files with 15 additions and 7 deletions

View file

@ -144,8 +144,14 @@ function FilterAutoComplete(props: Props) {
}, [value])
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('_', '');
return acc;
}, {});
new APIClient()
[method?.toLocaleLowerCase()](endpoint, { ...params, q: inputValue })
[method?.toLocaleLowerCase()](endpoint, { ..._params, q: inputValue })
.then((response: any) => {
return response.json();
})

View file

@ -43,9 +43,9 @@ const reducer = (state = initialState, action = {}) => {
case FETCH_LIST_ACTIVE_SUCCESS:
clearMetaFilters();
action.data.forEach((item) => {
addElementToFiltersMap(FilterCategory.METADATA, item.key);
addElementToLiveFiltersMap(FilterCategory.METADATA, item.key);
addElementToFlagConditionsMap(FilterCategory.METADATA, item.key)
addElementToFiltersMap(FilterCategory.METADATA, '_' + item.key);
addElementToLiveFiltersMap(FilterCategory.METADATA, '_' + item.key);
addElementToFlagConditionsMap(FilterCategory.METADATA, '_' + item.key)
});
return state.set('list', List(action.data).map(CustomField))

View file

@ -215,12 +215,13 @@ export default class Widget {
config: {
...this.config,
col:
this.metricType === 'funnel' ||
this.metricType === FUNNEL ||
this.metricOf === FilterKey.ERRORS ||
this.metricOf === FilterKey.SESSIONS ||
this.metricOf === FilterKey.SLOWEST_RESOURCES ||
this.metricOf === FilterKey.MISSING_RESOURCES ||
this.metricOf === FilterKey.PAGES_RESPONSE_TIME_DISTRIBUTION
this.metricOf === FilterKey.PAGES_RESPONSE_TIME_DISTRIBUTION ||
this.metricType === USER_PATH
? 4
: this.metricType === WEB_VITALS
? 1

View file

@ -604,7 +604,8 @@ export const addElementToFiltersMap = (
key,
type,
category,
label: capitalize(key),
// remove _ from key
label: key.replace(/^_/, '').charAt(0).toUpperCase() + key.slice(2),
operator: operator,
operatorOptions,
icon,