feature(dashboard): add more settings for funnels
* wip * feature(dashboard): add more settings for funnels
This commit is contained in:
committed by
GitHub
parent
4846390531
commit
c4a2ea4858
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "reports" ADD COLUMN "funnelGroup" TEXT,
|
||||
ADD COLUMN "funnelWindow" DOUBLE PRECISION;
|
||||
@@ -231,21 +231,23 @@ enum Metric {
|
||||
}
|
||||
|
||||
model Report {
|
||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||
name String
|
||||
interval Interval
|
||||
range String @default("30d")
|
||||
chartType ChartType
|
||||
lineType String @default("monotone")
|
||||
breakdowns Json
|
||||
events Json
|
||||
formula String?
|
||||
unit String?
|
||||
metric Metric @default(sum)
|
||||
projectId String
|
||||
project Project @relation(fields: [projectId], references: [id])
|
||||
previous Boolean @default(false)
|
||||
criteria String?
|
||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||
name String
|
||||
interval Interval
|
||||
range String @default("30d")
|
||||
chartType ChartType
|
||||
lineType String @default("monotone")
|
||||
breakdowns Json
|
||||
events Json
|
||||
formula String?
|
||||
unit String?
|
||||
metric Metric @default(sum)
|
||||
projectId String
|
||||
project Project @relation(fields: [projectId], references: [id])
|
||||
previous Boolean @default(false)
|
||||
criteria String?
|
||||
funnelGroup String?
|
||||
funnelWindow Float?
|
||||
|
||||
dashboardId String
|
||||
dashboard Dashboard @relation(fields: [dashboardId], references: [id])
|
||||
|
||||
@@ -129,14 +129,16 @@ export async function chQuery<T extends Record<string, any>>(
|
||||
}
|
||||
|
||||
export function formatClickhouseDate(
|
||||
_date: Date | string,
|
||||
date: Date | string,
|
||||
skipTime = false,
|
||||
): string {
|
||||
if (typeof _date === 'string') {
|
||||
return _date.slice(0, 19).replace('T', ' ');
|
||||
if (typeof date === 'string') {
|
||||
if (skipTime) {
|
||||
return date.slice(0, 10);
|
||||
}
|
||||
return date.slice(0, 19).replace('T', ' ');
|
||||
}
|
||||
|
||||
const date = typeof _date === 'string' ? new Date(_date) : _date;
|
||||
if (skipTime) {
|
||||
return date.toISOString().split('T')[0]!;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ export function transformReport(
|
||||
metric: report.metric ?? 'sum',
|
||||
unit: report.unit ?? undefined,
|
||||
criteria: (report.criteria as ICriteria) ?? undefined,
|
||||
funnelGroup: report.funnelGroup ?? undefined,
|
||||
funnelWindow: report.funnelWindow ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user