improved date range selector with hotkeys
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
lineTypes,
|
||||
metrics,
|
||||
operators,
|
||||
timeRanges,
|
||||
timeWindows,
|
||||
} from '@openpanel/constants';
|
||||
|
||||
export function objectToZodEnums<K extends string>(
|
||||
@@ -57,7 +57,7 @@ export const zTimeInterval = z.enum(objectToZodEnums(intervals));
|
||||
|
||||
export const zMetric = z.enum(objectToZodEnums(metrics));
|
||||
|
||||
export const zRange = z.enum(objectToZodEnums(timeRanges));
|
||||
export const zRange = z.enum(objectToZodEnums(timeWindows));
|
||||
|
||||
export const zChartInput = z.object({
|
||||
name: z.string().default(''),
|
||||
@@ -66,7 +66,7 @@ export const zChartInput = z.object({
|
||||
interval: zTimeInterval.default('day'),
|
||||
events: zChartEvents,
|
||||
breakdowns: zChartBreakdowns.default([]),
|
||||
range: zRange.default('1m'),
|
||||
range: zRange.default('30d'),
|
||||
previous: z.boolean().default(false),
|
||||
formula: z.string().optional(),
|
||||
metric: zMetric.default('sum'),
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { z } from 'zod';
|
||||
|
||||
import type { timeRanges } from '@openpanel/constants';
|
||||
|
||||
import type {
|
||||
zChartBreakdown,
|
||||
zChartEvent,
|
||||
@@ -9,6 +7,7 @@ import type {
|
||||
zChartType,
|
||||
zLineType,
|
||||
zMetric,
|
||||
zRange,
|
||||
zTimeInterval,
|
||||
} from './index';
|
||||
|
||||
@@ -24,7 +23,7 @@ export type IInterval = z.infer<typeof zTimeInterval>;
|
||||
export type IChartType = z.infer<typeof zChartType>;
|
||||
export type IChartMetric = z.infer<typeof zMetric>;
|
||||
export type IChartLineType = z.infer<typeof zLineType>;
|
||||
export type IChartRange = keyof typeof timeRanges;
|
||||
export type IChartRange = z.infer<typeof zRange>;
|
||||
export type IGetChartDataInput = {
|
||||
event: IChartEvent;
|
||||
projectId: string;
|
||||
|
||||
Reference in New Issue
Block a user