mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Merge branch 'dev' into analytics
This commit is contained in:
commit
12bebdd61f
8 changed files with 108 additions and 99 deletions
|
|
@ -20,16 +20,16 @@
|
|||
.cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--base100);
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.hour {
|
||||
font-weight: 700;
|
||||
color: var(--font-color300);
|
||||
background-color: transparent;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.block {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { format } from 'date-fns';
|
||||
import { format, startOfDay, addHours } from 'date-fns';
|
||||
import { useLocale, useMessages, useWebsiteSessionsWeekly } from 'components/hooks';
|
||||
import { LoadingPanel } from 'components/common/LoadingPanel';
|
||||
import { getDayOfWeekAsDate } from 'lib/date';
|
||||
|
|
@ -40,9 +40,10 @@ export function SessionsWeekly({ websiteId }: { websiteId: string }) {
|
|||
{Array(24)
|
||||
.fill(null)
|
||||
.map((_, i) => {
|
||||
const label = format(addHours(startOfDay(new Date()), i), 'haaa');
|
||||
return (
|
||||
<div key={i} className={classNames(styles.cell, styles.hour)}>
|
||||
{i.toString().padStart(2, '0')}
|
||||
<div key={i} className={styles.hour}>
|
||||
{label}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ async function rawQuery<T = unknown>(
|
|||
format: 'JSONEachRow',
|
||||
});
|
||||
|
||||
return resultSet.json() as T;
|
||||
return (await resultSet.json()) as T;
|
||||
}
|
||||
|
||||
async function insert(table: string, values: any[]) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import debug from 'debug';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@umami/prisma-client';
|
||||
import moment from 'moment-timezone';
|
||||
|
|
@ -8,6 +9,8 @@ import { maxDate } from './date';
|
|||
import { QueryFilters, QueryOptions, PageParams } from './types';
|
||||
import { filtersToArray } from './params';
|
||||
|
||||
const log = debug('umami:prisma');
|
||||
|
||||
const MYSQL_DATE_FORMATS = {
|
||||
minute: '%Y-%m-%d %H:%i:00',
|
||||
hour: '%Y-%m-%d %H:00:00',
|
||||
|
|
@ -210,6 +213,11 @@ async function parseFilters(
|
|||
}
|
||||
|
||||
async function rawQuery(sql: string, data: object): Promise<any> {
|
||||
if (process.env.LOG_QUERY) {
|
||||
log('QUERY:\n', sql);
|
||||
log('PARAMETERS:\n', data);
|
||||
}
|
||||
|
||||
const db = getDatabaseType();
|
||||
const params = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ async function relationalQuery(
|
|||
${filterQuery}
|
||||
group by string_value
|
||||
order by 2 desc
|
||||
limit 500
|
||||
limit 100
|
||||
`,
|
||||
params,
|
||||
);
|
||||
|
|
@ -63,7 +63,7 @@ async function clickhouseQuery(
|
|||
${filterQuery}
|
||||
group by event_name, value
|
||||
order by 2 desc
|
||||
limit 500;
|
||||
limit 100
|
||||
`,
|
||||
params,
|
||||
).then(result => {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ async function relationalQuery(
|
|||
${filterQuery}
|
||||
group by string_value
|
||||
order by 2 desc
|
||||
limit 500
|
||||
limit 100
|
||||
`,
|
||||
params,
|
||||
);
|
||||
|
|
@ -58,7 +58,7 @@ async function clickhouseQuery(
|
|||
${filterQuery}
|
||||
group by value
|
||||
order by 2 desc
|
||||
limit 500;
|
||||
limit 100
|
||||
`,
|
||||
params,
|
||||
).then(result => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue