mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-06 01:15:42 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1341f449a8
@ -36,7 +36,7 @@ export function BarChart(props: BarChartProps) {
|
|||||||
x: {
|
x: {
|
||||||
type: XAxisType,
|
type: XAxisType,
|
||||||
stacked: true,
|
stacked: true,
|
||||||
min: minDate,
|
min: unit === 'minute' ? minDate : '',
|
||||||
max: maxDate,
|
max: maxDate,
|
||||||
time: {
|
time: {
|
||||||
unit,
|
unit,
|
||||||
|
@ -63,9 +63,9 @@ function getDateStringSQL(data: any, unit: string = 'utc', timezone?: string) {
|
|||||||
|
|
||||||
function getDateSQL(field: string, unit: string, timezone?: string) {
|
function getDateSQL(field: string, unit: string, timezone?: string) {
|
||||||
if (timezone) {
|
if (timezone) {
|
||||||
return `date_trunc('${unit}', ${field}, '${timezone}')`;
|
return `toDateTime(date_trunc('${unit}', ${field}, '${timezone}'), '${timezone}')`;
|
||||||
}
|
}
|
||||||
return `date_trunc('${unit}', ${field})`;
|
return `toDateTime(date_trunc('${unit}', ${field}))`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapFilter(column: string, operator: string, name: string, type: string = 'String') {
|
function mapFilter(column: string, operator: string, name: string, type: string = 'String') {
|
||||||
|
@ -41,8 +41,8 @@ async function clickhouseQuery(
|
|||||||
websiteId: string,
|
websiteId: string,
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<{ x: string; y: number }[]> {
|
): Promise<{ x: string; y: number }[]> {
|
||||||
const { unit = 'day' } = filters;
|
const { timezone = 'utc', unit = 'day' } = filters;
|
||||||
const { parseFilters, rawQuery } = clickhouse;
|
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
||||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||||
...filters,
|
...filters,
|
||||||
eventType: EVENT_TYPE.pageView,
|
eventType: EVENT_TYPE.pageView,
|
||||||
@ -57,7 +57,7 @@ async function clickhouseQuery(
|
|||||||
g.y as y
|
g.y as y
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
date_trunc('${unit}', created_at) as t,
|
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||||
count(*) as y
|
count(*) as y
|
||||||
from website_event
|
from website_event
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
@ -75,7 +75,7 @@ async function clickhouseQuery(
|
|||||||
g.y as y
|
g.y as y
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
date_trunc('${unit}', created_at) as t,
|
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||||
sum(views)as y
|
sum(views)as y
|
||||||
from website_event_stats_hourly website_event
|
from website_event_stats_hourly website_event
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
|
@ -41,8 +41,8 @@ async function clickhouseQuery(
|
|||||||
websiteId: string,
|
websiteId: string,
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<{ x: string; y: number }[]> {
|
): Promise<{ x: string; y: number }[]> {
|
||||||
const { unit = 'day' } = filters;
|
const { timezone = 'utc', unit = 'day' } = filters;
|
||||||
const { parseFilters, rawQuery } = clickhouse;
|
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
||||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||||
...filters,
|
...filters,
|
||||||
eventType: EVENT_TYPE.pageView,
|
eventType: EVENT_TYPE.pageView,
|
||||||
@ -57,7 +57,7 @@ async function clickhouseQuery(
|
|||||||
g.y as y
|
g.y as y
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
date_trunc('${unit}', created_at) as t,
|
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||||
count(distinct session_id) as y
|
count(distinct session_id) as y
|
||||||
from website_event
|
from website_event
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
@ -75,7 +75,7 @@ async function clickhouseQuery(
|
|||||||
g.y as y
|
g.y as y
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
date_trunc('${unit}', created_at) as t,
|
${getDateSQL('website_event.created_at', unit, timezone)} as t,
|
||||||
uniq(session_id) as y
|
uniq(session_id) as y
|
||||||
from website_event_stats_hourly website_event
|
from website_event_stats_hourly website_event
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
|
Loading…
Reference in New Issue
Block a user