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..e2a9ea8cfb55 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,9 @@ exports[`Header renders application header without title and breadcrumbs 1`] = `
+
{renderRightControls()}
+
);
diff --git a/src/plugins/data/public/ui/filter_bar/_global_filter_group.scss b/src/plugins/data/public/ui/filter_bar/_global_filter_group.scss
index 598d2f57b3a4..a7f91f980d79 100644
--- a/src/plugins/data/public/ui/filter_bar/_global_filter_group.scss
+++ b/src/plugins/data/public/ui/filter_bar/_global_filter_group.scss
@@ -62,6 +62,11 @@
}
.globalFilterGroup__filterPrefix {
- padding-top: $euiSizeS;
- padding-right: $euiSizeS;
+ padding: $euiSizeM $euiSizeS 0 $euiSizeS;
+}
+
+.globalFilterGroup {
+ &--compressed {
+ margin-top: -$euiSizeS;
+ }
}
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..822f962698e2 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;
+ isFilterBarPortable?: boolean;
}
const maxFilterWidth = 600;
@@ -171,12 +173,15 @@ function FilterBarUI(props: Props) {
const classes = classNames('globalFilterBar', props.className);
const filterBarPrefixText = i18n.translate('data.search.filterBar.filterBarPrefixText', {
- defaultMessage: 'Filters: ',
+ defaultMessage: 'Filters',
+ });
+ const filterGroupClassName = classNames('globalFilterGroup', {
+ 'globalFilterGroup--compressed': useNewHeader && props.isFilterBarPortable,
});
- return (
+ const filterBar = (
)}
-
);
+ return useNewHeader && props.isFilterBarPortable
+ ? 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..b3b240dfa2f1 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}
+ isFilterBarPortable={props.isFilterBarPortable}
{...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..bb9a2c7eb28c 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;
+ isFilterBarPortable?: 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!}
+ isFilterBarPortable={this.props.isFilterBarPortable}
/>
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..ffc6656144f8 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
@@ -177,7 +177,7 @@ export function TopNavMenu(props: TopNavMenuProps): ReactElement | null {
{screenTitle}
{renderMenu(menuClassName)}
- {renderSearchBar()}
+ {renderSearchBar({ isFilterBarPortable: true })}
>