mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Merge branch 'dev' into hosts-support
This commit is contained in:
commit
d1559c3a98
281 changed files with 7555 additions and 1973 deletions
|
|
@ -20,6 +20,7 @@ export const DEFAULT_DATE_RANGE = '24hour';
|
|||
export const DEFAULT_WEBSITE_LIMIT = 10;
|
||||
export const DEFAULT_RESET_DATE = '2000-01-01';
|
||||
export const DEFAULT_PAGE_SIZE = 10;
|
||||
export const DEFAULT_DATE_COMPARE = 'prev';
|
||||
|
||||
export const REALTIME_RANGE = 30;
|
||||
export const REALTIME_INTERVAL = 5000;
|
||||
|
|
@ -32,7 +33,7 @@ export const FILTER_REFERRERS = 'filter-referrers';
|
|||
export const FILTER_PAGES = 'filter-pages';
|
||||
|
||||
export const UNIT_TYPES = ['year', 'month', 'hour', 'day', 'minute'];
|
||||
export const EVENT_COLUMNS = ['url', 'referrer', 'title', 'query', 'event', 'host'];
|
||||
export const EVENT_COLUMNS = ['url', 'entry', 'exit', 'referrer', 'title', 'query', 'event', 'host'];
|
||||
|
||||
export const SESSION_COLUMNS = [
|
||||
'browser',
|
||||
|
|
@ -48,6 +49,8 @@ export const SESSION_COLUMNS = [
|
|||
|
||||
export const FILTER_COLUMNS = {
|
||||
url: 'url_path',
|
||||
entry: 'url_path',
|
||||
exit: 'url_path',
|
||||
referrer: 'referrer_domain',
|
||||
host: 'hostname',
|
||||
title: 'page_title',
|
||||
|
|
@ -114,9 +117,11 @@ export const DATA_TYPES = {
|
|||
|
||||
export const REPORT_TYPES = {
|
||||
funnel: 'funnel',
|
||||
goals: 'goals',
|
||||
insights: 'insights',
|
||||
retention: 'retention',
|
||||
utm: 'utm',
|
||||
journey: 'journey',
|
||||
} as const;
|
||||
|
||||
export const REPORT_PARAMETERS = {
|
||||
|
|
|
|||
|
|
@ -88,3 +88,7 @@ function getKeyName(key: string, parentKey: string) {
|
|||
|
||||
return `${parentKey}.${key}`;
|
||||
}
|
||||
|
||||
export function objectToArray(obj: object) {
|
||||
return Object.keys(obj).map(key => obj[key]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,3 +326,13 @@ export function getDateLength(startDate: Date, endDate: Date, unit: string | num
|
|||
const { diff } = DATE_FUNCTIONS[unit];
|
||||
return diff(endDate, startDate) + 1;
|
||||
}
|
||||
|
||||
export function getCompareDate(compare: string, startDate: Date, endDate: Date) {
|
||||
if (compare === 'yoy') {
|
||||
return { startDate: subYears(startDate, 1), endDate: subYears(endDate, 1) };
|
||||
}
|
||||
|
||||
const diff = differenceInMinutes(endDate, startDate);
|
||||
|
||||
return { startDate: subMinutes(startDate, diff), endDate: subMinutes(endDate, diff) };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {
|
|||
arSA,
|
||||
be,
|
||||
bn,
|
||||
bg,
|
||||
bs,
|
||||
cs,
|
||||
sk,
|
||||
|
|
@ -48,6 +49,7 @@ import {
|
|||
export const languages = {
|
||||
'ar-SA': { label: 'العربية', dateLocale: arSA, dir: 'rtl' },
|
||||
'be-BY': { label: 'Беларуская', dateLocale: be },
|
||||
'bg-BG': { label: 'български език', dateLocale: bg },
|
||||
'bn-BD': { label: 'বাংলা', dateLocale: bn },
|
||||
'bs-BA': { label: 'Bosanski', dateLocale: bs },
|
||||
'ca-ES': { label: 'Català', dateLocale: ca },
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Website, Session } from '@prisma/client';
|
|||
import redis from '@umami/redis-client';
|
||||
|
||||
export async function fetchWebsite(websiteId: string): Promise<Website> {
|
||||
let website;
|
||||
let website = null;
|
||||
|
||||
if (redis.enabled) {
|
||||
website = await redis.client.fetch(`website:${websiteId}`, () => getWebsite(websiteId), 86400);
|
||||
|
|
@ -19,7 +19,7 @@ export async function fetchWebsite(websiteId: string): Promise<Website> {
|
|||
}
|
||||
|
||||
export async function fetchSession(sessionId: string): Promise<Session> {
|
||||
let session;
|
||||
let session = null;
|
||||
|
||||
if (redis.enabled) {
|
||||
session = await redis.client.fetch(`session:${sessionId}`, () => getSession(sessionId), 86400);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue