From 783d4b8543b48134f9c9aa8f6d378076ba7a5f64 Mon Sep 17 00:00:00 2001 From: Sean Li Date: Tue, 17 Sep 2024 16:36:34 -0700 Subject: [PATCH] addressing comments Signed-off-by: Sean Li --- .../query/query_string/language_service/types.ts | 2 +- .../public/ui/dataset_selector/configurator.tsx | 15 +++++++++------ src/plugins/query_enhancements/public/plugin.tsx | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/plugins/data/public/query/query_string/language_service/types.ts b/src/plugins/data/public/query/query_string/language_service/types.ts index a8e05c6c0640..a6024759b336 100644 --- a/src/plugins/data/public/query/query_string/language_service/types.ts +++ b/src/plugins/data/public/query/query_string/language_service/types.ts @@ -51,5 +51,5 @@ export interface LanguageConfig { showDocLinks?: boolean; editorSupportedAppNames?: string[]; supportedAppNames?: string[]; - noTimeField?: boolean; + disableDatePicker?: boolean; } diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 50d71e708851..0d652bb9cabe 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -52,9 +52,9 @@ export const Configurator = ({ return languages[0]; }); - const requiresTimeField = (ds: Dataset, lang: string, fields: DatasetField[]) => { + const displayTimeFieldSelector = (ds: Dataset, lang: string, fields: DatasetField[]) => { if ( - languageService.getLanguage(lang)?.noTimeField || + languageService.getLanguage(lang)?.disableDatePicker || ds.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN ) { return false; @@ -62,6 +62,7 @@ export const Configurator = ({ if (fields && fields.length > 0) { return true; } + return false; }; useEffect(() => { @@ -111,7 +112,7 @@ export const Configurator = ({ {dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN && - !languageService.getLanguage(language)?.noTimeField && ( + !languageService.getLanguage(language)?.disableDatePicker && ( )} - {requiresTimeField(dataset, language, timeFields) && ( + {displayTimeFieldSelector(dataset, language, timeFields) && ( )} @@ -192,7 +193,9 @@ export const Configurator = ({ onConfirm(dataset); }} fill - disabled={timeFieldName === undefined && requiresTimeField(dataset, language, timeFields)} + disabled={ + timeFieldName === undefined && displayTimeFieldSelector(dataset, language, timeFields) + } >