mirror of
https://github.com/umami-software/umami.git
synced 2026-02-17 19:15:37 +01:00
Merge 528a8d397c into 86e0fc2262
This commit is contained in:
commit
01b1c7167d
3 changed files with 11 additions and 5 deletions
|
|
@ -8,13 +8,14 @@ import { useState } from 'react';
|
|||
import { CHART_COLORS } from '@/lib/constants';
|
||||
import styles from './EventProperties.module.css';
|
||||
|
||||
export function EventProperties({ websiteId }: { websiteId: string }) {
|
||||
export function EventProperties({ websiteId, label }: { websiteId: string; label: string }) {
|
||||
const [propertyName, setPropertyName] = useState('');
|
||||
const [eventName, setEventName] = useState('');
|
||||
const [propertyView, setPropertyView] = useState('table');
|
||||
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { data, isLoading, isFetched, error } = useEventDataProperties(websiteId);
|
||||
const { data: eventData = [], isLoading, isFetched, error } = useEventDataProperties(websiteId);
|
||||
const data = label ? eventData.filter(({ eventName }) => eventName === label) : eventData;
|
||||
const { data: values } = useEventDataValues(websiteId, eventName, propertyName);
|
||||
|
||||
const propertySum = useMemo(() => {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ import { ReactNode } from 'react';
|
|||
|
||||
export default function EventsDataTable({
|
||||
websiteId,
|
||||
label,
|
||||
}: {
|
||||
websiteId?: string;
|
||||
label?: string;
|
||||
teamId?: string;
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
|
|
@ -14,7 +16,10 @@ export default function EventsDataTable({
|
|||
|
||||
return (
|
||||
<DataTable queryResult={queryResult} allowSearch={true} autoFocus={false}>
|
||||
{({ data }) => <EventsTable data={data} />}
|
||||
{({ data: eventData = [] }) => {
|
||||
const data = label ? eventData.filter(({ eventName }) => eventName === label) : eventData;
|
||||
return <EventsTable data={data} />;
|
||||
}}
|
||||
</DataTable>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ export default function EventsPage({ websiteId }) {
|
|||
<Item key="activity">{formatMessage(labels.activity)}</Item>
|
||||
<Item key="properties">{formatMessage(labels.properties)}</Item>
|
||||
</Tabs>
|
||||
{tab === 'activity' && <EventsDataTable websiteId={websiteId} />}
|
||||
{tab === 'properties' && <EventProperties websiteId={websiteId} />}
|
||||
{tab === 'activity' && <EventsDataTable websiteId={websiteId} label={label} />}
|
||||
{tab === 'properties' && <EventProperties websiteId={websiteId} label={label} />}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue