mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
Allow multiple filters.
This commit is contained in:
parent
2ce62c1023
commit
b48efef38b
@ -73,16 +73,27 @@ export function MetricsTable({
|
||||
|
||||
const filteredData = useMemo(() => {
|
||||
if (data) {
|
||||
const dataWithoutNullValues = data.filter(val => val.x !== null);
|
||||
let items = percentFilter(
|
||||
dataFilter ? dataFilter(dataWithoutNullValues, filterOptions) : dataWithoutNullValues,
|
||||
);
|
||||
let items;
|
||||
|
||||
if (dataFilter) {
|
||||
if (Array.isArray(dataFilter)) {
|
||||
items = dataFilter.reduce((arr, filter) => {
|
||||
return filter(arr);
|
||||
}, data);
|
||||
} else {
|
||||
items = dataFilter(data);
|
||||
}
|
||||
}
|
||||
|
||||
items = percentFilter(items);
|
||||
|
||||
if (limit) {
|
||||
items = items.filter((e, i) => i < limit);
|
||||
}
|
||||
if (filterOptions?.sort === false) {
|
||||
return items;
|
||||
}
|
||||
|
||||
return items.sort(firstBy('y', -1).thenBy('x'));
|
||||
}
|
||||
return [];
|
||||
|
@ -9,7 +9,7 @@ import styles from './QueryParametersTable.module.css';
|
||||
|
||||
const filters = {
|
||||
[FILTER_RAW]: emptyFilter,
|
||||
[FILTER_COMBINED]: paramFilter,
|
||||
[FILTER_COMBINED]: [emptyFilter, paramFilter],
|
||||
};
|
||||
|
||||
export function QueryParametersTable({ websiteId, showFilters, ...props }) {
|
||||
|
Loading…
Reference in New Issue
Block a user