mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
Updated insights report rendering.
This commit is contained in:
parent
c4bbcf37b7
commit
85c593416a
6 changed files with 64 additions and 55 deletions
|
|
@ -5,7 +5,7 @@ import { EVENT_TYPE } from 'lib/constants';
|
|||
import { QueryFilters } from 'lib/types';
|
||||
|
||||
export async function getInsights(
|
||||
...args: [websiteId: string, groups: { name: string; type: string }[], filters: QueryFilters]
|
||||
...args: [websiteId: string, fields: { name: string; type?: string }[], filters: QueryFilters]
|
||||
) {
|
||||
return runQuery({
|
||||
[PRISMA]: () => relationalQuery(...args),
|
||||
|
|
@ -15,7 +15,7 @@ export async function getInsights(
|
|||
|
||||
async function relationalQuery(
|
||||
websiteId: string,
|
||||
groups: { name: string; type: string }[],
|
||||
fields: { name: string; type?: string }[],
|
||||
filters: QueryFilters,
|
||||
): Promise<
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ async function relationalQuery(
|
|||
|
||||
async function clickhouseQuery(
|
||||
websiteId: string,
|
||||
groups: { name: string; type: string }[],
|
||||
fields: { name: string; type?: string }[],
|
||||
filters: QueryFilters,
|
||||
): Promise<
|
||||
{
|
||||
|
|
@ -66,14 +66,14 @@ async function clickhouseQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
${parseFields(groups)}
|
||||
${parseFields(fields)}
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime} and {endDate:DateTime}
|
||||
and event_type = {eventType:UInt32}
|
||||
${filterQuery}
|
||||
group by ${groups.map(({ name }) => name).join(',')}
|
||||
order by 1 desc
|
||||
group by ${fields.map(({ name }) => name).join(',')}
|
||||
order by 1 desc, 2 desc
|
||||
limit 500
|
||||
`,
|
||||
params,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue