Skip to content

Commit

Permalink
update outdated comments
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Nov 26, 2024
1 parent 5d97d3c commit 0ff21eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ export interface LanguageConfig {
};
editorSupportedAppNames?: string[];
supportedAppNames?: string[];
/**
* @deprecated
*
* Use `datasetTypeConfig.supportsTimeFilter` instead
*/
hideDatePicker?: boolean;
sampleQueries?: SampleQuery[];
}
16 changes: 3 additions & 13 deletions src/plugins/data/public/ui/query_editor/query_editor_top_row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0ff21eb

Please sign in to comment.