Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fixed metrics search.

Mike Cao43907bd07554
diff --git a/package.json b/package.json
index d68af5a63..d5a090dfd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "umami",
- "version": "2.11.3",
+ "version": "2.12.0",
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
"author": "Umami Software, Inc. <[email protected]>",
"license": "MIT",
diff --git a/src/components/hooks/queries/useWebsiteMetrics.ts b/src/components/hooks/queries/useWebsiteMetrics.ts
index 301b2e04c..dd201155b 100644
--- a/src/components/hooks/queries/useWebsiteMetrics.ts
+++ b/src/components/hooks/queries/useWebsiteMetrics.ts
@@ -4,8 +4,7 @@ import { useFilterParams } from '../useFilterParams';
export function useWebsiteMetrics(
websiteId: string,
- type: string,
- limit: number,
+ query: { type: string; limit: number; search: string },
options?: Omit<UseQueryOptions & { onDataLoad?: (data: any) => void }, 'queryKey' | 'queryFn'>,
) {
const { get, useQuery } = useApi();
@@ -17,19 +16,17 @@ export function useWebsiteMetrics(
{
websiteId,
...params,
- type,
- limit,
+ ...query,
},
],
queryFn: async () => {
const filters = { ...params };
- filters[type] = undefined;
+ filters[query.type] = undefined;
const data = await get(`/websites/${websiteId}/metrics`, {
...filters,
- type,
- limit,
+ ...query,
});
options?.onDataLoad?.(data);
diff --git a/src/components/metrics/MetricsTable.tsx b/src/components/metrics/MetricsTable.tsx
index cfabdd305..857c136b2 100644
--- a/src/components/metrics/MetricsTable.tsx
+++ b/src/components/metrics/MetricsTable.tsx
@@ -48,10 +48,14 @@ export function MetricsTable({
const { formatMessage, labels } = useMessages();
const { dir } = useLocale();
- const { data, isLoading, isFetched, error } = useWebsiteMetrics(websiteId, type, limit, {
- retryDelay: delay || DEFAULT_ANIMATION_DURATION,
- onDataLoad,
- });
+ const { data, isLoading, isFetched, error } = useWebsiteMetrics(
+ websiteId,
+ { type, limit, search },
+ {
+ retryDelay: delay || DEFAULT_ANIMATION_DURATION,
+ onDataLoad,
+ },
+ );
const filteredData = useMemo(() => {
if (data) {