diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap
index 88f06ee9edcb..8a73c75af274 100644
--- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap
+++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap
@@ -9171,6 +9171,16 @@ exports[`Header renders application header without title and breadcrumbs 1`] = `
+
+
+
+
{renderRightControls()}
+
+
);
diff --git a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
index 431fd72c065f..2e9f375a3a33 100644
--- a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
+++ b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx
@@ -40,6 +40,7 @@ import {
import { FormattedMessage, InjectedIntl, injectI18n } from '@osd/i18n/react';
import classNames from 'classnames';
import React, { useState } from 'react';
+import { createPortal } from 'react-dom';
import { stringify } from '@osd/std';
import { FilterEditor } from './filter_editor';
@@ -55,6 +56,7 @@ interface Props {
className: string;
indexPatterns: IIndexPattern[];
intl: InjectedIntl;
+ fixFilterBar?: boolean;
}
const maxFilterWidth = 600;
@@ -171,10 +173,10 @@ function FilterBarUI(props: Props) {
const classes = classNames('globalFilterBar', props.className);
const filterBarPrefixText = i18n.translate('data.search.filterBar.filterBarPrefixText', {
- defaultMessage: 'Filters: ',
+ defaultMessage: 'Filters',
});
- return (
+ const filterBar = (
)}
-
);
+ return useNewHeader && !props.fixFilterBar
+ ? createPortal(filterBar, document.getElementById('applicationHeaderFilterBar')!)
+ : filterBar;
}
export const FilterBar = injectI18n(FilterBarUI);
diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
index b8671ea10559..d730474e4e96 100644
--- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
@@ -209,6 +209,7 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps)
onSavedQueryUpdated={defaultOnSavedQueryUpdated(props, setSavedQuery)}
onSaved={defaultOnSavedQueryUpdated(props, setSavedQuery)}
datePickerRef={props.datePickerRef}
+ fixFilterBar={props.fixFilterBar}
{...overrideDefaultBehaviors(props)}
/>
diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx
index b986a1e11ddd..c765fe80c27c 100644
--- a/src/plugins/data/public/ui/search_bar/search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx
@@ -66,6 +66,7 @@ export interface SearchBarOwnProps {
showQueryBar?: boolean;
showQueryInput?: boolean;
showFilterBar?: boolean;
+ fixFilterBar?: boolean;
showDatePicker?: boolean;
showAutoRefreshOnly?: boolean;
filters?: Filter[];
@@ -479,6 +480,7 @@ class SearchBarUI extends Component {
filters={this.props.filters!}
onFiltersUpdated={this.props.onFiltersUpdated}
indexPatterns={this.props.indexPatterns!}
+ fixFilterBar={this.props.fixFilterBar}
/>
diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx
index 49db1401c7ea..b353db5f5552 100644
--- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx
+++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx
@@ -216,7 +216,7 @@ export function TopNavMenu(props: TopNavMenuProps): ReactElement | null {
- {renderSearchBar({ datePickerRef })}
+ {renderSearchBar({ datePickerRef, fixFilterBar: true })}
>
);
}
@@ -226,7 +226,7 @@ export function TopNavMenu(props: TopNavMenuProps): ReactElement | null {
{renderMenu(menuClassName)}
- {renderSearchBar()}
+ {renderSearchBar({ fixFilterBar: true })}
>
);
}