mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 13:47:15 +01:00
Restore client-side search where needed.
This commit is contained in:
parent
1579beef5b
commit
fe9db71ba8
5 changed files with 15 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ export function CountriesTable({
|
|||
metric={formatMessage(labels.visitors)}
|
||||
renderLabel={renderLink}
|
||||
onDataLoad={handleDataLoad}
|
||||
searchFormattedValues={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export function DevicesTable(props: MetricsTableProps) {
|
|||
type="device"
|
||||
metric={formatMessage(labels.visitors)}
|
||||
renderLabel={renderLink}
|
||||
searchFormattedValues={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export function LanguagesTable({
|
|||
metric={formatMessage(labels.visitors)}
|
||||
onDataLoad={data => onDataLoad?.(percentFilter(data))}
|
||||
renderLabel={renderLabel}
|
||||
searchFormattedValues={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ export interface MetricsTableProps extends ListTableProps {
|
|||
onDataLoad?: (data: any) => void;
|
||||
onSearch?: (search: string) => void;
|
||||
allowSearch?: boolean;
|
||||
searchFormattedValues?: boolean;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
|
|
@ -40,6 +41,7 @@ export function MetricsTable({
|
|||
onDataLoad,
|
||||
delay = null,
|
||||
allowSearch = false,
|
||||
searchFormattedValues = false,
|
||||
children,
|
||||
...props
|
||||
}: MetricsTableProps) {
|
||||
|
|
@ -69,7 +71,7 @@ export function MetricsTable({
|
|||
region,
|
||||
city,
|
||||
limit,
|
||||
search,
|
||||
search: (searchFormattedValues) ? undefined : search,
|
||||
},
|
||||
{ retryDelay: delay || DEFAULT_ANIMATION_DURATION, onDataLoad },
|
||||
);
|
||||
|
|
@ -88,6 +90,14 @@ export function MetricsTable({
|
|||
}
|
||||
}
|
||||
|
||||
if (searchFormattedValues && search) {
|
||||
items = items.filter(({ x, ...data }) => {
|
||||
const value = formatValue(x, type, data);
|
||||
|
||||
return value?.toLowerCase().includes(search.toLowerCase());
|
||||
});
|
||||
}
|
||||
|
||||
items = percentFilter(items);
|
||||
|
||||
return items;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export function RegionsTable(props: MetricsTableProps) {
|
|||
metric={formatMessage(labels.visitors)}
|
||||
dataFilter={emptyFilter}
|
||||
renderLabel={renderLink}
|
||||
searchFormattedValues={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue