From 19348988cfa1fca9a4ae6562f088b22a2f1a2884 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Thu, 1 Aug 2024 09:55:50 +0200 Subject: [PATCH] Move the switcher to the Discover menu --- .../src/text_based_languages_editor.tsx | 20 +--- packages/kbn-text-based-editor/src/types.ts | 4 - .../components/top_nav/get_top_nav_links.tsx | 55 ++++++++++ .../public/top_nav_menu/top_nav_menu_data.tsx | 2 + .../public/top_nav_menu/top_nav_menu_item.tsx | 8 +- .../dataview_picker/change_dataview.test.tsx | 15 --- .../dataview_picker/change_dataview.tsx | 61 +---------- .../dataview_picker/data_view_picker.tsx | 6 - .../esql_menu_popover.test.tsx | 67 ------------ .../dataview_picker/esql_menu_popover.tsx | 103 ------------------ .../query_string_input/query_bar_top_row.tsx | 4 - .../apps/discover/esql/_esql_view.ts | 4 - .../page_objects/unified_search_page.ts | 1 - .../common/discover/esql/_esql_view.ts | 4 - 14 files changed, 66 insertions(+), 288 deletions(-) delete mode 100644 src/plugins/unified_search/public/dataview_picker/esql_menu_popover.test.tsx delete mode 100644 src/plugins/unified_search/public/dataview_picker/esql_menu_popover.tsx diff --git a/packages/kbn-text-based-editor/src/text_based_languages_editor.tsx b/packages/kbn-text-based-editor/src/text_based_languages_editor.tsx index 77da74bb4c337..be5c050e7508b 100644 --- a/packages/kbn-text-based-editor/src/text_based_languages_editor.tsx +++ b/packages/kbn-text-based-editor/src/text_based_languages_editor.tsx @@ -75,9 +75,7 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({ allowQueryCancellation, hideTimeFilterInfo, hideQueryHistory, - isHelpMenuOpen, hasOutline, - setIsHelpMenuOpen, }: TextBasedLanguagesEditorProps) { const popoverRef = useRef(null); const datePickerOpenStatusRef = useRef(false); @@ -490,20 +488,6 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({ [esqlCallbacks] ); - const helpMenuPopoverProps = useMemo(() => { - if (setIsHelpMenuOpen) { - return { - isHelpMenuOpen: isHelpMenuOpen ?? false, - setIsHelpMenuOpen, - }; - } - - return { - isHelpMenuOpen: isLanguagePopoverOpen, - setIsHelpMenuOpen: setIsLanguagePopoverOpen, - }; - }, [isHelpMenuOpen, isLanguagePopoverOpen, setIsHelpMenuOpen]); - const onErrorClick = useCallback(({ startLineNumber, startColumn }: MonacoMessage) => { if (!editor1.current) { return; @@ -718,8 +702,8 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({ measuredContainerWidth={measuredEditorWidth} hideQueryHistory={hideHistoryComponent} refetchHistoryItems={refetchHistoryItems} - isHelpMenuOpen={helpMenuPopoverProps.isHelpMenuOpen} - setIsHelpMenuOpen={helpMenuPopoverProps.setIsHelpMenuOpen} + isHelpMenuOpen={isLanguagePopoverOpen} + setIsHelpMenuOpen={setIsLanguagePopoverOpen} /> Promise; - /** inline docs popover status, controlled from outside the editor **/ - isHelpMenuOpen?: boolean; - /** sets the inline docs popover status, controlled from outside the editor **/ - setIsHelpMenuOpen?: (status: boolean) => void; /** If it is true, the editor displays the message @timestamp found * The text based queries are relying on adhoc dataviews which * can have an @timestamp timefield or nothing diff --git a/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.tsx b/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.tsx index a25e10ce3b0be..3103a4985b2f9 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.tsx @@ -11,8 +11,11 @@ import type { DataView } from '@kbn/data-views-plugin/public'; import type { TopNavMenuData } from '@kbn/navigation-plugin/public'; import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public'; import { omit } from 'lodash'; +import { METRIC_TYPE } from '@kbn/analytics'; +import { getInitialESQLQuery, ENABLE_ESQL } from '@kbn/esql-utils'; import type { DiscoverAppLocatorParams } from '../../../../../common'; import { showOpenSearchPanel } from './show_open_search_panel'; +import { DataSourceType } from '../../../../../common/data_sources'; import { getSharingData, showPublicUrlSwitch } from '../../../../utils/get_sharing_data'; import { DiscoverServices } from '../../../../build_services'; import { onSaveSearch } from './on_save_search'; @@ -60,6 +63,54 @@ export const getTopNavLinks = ({ testId: 'discoverAlertsButton', }; + const esqLToggle = { + id: 'esql', + label: isEsqlMode + ? i18n.translate('discover.localMenu.localMenu.switchToClassicTitle', { + defaultMessage: 'Switch to classic', + }) + : i18n.translate('discover.localMenu.localMenu.tryESQLTitle', { + defaultMessage: 'Try ES|QL', + }), + emphasize: true, + iconType: 'editorRedo', + description: isEsqlMode + ? i18n.translate('discover.localMenu.localMenu.switchToClassicTitle', { + defaultMessage: 'Switch to classic', + }) + : i18n.translate('discover.localMenu.tryESQLDescription', { + defaultMessage: 'Try ES|QL', + }), + fill: false, + color: 'text', + run: () => { + if (dataView) { + if (isEsqlMode) { + state.appState.update({ + query: { + language: 'kuery', + query: '', + }, + dataSource: { + type: DataSourceType.DataView, + dataViewId: dataView.id ?? '', + }, + }); + } else { + const queryString = getInitialESQLQuery(dataView?.getIndexPattern()); + state.appState.update({ + query: { esql: queryString }, + dataSource: { + type: DataSourceType.Esql, + }, + }); + services.trackUiMetric?.(METRIC_TYPE.CLICK, `esql:try_btn_clicked`); + } + } + }, + testId: isEsqlMode ? 'switch-to-dataviews' : 'select-text-based-language-btn', + }; + const newSearch = { id: 'new', label: i18n.translate('discover.localMenu.localMenu.newSearchTitle', { @@ -226,6 +277,10 @@ export const getTopNavLinks = ({ const defaultMenu = topNavCustomization?.defaultMenu; const entries = [...(topNavCustomization?.getMenuItems?.() ?? [])]; + if (services.uiSettings.get(ENABLE_ESQL)) { + entries.push({ data: esqLToggle, order: 0 }); + } + if (!defaultMenu?.newItem?.disabled) { entries.push({ data: newSearch, order: defaultMenu?.newItem?.order ?? 100 }); } diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx index 2c8fc1e58d934..050fb788a7870 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_data.tsx @@ -22,6 +22,8 @@ export interface TopNavMenuData { tooltip?: string | (() => string | undefined); badge?: EuiBetaBadgeProps; emphasize?: boolean; + fill?: boolean; + color?: string; isLoading?: boolean; iconType?: string; iconSide?: EuiButtonProps['iconSide']; diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx index 495e5c4ac9593..d52878aad8491 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.tsx @@ -8,7 +8,7 @@ import { upperFirst, isFunction } from 'lodash'; import React, { MouseEvent } from 'react'; -import { EuiToolTip, EuiButton, EuiHeaderLink, EuiBetaBadge } from '@elastic/eui'; +import { EuiToolTip, EuiButton, EuiHeaderLink, EuiBetaBadge, EuiButtonColor } from '@elastic/eui'; import { TopNavMenuData } from './top_nav_menu_data'; export function TopNavMenuItem(props: TopNavMenuData) { @@ -48,6 +48,8 @@ export function TopNavMenuItem(props: TopNavMenuData) { iconSide: props.iconSide, 'data-test-subj': props.testId, className: props.className, + color: (props.color ?? 'primary') as EuiButtonColor, + fill: props.fill ?? true, }; // If the item specified a href, then override the suppress the onClick @@ -58,11 +60,11 @@ export function TopNavMenuItem(props: TopNavMenuData) { : {}; const btn = props.emphasize ? ( - + {getButtonContainer()} ) : ( - + {getButtonContainer()} ); diff --git a/src/plugins/unified_search/public/dataview_picker/change_dataview.test.tsx b/src/plugins/unified_search/public/dataview_picker/change_dataview.test.tsx index c5a2d85f14f64..551d8ad99ef63 100644 --- a/src/plugins/unified_search/public/dataview_picker/change_dataview.test.tsx +++ b/src/plugins/unified_search/public/dataview_picker/change_dataview.test.tsx @@ -14,7 +14,6 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { indexPatternEditorPluginMock as dataViewEditorPluginMock } from '@kbn/data-view-editor-plugin/public/mocks'; -import { TextBasedLanguages } from '@kbn/esql-utils'; import { ChangeDataView } from './change_dataview'; import { DataViewSelector } from './data_view_selector'; import { dataViewMock, dataViewMockEsql } from './mocks/dataview'; @@ -133,20 +132,6 @@ describe('DataView component', () => { expect(addDataViewSpy).toHaveBeenCalled(); }); - it('should render the text based languages button if languages are given', async () => { - const component = mount( - wrapDataViewComponentInContext( - { - ...props, - textBasedLanguages: [TextBasedLanguages.ESQL], - }, - false - ) - ); - const text = component.find('[data-test-subj="select-text-based-language-btn"]'); - expect(text.length).not.toBe(0); - }); - it('should properly handle ad hoc data views', async () => { const component = mount( wrapDataViewComponentInContext( diff --git a/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx b/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx index 9f8a3d403f4f7..9f0302d3cb2ba 100644 --- a/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx +++ b/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx @@ -12,7 +12,6 @@ import { css } from '@emotion/react'; import { EuiPopover, EuiHorizontalRule, - EuiButton, EuiContextMenuPanel, EuiContextMenuItem, useEuiTheme, @@ -24,10 +23,8 @@ import { EuiFlexItem, EuiButtonEmpty, } from '@elastic/eui'; -import { METRIC_TYPE } from '@kbn/analytics'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { AggregateQuery, getLanguageDisplayName } from '@kbn/es-query'; -import { getInitialESQLQuery } from '@kbn/esql-utils'; +import { getLanguageDisplayName } from '@kbn/es-query'; import type { DataView } from '@kbn/data-views-plugin/public'; import type { IUnifiedSearchPluginServices } from '../types'; import { type DataViewPickerPropsExtended } from './data_view_picker'; @@ -36,7 +33,6 @@ import type { TextBasedLanguagesTransitionModalProps } from './text_languages_tr import adhoc from './assets/adhoc.svg'; import { changeDataViewStyles } from './change_dataview.styles'; import { DataViewSelector } from './data_view_selector'; -import { ESQLMenuPopover } from './esql_menu_popover'; // local storage key for the text based languages transition modal const TEXT_LANG_TRANSITION_MODAL_KEY = 'data.textLangTransitionModal'; @@ -74,7 +70,6 @@ export function ChangeDataView({ onDataViewCreated, trigger, selectableProps, - textBasedLanguages, onSaveTextLanguageQuery, onTextLangQuerySubmit, textBasedLanguage, @@ -82,7 +77,6 @@ export function ChangeDataView({ isDisabled, onEditDataView, onCreateDefaultAdHocDataView, - openESQLInlineDocs, }: DataViewPickerPropsExtended) { const { euiTheme } = useEuiTheme(); const [isPopoverOpen, setPopoverIsOpen] = useState(false); @@ -95,9 +89,7 @@ export function ChangeDataView({ const [selectedDataViewId, setSelectedDataViewId] = useState(currentDataViewId); const kibana = useKibana(); - const { application, data, storage, dataViews, dataViewEditor, appName, usageCollection } = - kibana.services; - const reportUiCounter = usageCollection?.reportUiCounter.bind(usageCollection, appName); + const { application, data, storage, dataViews, dataViewEditor } = kibana.services; const styles = changeDataViewStyles({ fullWidth: trigger.fullWidth, @@ -296,15 +288,6 @@ export function ChangeDataView({ setIsTextLangTransitionModalDismissed(true); }, [storage]); - const onTextBasedSubmit = useCallback( - (q: AggregateQuery) => { - onTextLangQuerySubmit?.(q); - setPopoverIsOpen(false); - reportUiCounter?.(METRIC_TYPE.CLICK, `esql:unified_search_clicked`); - }, - [onTextLangQuerySubmit, reportUiCounter] - ); - const cleanup = useCallback( (shouldDismissModal: boolean) => { setIsTextLangTransitionModalVisible(false); @@ -365,22 +348,6 @@ export function ChangeDataView({ {!isTextBasedLangSelected && ( <> - {textBasedLanguages?.length && ( - - { - onTextBasedSubmit({ esql: getInitialESQLQuery(trigger.title!) }); - }} - data-test-subj="select-text-based-language-btn" - > - {i18n.translate('unifiedSearch.query.queryBar.textBasedLanguagesTryLabel', { - defaultMessage: 'Try ES|QL', - })} - - - )} )} - {isTextBasedLangSelected && ( - { - const showTransitionModal = - !isTextLangTransitionModalDismissed && shouldShowTextBasedLanguageTransitionModal; - - if (showTransitionModal) { - setIsTextLangTransitionModalVisible(true); - } else { - setIsTextBasedLangSelected(false); - // clean up the Text based language query - onTextLangQuerySubmit?.({ - language: 'kuery', - query: '', - }); - if (selectedDataViewId) { - onChangeDataView(selectedDataViewId); - } - setTriggerLabel(trigger.label); - } - }} - openESQLInlineDocs={openESQLInlineDocs} - /> - )} {modal} diff --git a/src/plugins/unified_search/public/dataview_picker/data_view_picker.tsx b/src/plugins/unified_search/public/dataview_picker/data_view_picker.tsx index 00cc834fe76eb..79b541f69f1ea 100644 --- a/src/plugins/unified_search/public/dataview_picker/data_view_picker.tsx +++ b/src/plugins/unified_search/public/dataview_picker/data_view_picker.tsx @@ -90,10 +90,6 @@ export interface DataViewPickerProps { * Makes the picker disabled by disabling the popover trigger */ isDisabled?: boolean; - /** - * Opens the ESQL inline docs - */ - openESQLInlineDocs?: () => void; } export interface DataViewPickerPropsExtended extends DataViewPickerProps { @@ -125,7 +121,6 @@ export const DataViewPicker = ({ shouldShowTextBasedLanguageTransitionModal, onCreateDefaultAdHocDataView, isDisabled, - openESQLInlineDocs, }: DataViewPickerPropsExtended) => { return ( ); }; diff --git a/src/plugins/unified_search/public/dataview_picker/esql_menu_popover.test.tsx b/src/plugins/unified_search/public/dataview_picker/esql_menu_popover.test.tsx deleted file mode 100644 index cf55dda78f05e..0000000000000 --- a/src/plugins/unified_search/public/dataview_picker/esql_menu_popover.test.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { screen, render, fireEvent } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; -import { coreMock } from '@kbn/core/public/mocks'; -import { ESQLMenuPopover, type ESQLMenuPopoverProps } from './esql_menu_popover'; - -describe('ESQLMenuPopover', () => { - let defaultProps: ESQLMenuPopoverProps; - - beforeEach(() => { - defaultProps = { - onDataViewSwitch: jest.fn(), - openESQLInlineDocs: jest.fn(), - }; - }); - const renderESQLPopover = () => { - const startMock = coreMock.createStart(); - const services = { - docLinks: startMock.docLinks, - }; - return render( - - {' '} - - ); - }; - - it('should render a button', () => { - renderESQLPopover(); - expect(screen.getByTestId('esql-menu-button')).toBeInTheDocument(); - }); - - it('should open a menu when the popover is open', () => { - renderESQLPopover(); - expect(screen.getByTestId('esql-menu-button')).toBeInTheDocument(); - userEvent.click(screen.getByRole('button')); - - expect(screen.getByTestId('esql-open-docs')).toBeInTheDocument(); - expect(screen.getByTestId('esql-about')).toBeInTheDocument(); - expect(screen.getByTestId('switch-to-dataviews')).toBeInTheDocument(); - }); - - it('should call the onDataViewSwitch prop if the switch dataviews CTA is clicked', () => { - renderESQLPopover(); - expect(screen.getByTestId('esql-menu-button')).toBeInTheDocument(); - userEvent.click(screen.getByRole('button')); - fireEvent.click(screen.getByTestId('switch-to-dataviews')); - expect(defaultProps.onDataViewSwitch).toHaveBeenCalled(); - }); - - it('should call the openESQLInlineDocs prop if the open docs CTA is clicked', () => { - renderESQLPopover(); - expect(screen.getByTestId('esql-menu-button')).toBeInTheDocument(); - userEvent.click(screen.getByRole('button')); - fireEvent.click(screen.getByTestId('esql-open-docs')); - expect(defaultProps.openESQLInlineDocs).toHaveBeenCalled(); - }); -}); diff --git a/src/plugins/unified_search/public/dataview_picker/esql_menu_popover.tsx b/src/plugins/unified_search/public/dataview_picker/esql_menu_popover.tsx deleted file mode 100644 index b5ea73987ad6b..0000000000000 --- a/src/plugins/unified_search/public/dataview_picker/esql_menu_popover.tsx +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React, { useMemo, useState } from 'react'; -import { - EuiPopover, - EuiButtonIcon, - EuiContextMenuPanel, - type EuiContextMenuPanelProps, - EuiContextMenuItem, - EuiHorizontalRule, -} from '@elastic/eui'; -import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { i18n } from '@kbn/i18n'; -import type { IUnifiedSearchPluginServices } from '../types'; - -export interface ESQLMenuPopoverProps { - onDataViewSwitch: () => void; - openESQLInlineDocs?: () => void; -} - -export const ESQLMenuPopover = ({ onDataViewSwitch, openESQLInlineDocs }: ESQLMenuPopoverProps) => { - const kibana = useKibana(); - - const { docLinks } = kibana.services; - const [isESQLMenuPopoverOpen, setIsESQLMenuPopoverOpen] = useState(false); - const esqlPanelItems = useMemo(() => { - const panelItems: EuiContextMenuPanelProps['items'] = []; - if (openESQLInlineDocs) { - panelItems.push( - { - openESQLInlineDocs?.(); - setIsESQLMenuPopoverOpen(false); - }} - > - {i18n.translate('unifiedSearch.query.queryBar.esqlMenu.openDocs', { - defaultMessage: 'Open docs', - })} - - ); - } - panelItems.push( - - {i18n.translate('unifiedSearch.query.queryBar.esqlMenu.aboutESQL', { - defaultMessage: 'About ES|QL', - })} - , - , - { - onDataViewSwitch(); - setIsESQLMenuPopoverOpen(false); - }} - > - {i18n.translate('unifiedSearch.query.queryBar.esqlMenu.switchToDataviews', { - defaultMessage: 'Switch to data views', - })} - - ); - return panelItems; - }, [docLinks?.links?.query?.queryESQL, onDataViewSwitch, openESQLInlineDocs]); - - return ( - setIsESQLMenuPopoverOpen(!isESQLMenuPopoverOpen)} - data-test-subj="esql-menu-button" - /> - } - panelProps={{ - ['data-test-subj']: 'esql-menu-popover', - }} - isOpen={isESQLMenuPopoverOpen} - closePopover={() => setIsESQLMenuPopoverOpen(false)} - panelPaddingSize="none" - display="block" - > - - - ); -}; diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx index 5fd1f562fa2be..cd69a1cbe66ff 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx @@ -235,7 +235,6 @@ export const QueryBarTopRow = React.memo( ) { const isMobile = useIsWithinBreakpoints(['xs', 's']); const [isXXLarge, setIsXXLarge] = useState(false); - const [isESQLInlineDocsOpen, setIsESQLInlineDocsOpen] = useState(false); const submitButtonStyle: QueryBarTopRowProps['submitButtonStyle'] = props.submitButtonStyle ?? 'auto'; const submitButtonIconOnly = @@ -642,7 +641,6 @@ export const QueryBarTopRow = React.memo( textBasedLanguage={textBasedLanguage} onSaveTextLanguageQuery={props.onTextBasedSavedAndExit} isDisabled={props.isDisabled} - openESQLInlineDocs={() => setIsESQLInlineDocsOpen(true)} /> ); @@ -754,8 +752,6 @@ export const QueryBarTopRow = React.memo( hideRunQueryText={true} data-test-subj="unifiedTextLangEditor" isLoading={props.isLoading} - isHelpMenuOpen={isESQLInlineDocsOpen} - setIsHelpMenuOpen={setIsESQLInlineDocsOpen} /> ) ); diff --git a/test/functional/apps/discover/esql/_esql_view.ts b/test/functional/apps/discover/esql/_esql_view.ts index 537a0358dd7c2..b1a2948057f56 100644 --- a/test/functional/apps/discover/esql/_esql_view.ts +++ b/test/functional/apps/discover/esql/_esql_view.ts @@ -253,7 +253,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discover.selectTextBaseLang(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await retry.try(async () => { await testSubjects.existOrFail('unifiedSearch_switch_modal'); @@ -267,7 +266,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('querySubmitButton'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await retry.try(async () => { await testSubjects.existOrFail('unifiedSearch_switch_modal'); @@ -279,7 +277,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.missingOrFail('unifiedSearch_switch_modal'); }); await PageObjects.discover.saveSearch('esql_test'); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await testSubjects.missingOrFail('unifiedSearch_switch_modal'); }); @@ -294,7 +291,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('querySubmitButton'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await retry.try(async () => { await testSubjects.existOrFail('unifiedSearch_switch_modal'); diff --git a/test/functional/page_objects/unified_search_page.ts b/test/functional/page_objects/unified_search_page.ts index da66316c749a0..cd8058234bbc8 100644 --- a/test/functional/page_objects/unified_search_page.ts +++ b/test/functional/page_objects/unified_search_page.ts @@ -44,7 +44,6 @@ export class UnifiedSearchPageObject extends FtrService { } public async switchToDataViewMode() { - await this.testSubjects.click('esql-menu-button'); await this.testSubjects.click('switch-to-dataviews'); await this.testSubjects.click('unifiedSearch_switch_noSave'); } diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts b/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts index 3a0287a17e310..766e9e2a03e49 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts @@ -260,7 +260,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discover.selectTextBaseLang(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await retry.try(async () => { await testSubjects.existOrFail('unifiedSearch_switch_modal'); @@ -274,7 +273,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('querySubmitButton'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await retry.try(async () => { await testSubjects.existOrFail('unifiedSearch_switch_modal'); @@ -286,7 +284,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.missingOrFail('unifiedSearch_switch_modal'); }); await PageObjects.discover.saveSearch('esql_test'); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await testSubjects.missingOrFail('unifiedSearch_switch_modal'); }); @@ -301,7 +298,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('querySubmitButton'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - await testSubjects.click('esql-menu-button'); await testSubjects.click('switch-to-dataviews'); await retry.try(async () => { await testSubjects.existOrFail('unifiedSearch_switch_modal');