diff --git a/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx b/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx index 2c243814a82b7..bf2326604c308 100644 --- a/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx +++ b/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx @@ -446,6 +446,11 @@ storiesOf('SearchBar', module) }, } as unknown as SearchBarProps) ) + .add('without switch query language', () => + wrapSearchBarInContext({ + disableQueryLanguageSwitcher: true, + } as SearchBarProps) + ) .add('show only query bar without submit', () => wrapSearchBarInContext({ showDatePicker: false, diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_menu.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_menu.tsx index 9ba28c72c47e3..553354f7b4a34 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_menu.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_menu.tsx @@ -47,6 +47,7 @@ export interface QueryBarMenuProps extends WithCloseFilterEditorConfirmModalProp toggleFilterBarMenuPopover: (value: boolean) => void; openQueryBarMenu: boolean; nonKqlMode?: 'lucene' | 'text'; + disableQueryLanguageSwitcher?: boolean; dateRangeFrom?: string; dateRangeTo?: string; savedQueryService: SavedQueryService; @@ -72,6 +73,7 @@ export interface QueryBarMenuProps extends WithCloseFilterEditorConfirmModalProp function QueryBarMenuComponent({ language, nonKqlMode, + disableQueryLanguageSwitcher, dateRangeFrom, dateRangeTo, onQueryChange, @@ -158,6 +160,7 @@ function QueryBarMenuComponent({ manageFilterSetComponent, hiddenPanelOptions, nonKqlMode, + disableQueryLanguageSwitcher, closePopover: plainClosePopover, onQueryBarSubmit, onFiltersUpdated, diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_menu_panels.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_menu_panels.tsx index d7c8bd8b64a45..4479be2c9281b 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_menu_panels.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_menu_panels.tsx @@ -147,6 +147,7 @@ export interface QueryBarMenuPanelsProps { manageFilterSetComponent?: JSX.Element; hiddenPanelOptions?: FilterPanelOption[]; nonKqlMode?: 'lucene' | 'text'; + disableQueryLanguageSwitcher?: boolean; closePopover: () => void; onQueryBarSubmit: (payload: { dateRange: TimeRange; query?: Query }) => void; onFiltersUpdated?: (filters: Filter[]) => void; @@ -170,6 +171,7 @@ export function QueryBarMenuPanels({ manageFilterSetComponent, hiddenPanelOptions, nonKqlMode, + disableQueryLanguageSwitcher = false, closePopover, onQueryBarSubmit, onFiltersUpdated, @@ -384,7 +386,7 @@ export function QueryBarMenuPanels({ } // language menu appears when the showQueryInput is true - if (showQueryInput) { + if (showQueryInput && !disableQueryLanguageSwitcher) { items.push({ name: `Language: ${language === 'kuery' ? kqlLabel : luceneLabel}`, panel: 3, diff --git a/src/plugins/unified_search/public/search_bar/search_bar.tsx b/src/plugins/unified_search/public/search_bar/search_bar.tsx index 3326d81e29109..f95ed07c8d938 100644 --- a/src/plugins/unified_search/public/search_bar/search_bar.tsx +++ b/src/plugins/unified_search/public/search_bar/search_bar.tsx @@ -87,6 +87,7 @@ export interface SearchBarOwnProps { isClearable?: boolean; iconType?: EuiIconProps['type']; nonKqlMode?: 'lucene' | 'text'; + disableQueryLanguageSwitcher?: boolean; // defines padding and border; use 'inPage' to avoid any padding or border; // use 'detached' if the searchBar appears at the very top of the view, without any wrapper displayStyle?: 'inPage' | 'detached'; @@ -472,6 +473,7 @@ class SearchBarUI extends C const queryBarMenu = this.props.showQueryMenu ? ( = (