mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Fixed metrics search.
This commit is contained in:
parent
8be95e32ba
commit
43907bd075
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "umami",
|
"name": "umami",
|
||||||
"version": "2.11.3",
|
"version": "2.12.0",
|
||||||
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
|
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
|
||||||
"author": "Umami Software, Inc. <hello@umami.is>",
|
"author": "Umami Software, Inc. <hello@umami.is>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -4,8 +4,7 @@ import { useFilterParams } from '../useFilterParams';
|
|||||||
|
|
||||||
export function useWebsiteMetrics(
|
export function useWebsiteMetrics(
|
||||||
websiteId: string,
|
websiteId: string,
|
||||||
type: string,
|
query: { type: string; limit: number; search: string },
|
||||||
limit: number,
|
|
||||||
options?: Omit<UseQueryOptions & { onDataLoad?: (data: any) => void }, 'queryKey' | 'queryFn'>,
|
options?: Omit<UseQueryOptions & { onDataLoad?: (data: any) => void }, 'queryKey' | 'queryFn'>,
|
||||||
) {
|
) {
|
||||||
const { get, useQuery } = useApi();
|
const { get, useQuery } = useApi();
|
||||||
@ -17,19 +16,17 @@ export function useWebsiteMetrics(
|
|||||||
{
|
{
|
||||||
websiteId,
|
websiteId,
|
||||||
...params,
|
...params,
|
||||||
type,
|
...query,
|
||||||
limit,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const filters = { ...params };
|
const filters = { ...params };
|
||||||
|
|
||||||
filters[type] = undefined;
|
filters[query.type] = undefined;
|
||||||
|
|
||||||
const data = await get(`/websites/${websiteId}/metrics`, {
|
const data = await get(`/websites/${websiteId}/metrics`, {
|
||||||
...filters,
|
...filters,
|
||||||
type,
|
...query,
|
||||||
limit,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
options?.onDataLoad?.(data);
|
options?.onDataLoad?.(data);
|
||||||
|
@ -48,10 +48,14 @@ export function MetricsTable({
|
|||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { dir } = useLocale();
|
const { dir } = useLocale();
|
||||||
|
|
||||||
const { data, isLoading, isFetched, error } = useWebsiteMetrics(websiteId, type, limit, {
|
const { data, isLoading, isFetched, error } = useWebsiteMetrics(
|
||||||
retryDelay: delay || DEFAULT_ANIMATION_DURATION,
|
websiteId,
|
||||||
onDataLoad,
|
{ type, limit, search },
|
||||||
});
|
{
|
||||||
|
retryDelay: delay || DEFAULT_ANIMATION_DURATION,
|
||||||
|
onDataLoad,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const filteredData = useMemo(() => {
|
const filteredData = useMemo(() => {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user