From 400dd88c72762d1cc650d86c83aa8f60d9f4279e Mon Sep 17 00:00:00 2001 From: Sean Li Date: Thu, 12 Sep 2024 11:21:43 -0700 Subject: [PATCH 01/10] adding UI changes Signed-off-by: Sean Li --- src/plugins/data/public/ui/dataset_selector/configurator.tsx | 2 ++ .../data_explorer/public/components/app_container.tsx | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 164f677e27a2..afb1b6db061f 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -121,6 +121,7 @@ export const Configurator = ({ setTimeFieldName(value); setDataset({ ...dataset, timeFieldName: value }); }} + disabled={dataset?.timeFieldName !== undefined} /> )} @@ -165,6 +166,7 @@ export const Configurator = ({ onConfirm(dataset); }} fill + disabled={timeFields && timeFields.length > 0 && timeFieldName === undefined} > From cb0d82758c8939d6369cb4dde4fd9709448ab83b Mon Sep 17 00:00:00 2001 From: Sean Li Date: Thu, 12 Sep 2024 19:46:25 -0700 Subject: [PATCH 02/10] addressing comments Signed-off-by: Sean Li --- .../public/ui/dataset_selector/configurator.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index afb1b6db061f..8d93a972fc99 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -19,7 +19,7 @@ import { import { i18n } from '@osd/i18n'; import { FormattedMessage } from '@osd/i18n/react'; import React, { useEffect, useState } from 'react'; -import { BaseDataset, Dataset, DatasetField } from '../../../common'; +import { BaseDataset, DEFAULT_DATA, Dataset, DatasetField } from '../../../common'; import { getIndexPatterns, getQueryService } from '../../services'; export const Configurator = ({ @@ -112,16 +112,17 @@ export const Configurator = ({ text: field.displayName || field.name, value: field.name, })), - { text: '-----', value: '', disabled: true }, - { text: 'No time field', value: undefined }, + { text: '-----', value: '-----', disabled: true }, + { text: 'I dont want to use time filter', value: '' }, ]} value={timeFieldName} onChange={(e) => { - const value = e.target.value === 'undefined' ? undefined : e.target.value; - setTimeFieldName(value); + setTimeFieldName(e.target.value); + const value = e.target.value === '' ? undefined : e.target.value; setDataset({ ...dataset, timeFieldName: value }); }} - disabled={dataset?.timeFieldName !== undefined} + hasNoInitialSelection={dataset.type === DEFAULT_DATA.SET_TYPES.INDEX} + disabled={dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN} /> )} @@ -166,7 +167,7 @@ export const Configurator = ({ onConfirm(dataset); }} fill - disabled={timeFields && timeFields.length > 0 && timeFieldName === undefined} + disabled={timeFieldName === undefined && dataset.type === DEFAULT_DATA.SET_TYPES.INDEX} > Date: Mon, 16 Sep 2024 18:51:13 -0700 Subject: [PATCH 03/10] fixing more bugs, adding no time field prop for unsupported languages Signed-off-by: Sean Li --- .../dataset_service/dataset_service.ts | 8 +--- .../dataset_service/lib/index_type.ts | 1 + .../query_string/language_service/types.ts | 1 + .../ui/dataset_selector/configurator.tsx | 37 ++++++++++++++++--- .../query_enhancements/public/plugin.tsx | 1 + 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/plugins/data/public/query/query_string/dataset_service/dataset_service.ts b/src/plugins/data/public/query/query_string/dataset_service/dataset_service.ts index 5f10b3d67193..2ea646c56abc 100644 --- a/src/plugins/data/public/query/query_string/dataset_service/dataset_service.ts +++ b/src/plugins/data/public/query/query_string/dataset_service/dataset_service.ts @@ -9,7 +9,6 @@ import { DataStructure, IndexPatternSpec, DEFAULT_DATA, - IFieldType, UI_SETTINGS, DataStorage, CachedDataStructure, @@ -64,14 +63,11 @@ export class DatasetService { public async cacheDataset(dataset: Dataset): Promise { const type = this.getType(dataset.type); - if (dataset) { + if (dataset && dataset.type !== DEFAULT_DATA.SET_TYPES.INDEX_PATTERN) { const spec = { id: dataset.id, title: dataset.title, - timeFieldName: { - name: dataset.timeFieldName, - type: 'date', - } as Partial, + timeFieldName: dataset.timeFieldName, fields: await type?.fetchFields(dataset), dataSourceRef: dataset.dataSource ? { diff --git a/src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts b/src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts index 2c7f4bbffb2e..cd2e45b8d25b 100644 --- a/src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts +++ b/src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts @@ -80,6 +80,7 @@ export const indexTypeConfig: DatasetTypeConfig = { return fields.map((field: any) => ({ name: field.name, type: field.type, + aggregatable: field?.aggregatable, })); }, 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 dff25464db08..c192b4cedf6e 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 @@ -52,4 +52,5 @@ export interface LanguageConfig { showDocLinks?: boolean; editorSupportedAppNames?: string[]; supportedAppNames?: string[]; + noTimeField?: boolean; } diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 8d93a972fc99..50d71e708851 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -41,8 +41,9 @@ export const Configurator = ({ const languages = type?.supportedLanguages(baseDataset) || []; const [dataset, setDataset] = useState(baseDataset); - const [timeFields, setTimeFields] = useState(); + const [timeFields, setTimeFields] = useState([]); const [timeFieldName, setTimeFieldName] = useState(dataset.timeFieldName); + const noTimeFilter = 'I dont want to use the time filter'; const [language, setLanguage] = useState(() => { const currentLanguage = queryString.getQuery().language; if (languages.includes(currentLanguage)) { @@ -51,6 +52,18 @@ export const Configurator = ({ return languages[0]; }); + const requiresTimeField = (ds: Dataset, lang: string, fields: DatasetField[]) => { + if ( + languageService.getLanguage(lang)?.noTimeField || + ds.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN + ) { + return false; + } + if (fields && fields.length > 0) { + return true; + } + }; + useEffect(() => { const fetchFields = async () => { const datasetFields = await queryString @@ -97,7 +110,20 @@ export const Configurator = ({ > - {timeFields && timeFields.length > 0 && ( + {dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN && + !languageService.getLanguage(language)?.noTimeField && ( + + + + )} + {requiresTimeField(dataset, language, timeFields) && ( { + const value = e.target.value === noTimeFilter ? undefined : e.target.value; setTimeFieldName(e.target.value); - const value = e.target.value === '' ? undefined : e.target.value; setDataset({ ...dataset, timeFieldName: value }); }} hasNoInitialSelection={dataset.type === DEFAULT_DATA.SET_TYPES.INDEX} - disabled={dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN} /> )} @@ -167,7 +192,7 @@ export const Configurator = ({ onConfirm(dataset); }} fill - disabled={timeFieldName === undefined && dataset.type === DEFAULT_DATA.SET_TYPES.INDEX} + disabled={timeFieldName === undefined && requiresTimeField(dataset, language, timeFields)} > Date: Tue, 17 Sep 2024 16:36:34 -0700 Subject: [PATCH 04/10] 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 c192b4cedf6e..6c6750fc33b8 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 @@ -52,5 +52,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) + } > Date: Fri, 20 Sep 2024 10:38:53 -0700 Subject: [PATCH 05/10] addressing comments Signed-off-by: Sean Li --- .../ui/dataset_selector/configurator.tsx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 0d652bb9cabe..46bd310e9a05 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -43,7 +43,7 @@ export const Configurator = ({ const [dataset, setDataset] = useState(baseDataset); const [timeFields, setTimeFields] = useState([]); const [timeFieldName, setTimeFieldName] = useState(dataset.timeFieldName); - const noTimeFilter = 'I dont want to use the time filter'; + const noTimeFilter = "I don't want to use the time filter"; const [language, setLanguage] = useState(() => { const currentLanguage = queryString.getQuery().language; if (languages.includes(currentLanguage)) { @@ -53,16 +53,14 @@ export const Configurator = ({ }); const displayTimeFieldSelector = (ds: Dataset, lang: string, fields: DatasetField[]) => { - if ( - languageService.getLanguage(lang)?.disableDatePicker || - ds.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN - ) { - return false; - } - if (fields && fields.length > 0) { - return true; - } - return false; + return ( + !( + languageService.getLanguage(lang)?.disableDatePicker || + ds.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN + ) && + fields && + fields.length > 0 + ); }; useEffect(() => { From 6d32a189c5d2b16cef890e7b016a3b20c69f9114 Mon Sep 17 00:00:00 2001 From: "opensearch-changeset-bot[bot]" <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:46:17 +0000 Subject: [PATCH 06/10] Changeset file for PR #8166 created/updated --- changelogs/fragments/8166.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/8166.yml diff --git a/changelogs/fragments/8166.yml b/changelogs/fragments/8166.yml new file mode 100644 index 000000000000..4a74935df5ef --- /dev/null +++ b/changelogs/fragments/8166.yml @@ -0,0 +1,2 @@ +fix: +- Fixes UI issues in Discover and data configurator ([#8166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8166)) \ No newline at end of file From 7473a8d995becbf8ace0cc2d4f9563dc8056966b Mon Sep 17 00:00:00 2001 From: Sean Li Date: Wed, 25 Sep 2024 17:30:49 -0700 Subject: [PATCH 07/10] adressing comments, renaming label Signed-off-by: Sean Li --- .../data/public/ui/dataset_selector/configurator.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 46bd310e9a05..addb30db0262 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -52,7 +52,7 @@ export const Configurator = ({ return languages[0]; }); - const displayTimeFieldSelector = (ds: Dataset, lang: string, fields: DatasetField[]) => { + const shouldDisplayTimeFieldSelector = (ds: Dataset, lang: string, fields: DatasetField[]) => { return ( !( languageService.getLanguage(lang)?.disableDatePicker || @@ -113,7 +113,7 @@ export const Configurator = ({ !languageService.getLanguage(language)?.disableDatePicker && ( )} - {displayTimeFieldSelector(dataset, language, timeFields) && ( + {shouldDisplayTimeFieldSelector(dataset, language, timeFields) && ( Date: Tue, 1 Oct 2024 18:20:57 -0700 Subject: [PATCH 08/10] addressing comments, adding tests Signed-off-by: Sean Li --- src/plugins/data/public/mocks.ts | 6 ++ .../dataset_service/dataset_service.test.ts | 33 +++++- .../query_string/language_service/types.ts | 2 +- .../ui/dataset_selector/configurator.tsx | 101 +++++++++--------- .../query_enhancements/public/plugin.tsx | 2 +- 5 files changed, 89 insertions(+), 55 deletions(-) diff --git a/src/plugins/data/public/mocks.ts b/src/plugins/data/public/mocks.ts index 2b5f30981c12..d838c983665d 100644 --- a/src/plugins/data/public/mocks.ts +++ b/src/plugins/data/public/mocks.ts @@ -91,6 +91,12 @@ const createStartContract = (isEnhancementsEnabled: boolean = false): Start => { }) ), clearCache: jest.fn(), + create: jest.fn().mockResolvedValue({ + id: 'test-index-pattern', + title: 'Test Index Pattern', + type: 'INDEX_PATTERN', + }), + saveToCache: jest.fn(), } as unknown) as IndexPatternsContract, dataSources: dataSourceServiceMock.createStartContract(), }; diff --git a/src/plugins/data/public/query/query_string/dataset_service/dataset_service.test.ts b/src/plugins/data/public/query/query_string/dataset_service/dataset_service.test.ts index 02b9eb0759fc..d994d3a7699a 100644 --- a/src/plugins/data/public/query/query_string/dataset_service/dataset_service.test.ts +++ b/src/plugins/data/public/query/query_string/dataset_service/dataset_service.test.ts @@ -5,15 +5,19 @@ import { DatasetService } from './dataset_service'; import { coreMock } from '../../../../../../core/public/mocks'; -import { DataStorage } from 'src/plugins/data/common'; +import { DEFAULT_DATA, DataStorage, Dataset } from 'src/plugins/data/common'; import { DataStructure } from '../../../../common'; import { IDataPluginServices } from '../../../types'; +import { indexPatternTypeConfig } from './lib'; +import { dataPluginMock } from '../../../mocks'; +import { IndexPatternsContract } from '../../..'; describe('DatasetService', () => { let service: DatasetService; let uiSettings: ReturnType['uiSettings']; let sessionStorage: DataStorage; let mockDataPluginServices: jest.Mocked; + let indexPatterns: IndexPatternsContract; beforeEach(() => { uiSettings = coreMock.createSetup().uiSettings; @@ -21,6 +25,8 @@ describe('DatasetService', () => { mockDataPluginServices = {} as jest.Mocked; service = new DatasetService(uiSettings, sessionStorage); + indexPatterns = dataPluginMock.createStartContract().indexPatterns; + service.init(indexPatterns); }); const mockResult = { @@ -98,4 +104,29 @@ describe('DatasetService', () => { expect(service.getLastCacheTime()).toEqual(time); }); + test('calling cacheDataset on dataset caches it', async () => { + const mockDataset = { + id: 'test-dataset', + title: 'Test Dataset', + type: mockType.id, + } as Dataset; + service.registerType(mockType); + + await service.cacheDataset(mockDataset); + expect(indexPatterns.create).toHaveBeenCalledTimes(1); + expect(indexPatterns.saveToCache).toHaveBeenCalledTimes(1); + }); + + test('calling cacheDataset on index pattern does not cache it', async () => { + service.registerType(indexPatternTypeConfig); + const mockDataset = { + id: 'test-index-pattern', + title: 'Test Index Pattern', + type: DEFAULT_DATA.SET_TYPES.INDEX_PATTERN, + } as Dataset; + + await service.cacheDataset(mockDataset); + expect(indexPatterns.create).toHaveBeenCalledTimes(0); + expect(indexPatterns.saveToCache).toHaveBeenCalledTimes(0); + }); }); 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 6c6750fc33b8..6fe7119789d4 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 @@ -52,5 +52,5 @@ export interface LanguageConfig { showDocLinks?: boolean; editorSupportedAppNames?: string[]; supportedAppNames?: string[]; - disableDatePicker?: boolean; + hideDatePicker?: boolean; } diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index addb30db0262..924a555ab576 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -18,7 +18,7 @@ import { } from '@elastic/eui'; import { i18n } from '@osd/i18n'; import { FormattedMessage } from '@osd/i18n/react'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { BaseDataset, DEFAULT_DATA, Dataset, DatasetField } from '../../../common'; import { getIndexPatterns, getQueryService } from '../../services'; @@ -52,16 +52,17 @@ export const Configurator = ({ return languages[0]; }); - const shouldDisplayTimeFieldSelector = (ds: Dataset, lang: string, fields: DatasetField[]) => { + const submitDisabled = useMemo(() => { return ( + timeFieldName === undefined && !( - languageService.getLanguage(lang)?.disableDatePicker || - ds.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN + languageService.getLanguage(language)?.hideDatePicker || + dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN ) && - fields && - fields.length > 0 + timeFields && + timeFields.length > 0 ); - }; + }, [dataset, language, timeFieldName, timeFields, languageService]); useEffect(() => { const fetchFields = async () => { @@ -109,47 +110,6 @@ export const Configurator = ({ > - {dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN && - !languageService.getLanguage(language)?.disableDatePicker && ( - - - - )} - {shouldDisplayTimeFieldSelector(dataset, language, timeFields) && ( - - ({ - text: field.displayName || field.name, - value: field.name, - })), - { text: '-----', value: '-----', disabled: true }, - { text: noTimeFilter, value: noTimeFilter }, - ]} - value={timeFieldName} - onChange={(e) => { - const value = e.target.value === noTimeFilter ? undefined : e.target.value; - setTimeFieldName(e.target.value); - setDataset({ ...dataset, timeFieldName: value }); - }} - hasNoInitialSelection={dataset.type !== DEFAULT_DATA.SET_TYPES.INDEX_PATTERN} - /> - - )} + {!languageService.getLanguage(language)?.hideDatePicker && + (dataset.type === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN ? ( + + + + ) : ( + + ({ + text: field.displayName || field.name, + value: field.name, + })), + { text: '-----', value: '-----', disabled: true }, + { text: noTimeFilter, value: noTimeFilter }, + ]} + value={timeFieldName} + onChange={(e) => { + const value = e.target.value === noTimeFilter ? undefined : e.target.value; + setTimeFieldName(e.target.value); + setDataset({ ...dataset, timeFieldName: value }); + }} + hasNoInitialSelection + /> + + ))} @@ -191,10 +191,7 @@ export const Configurator = ({ onConfirm(dataset); }} fill - disabled={ - timeFieldName === undefined && - shouldDisplayTimeFieldSelector(dataset, language, timeFields) - } + disabled={submitDisabled} > Date: Wed, 2 Oct 2024 17:08:48 -0700 Subject: [PATCH 09/10] updating snapshots Signed-off-by: Sean Li --- .../__snapshots__/dashboard_top_nav.test.tsx.snap | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap b/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap index 01c2616bf0ea..df0e5af66a0b 100644 --- a/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap +++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap @@ -315,6 +315,7 @@ exports[`Dashboard top nav render in embed mode 1`] = ` }, "indexPatterns": Object { "clearCache": [MockFunction], + "create": [MockFunction], "createField": [MockFunction], "createFieldList": [MockFunction], "ensureDefaultIndexPattern": [MockFunction], @@ -322,6 +323,7 @@ exports[`Dashboard top nav render in embed mode 1`] = ` "get": [MockFunction], "getDefault": [MockFunction], "make": [Function], + "saveToCache": [MockFunction], }, "query": Object { "addToQueryLog": [MockFunction], @@ -1380,6 +1382,7 @@ exports[`Dashboard top nav render in embed mode, and force hide filter bar 1`] = }, "indexPatterns": Object { "clearCache": [MockFunction], + "create": [MockFunction], "createField": [MockFunction], "createFieldList": [MockFunction], "ensureDefaultIndexPattern": [MockFunction], @@ -1387,6 +1390,7 @@ exports[`Dashboard top nav render in embed mode, and force hide filter bar 1`] = "get": [MockFunction], "getDefault": [MockFunction], "make": [Function], + "saveToCache": [MockFunction], }, "query": Object { "addToQueryLog": [MockFunction], @@ -2445,6 +2449,7 @@ exports[`Dashboard top nav render in embed mode, components can be forced show b }, "indexPatterns": Object { "clearCache": [MockFunction], + "create": [MockFunction], "createField": [MockFunction], "createFieldList": [MockFunction], "ensureDefaultIndexPattern": [MockFunction], @@ -2452,6 +2457,7 @@ exports[`Dashboard top nav render in embed mode, components can be forced show b "get": [MockFunction], "getDefault": [MockFunction], "make": [Function], + "saveToCache": [MockFunction], }, "query": Object { "addToQueryLog": [MockFunction], @@ -3510,6 +3516,7 @@ exports[`Dashboard top nav render in full screen mode with appended URL param bu }, "indexPatterns": Object { "clearCache": [MockFunction], + "create": [MockFunction], "createField": [MockFunction], "createFieldList": [MockFunction], "ensureDefaultIndexPattern": [MockFunction], @@ -3517,6 +3524,7 @@ exports[`Dashboard top nav render in full screen mode with appended URL param bu "get": [MockFunction], "getDefault": [MockFunction], "make": [Function], + "saveToCache": [MockFunction], }, "query": Object { "addToQueryLog": [MockFunction], @@ -4575,6 +4583,7 @@ exports[`Dashboard top nav render in full screen mode, no componenets should be }, "indexPatterns": Object { "clearCache": [MockFunction], + "create": [MockFunction], "createField": [MockFunction], "createFieldList": [MockFunction], "ensureDefaultIndexPattern": [MockFunction], @@ -4582,6 +4591,7 @@ exports[`Dashboard top nav render in full screen mode, no componenets should be "get": [MockFunction], "getDefault": [MockFunction], "make": [Function], + "saveToCache": [MockFunction], }, "query": Object { "addToQueryLog": [MockFunction], @@ -5640,6 +5650,7 @@ exports[`Dashboard top nav render with all components 1`] = ` }, "indexPatterns": Object { "clearCache": [MockFunction], + "create": [MockFunction], "createField": [MockFunction], "createFieldList": [MockFunction], "ensureDefaultIndexPattern": [MockFunction], @@ -5647,6 +5658,7 @@ exports[`Dashboard top nav render with all components 1`] = ` "get": [MockFunction], "getDefault": [MockFunction], "make": [Function], + "saveToCache": [MockFunction], }, "query": Object { "addToQueryLog": [MockFunction], From 542d89f0ce24d59fb67ebd41b3e9b15deb14fad9 Mon Sep 17 00:00:00 2001 From: Sean Li Date: Thu, 3 Oct 2024 15:49:24 -0700 Subject: [PATCH 10/10] adding i18n translation for no time filter option Signed-off-by: Sean Li --- .../data/public/ui/dataset_selector/configurator.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 924a555ab576..db1cb80dd6e3 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -43,7 +43,12 @@ export const Configurator = ({ const [dataset, setDataset] = useState(baseDataset); const [timeFields, setTimeFields] = useState([]); const [timeFieldName, setTimeFieldName] = useState(dataset.timeFieldName); - const noTimeFilter = "I don't want to use the time filter"; + const noTimeFilter = i18n.translate( + 'data.explorer.datasetSelector.advancedSelector.configurator.timeField.noTimeFieldOptionLabel', + { + defaultMessage: "I don't want to use the time filter", + } + ); const [language, setLanguage] = useState(() => { const currentLanguage = queryString.getQuery().language; if (languages.includes(currentLanguage)) {