add event-data property filtering
This commit is contained in:
1 parent
cf2ab575ba
commit
77dda7268e
25 files changed
+748
-122
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { serializeEventPropertyFilters } from '@/lib/params';
|
||||
import type { EventPropertyFilter, ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useDateParameters } from '../useDateParameters';
|
||||
import { useFilterParameters } from '../useFilterParameters';
|
||||
@@ -8,6 +9,7 @@ export function useEventDataNumericSeriesQuery(
|
||||
eventName: string,
|
||||
propertyName: string,
|
||||
metric: 'sum' | 'avg',
|
||||
eventFilters: EventPropertyFilter[] = [],
|
||||
options?: ReactQueryOptions,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
@@ -17,7 +19,7 @@ export function useEventDataNumericSeriesQuery(
|
||||
return useQuery<any>({
|
||||
queryKey: [
|
||||
'websites:event-data-pivot:numeric-series',
|
||||
{ websiteId, eventName, propertyName, metric, startAt, endAt, unit, timezone, ...params },
|
||||
{ websiteId, eventName, propertyName, metric, eventFilters, startAt, endAt, unit, timezone, ...params },
|
||||
],
|
||||
queryFn: () =>
|
||||
get(`/websites/${websiteId}/event-data-pivot/numeric-series`, {
|
||||
@@ -28,6 +30,7 @@ export function useEventDataNumericSeriesQuery(
|
||||
endAt,
|
||||
unit,
|
||||
timezone,
|
||||
...serializeEventPropertyFilters(eventFilters),
|
||||
...params,
|
||||
}),
|
||||
enabled: !!(websiteId && eventName && propertyName),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { serializeEventPropertyFilters } from '@/lib/params';
|
||||
import type { EventPropertyFilter, ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useDateParameters } from '../useDateParameters';
|
||||
import { useFilterParameters } from '../useFilterParameters';
|
||||
@@ -6,6 +7,7 @@ import { useFilterParameters } from '../useFilterParameters';
|
||||
export function useEventDataPivotQuery(
|
||||
websiteId: string,
|
||||
eventName: string,
|
||||
eventFilters: EventPropertyFilter[] = [],
|
||||
options?: ReactQueryOptions,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
@@ -15,7 +17,7 @@ export function useEventDataPivotQuery(
|
||||
return useQuery({
|
||||
queryKey: [
|
||||
'websites:event-data-pivot',
|
||||
{ websiteId, eventName, startAt, endAt, unit, timezone, ...params },
|
||||
{ websiteId, eventName, eventFilters, startAt, endAt, unit, timezone, ...params },
|
||||
],
|
||||
queryFn: () =>
|
||||
get(`/websites/${websiteId}/event-data-pivot`, {
|
||||
@@ -24,6 +26,7 @@ export function useEventDataPivotQuery(
|
||||
endAt,
|
||||
unit,
|
||||
timezone,
|
||||
...serializeEventPropertyFilters(eventFilters),
|
||||
...params,
|
||||
}),
|
||||
enabled: !!(websiteId && eventName),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { serializeEventPropertyFilters } from '@/lib/params';
|
||||
import type { EventPropertyFilter, ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useDateParameters } from '../useDateParameters';
|
||||
import { useFilterParameters } from '../useFilterParameters';
|
||||
@@ -7,6 +8,7 @@ export function useEventDataPropertySeriesQuery(
|
||||
websiteId: string,
|
||||
eventName: string,
|
||||
propertyName: string,
|
||||
eventFilters: EventPropertyFilter[] = [],
|
||||
options?: ReactQueryOptions,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
@@ -16,7 +18,7 @@ export function useEventDataPropertySeriesQuery(
|
||||
return useQuery<any>({
|
||||
queryKey: [
|
||||
'websites:event-data-pivot:property-series',
|
||||
{ websiteId, eventName, propertyName, startAt, endAt, unit, timezone, ...params },
|
||||
{ websiteId, eventName, propertyName, eventFilters, startAt, endAt, unit, timezone, ...params },
|
||||
],
|
||||
queryFn: () =>
|
||||
get(`/websites/${websiteId}/event-data-pivot/property-series`, {
|
||||
@@ -26,6 +28,7 @@ export function useEventDataPropertySeriesQuery(
|
||||
endAt,
|
||||
unit,
|
||||
timezone,
|
||||
...serializeEventPropertyFilters(eventFilters),
|
||||
...params,
|
||||
}),
|
||||
enabled: !!(websiteId && eventName && propertyName),
|
||||
|
||||
@@ -58,8 +58,9 @@ export function FilterBar({ websiteId }: { websiteId?: string }) {
|
||||
justifyContent="space-between"
|
||||
padding="2"
|
||||
backgroundColor="surface-sunken"
|
||||
wrap="wrap"
|
||||
>
|
||||
<Row alignItems="center" gap="2" wrap="wrap">
|
||||
<Row alignItems="center" gap="2" wrap="wrap" width={{ base: '100%', md: 'auto' }}>
|
||||
{segment && !isLoading && (
|
||||
<FilterItem
|
||||
name="segment"
|
||||
@@ -149,7 +150,7 @@ const FilterItem = ({ name, label, operator, value, onRemove }) => {
|
||||
theme="dark"
|
||||
>
|
||||
<Row alignItems="center" gap="4">
|
||||
<Row alignItems="center" gap="2" maxWidth={'500px'}>
|
||||
<Row alignItems="center" gap="2" style={{ maxWidth: 'min(500px, calc(100vw - 10rem))', minWidth: 0, overflow: 'hidden' }}>
|
||||
<Text color="primary" weight="bold">
|
||||
{label}
|
||||
</Text>
|
||||
|
||||
@@ -190,6 +190,7 @@ export const labels: Record<string, string> = {
|
||||
type: 'label.type',
|
||||
filter: 'label.filter',
|
||||
filters: 'label.filters',
|
||||
propertyFilter: 'label.property-filter',
|
||||
breakdown: 'label.breakdown',
|
||||
true: 'label.true',
|
||||
false: 'label.false',
|
||||
|
||||
Reference in new issue
Block a user