File tree Expand file tree Collapse file tree
apps/webapp/app/components/runs/v3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,8 +128,8 @@ function parsePeriodString(period: string): { value: number; unit: string } | nu
128128 return null ;
129129}
130130
131- const defaultPeriod = "7d" ;
132- const defaultPeriodMs = parse ( defaultPeriod ) ;
131+ const DEFAULT_PERIOD = "7d" ;
132+ const defaultPeriodMs = parse ( DEFAULT_PERIOD ) ;
133133if ( ! defaultPeriodMs ) {
134134 throw new Error ( "Invalid default period" ) ;
135135}
@@ -140,10 +140,12 @@ export const timeFilters = ({
140140 period,
141141 from,
142142 to,
143+ defaultPeriod = DEFAULT_PERIOD ,
143144} : {
144145 period ?: string ;
145146 from ?: string | number ;
146147 to ?: string | number ;
148+ defaultPeriod ?: string ;
147149} ) : {
148150 period ?: string ;
149151 from ?: Date ;
@@ -199,10 +201,12 @@ export function timeFilterRenderValues({
199201 from,
200202 to,
201203 period,
204+ defaultPeriod = DEFAULT_PERIOD ,
202205} : {
203206 from ?: Date ;
204207 to ?: Date ;
205208 period ?: string ;
209+ defaultPeriod ?: string ;
206210} ) {
207211 const rangeType : TimeRangeType = from && to ? "range" : from ? "from" : to ? "to" : "period" ;
208212
@@ -306,11 +310,13 @@ export function TimeDropdown({
306310 period,
307311 from,
308312 to,
313+ defaultPeriod = DEFAULT_PERIOD ,
309314} : {
310315 trigger : ReactNode ;
311316 period ?: string ;
312317 from ?: Date ;
313318 to ?: Date ;
319+ defaultPeriod ?: string ;
314320} ) {
315321 const [ open , setOpen ] = useState < boolean | undefined > ( ) ;
316322 const { replace } = useSearchParams ( ) ;
You can’t perform that action at this time.
0 commit comments