mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 05:37:20 +01:00
Enable search for metrics.
This commit is contained in:
parent
bbd7c4b6ea
commit
b0bfd0b5ab
7 changed files with 74 additions and 30 deletions
|
|
@ -68,6 +68,8 @@ export function MetricsTable({
|
|||
country,
|
||||
region,
|
||||
city,
|
||||
limit,
|
||||
search,
|
||||
},
|
||||
{ retryDelay: delay || DEFAULT_ANIMATION_DURATION, onDataLoad },
|
||||
);
|
||||
|
|
@ -86,20 +88,8 @@ export function MetricsTable({
|
|||
}
|
||||
}
|
||||
|
||||
if (search) {
|
||||
items = items.filter(({ x, ...data }) => {
|
||||
const value = formatValue(x, type, data);
|
||||
|
||||
return value?.toLowerCase().includes(search.toLowerCase());
|
||||
});
|
||||
}
|
||||
|
||||
items = percentFilter(items);
|
||||
|
||||
if (limit) {
|
||||
items = items.slice(0, limit - 1);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
return [];
|
||||
|
|
@ -114,6 +104,7 @@ export function MetricsTable({
|
|||
className={styles.search}
|
||||
value={search}
|
||||
onSearch={setSearch}
|
||||
delay={300}
|
||||
autoFocus={true}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue