From 96b721b6039d8672ef3b66c744832a190555b225 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Wed, 24 Apr 2024 19:11:34 +0000 Subject: [PATCH] set default range Signed-off-by: Kawika Avilla --- .../ui/query_string_input/query_bar_top_row.tsx | 11 +++++++---- src/plugins/data/public/ui/types.ts | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx index e7ebf42aeb44..6d711c75b603 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx @@ -124,8 +124,11 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { function getDateRange() { const defaultTimeSetting = uiSettings!.get(UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS); return { - from: props.dateRangeFrom || defaultTimeSetting.from, - to: props.dateRangeTo || defaultTimeSetting.to, + from: + queryUiEnhancement?.dateRange?.initialFrom || + props.dateRangeFrom || + defaultTimeSetting.from, + to: queryUiEnhancement?.dateRange?.initialTo || props.dateRangeTo || defaultTimeSetting.to, }; } @@ -317,8 +320,8 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { return ( ' with the data source name initialValue?: string; }; + dateRange?: { + initialFrom?: string; + initialTo?: string; + }; }; fields?: { filterable?: boolean;