From 0ff21ebf5a12f079c594751100c658469661f1d2 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Tue, 26 Nov 2024 21:07:51 +0000 Subject: [PATCH] update outdated comments Signed-off-by: Joshua Li --- .../query/query_string/dataset_service/types.ts | 4 ++-- .../query/query_string/language_service/types.ts | 5 ----- .../ui/query_editor/query_editor_top_row.tsx | 16 +++------------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/plugins/data/public/query/query_string/dataset_service/types.ts b/src/plugins/data/public/query/query_string/dataset_service/types.ts index 4b1cbb553ad7..d97afec8abb6 100644 --- a/src/plugins/data/public/query/query_string/dataset_service/types.ts +++ b/src/plugins/data/public/query/query_string/dataset_service/types.ts @@ -45,8 +45,8 @@ export interface DatasetTypeConfig { title: string; languageOverrides?: { [language: string]: { - /** The overrides transfer the responsibility of handling the input from - * the language interceptor to the dataset types strategy. */ + /** The override transfers the responsibility of handling the input from + * the language interceptor to the dataset type search strategy. */ hideDatePicker?: boolean; }; }; 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 6404aa98ed65..c80858d67102 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 @@ -61,11 +61,6 @@ export interface LanguageConfig { }; editorSupportedAppNames?: string[]; supportedAppNames?: string[]; - /** - * @deprecated - * - * Use `datasetTypeConfig.supportsTimeFilter` instead - */ hideDatePicker?: boolean; sampleQueries?: SampleQuery[]; } diff --git a/src/plugins/data/public/ui/query_editor/query_editor_top_row.tsx b/src/plugins/data/public/ui/query_editor/query_editor_top_row.tsx index c13005de799b..ad22750207ed 100644 --- a/src/plugins/data/public/ui/query_editor/query_editor_top_row.tsx +++ b/src/plugins/data/public/ui/query_editor/query_editor_top_row.tsx @@ -236,26 +236,16 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) { * If isDatePickerEnabled is false, returns false immediately * * Dataset Type permutations (datasetType?.meta?.supportsTimeFilter): - * - supportsTimeFilter=true => true * - supportsTimeFilter=false => false - * - supportsTimeFilter=undefined && dataset exists => falls through to language check - * - no dataset => falls through to language check * - * Language permutations (when dataset.meta.supportsTimeFilter is undefined): + * Language permutations (when dataset.meta.supportsTimeFilter is undefined or true): * - queryLanguage=undefined => true (shows date picker) * - queryLanguage exists: + * - languageOverrides[queryLanguage].hideDatePicker=true => false + * - languageOverrides[queryLanguage].hideDatePicker=false => true * - hideDatePicker=true => false * - hideDatePicker=false => true * - hideDatePicker=undefined => true - * - * Example scenarios: - * 1. {showDatePicker: false} => false - * 2. {dataset: {type: 'x', meta: {supportsTimeFilter: true}}} => true - * 3. {dataset: {type: 'x', meta: {supportsTimeFilter: false}}} => false - * 4. {dataset: {type: 'x'}, queryLanguage: 'sql', hideDatePicker: true} => false - * 5. {dataset: {type: 'x'}, queryLanguage: 'sql', hideDatePicker: false} => true - * 6. {dataset: {type: 'x'}, queryLanguage: undefined} => true (no language restrictions) - * 7. No configuration => true (default behavior shows date picker) */ function shouldRenderDatePicker(): boolean { const { queryString } = data.query;