From f296c0cf8cc11336bdc1fb95da1566fb6681a927 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Sat, 23 Nov 2024 09:45:40 +1100 Subject: [PATCH] [8.x] [Discover][Alerts] fix: add mobile width and fix title row wrap (#201354) (#201471) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover][Alerts] fix: add mobile width and fix title row wrap (#201354)](https://github.com/elastic/kibana/pull/201354) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Ania Kowalska <63072419+akowalska622@users.noreply.github.com> --- .../components/data_view_select_popover.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx b/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx index acb65de2a9a16..988afb8d2182b 100644 --- a/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx +++ b/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx @@ -8,6 +8,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; +import { css } from '@emotion/react'; import { EuiButtonEmpty, EuiButtonIcon, @@ -19,6 +20,7 @@ import { EuiPopoverTitle, EuiText, useEuiPaddingCSS, + useIsWithinBreakpoints, } from '@elastic/eui'; import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public'; import type { @@ -30,6 +32,9 @@ import { DataViewSelector } from '@kbn/unified-search-plugin/public'; import type { DataViewListItemEnhanced } from '@kbn/unified-search-plugin/public/dataview_picker/dataview_list'; import { EsQueryRuleMetaData } from '../es_query/types'; +const DESKTOP_WIDTH = 450; +const MOBILE_WIDTH = 350; + export interface DataViewSelectPopoverProps { dependencies: { dataViews: DataViewsPublicPluginStart; @@ -61,6 +66,8 @@ export const DataViewSelectPopover: React.FunctionComponent([]); const [dataViewPopoverOpen, setDataViewPopoverOpen] = useState(false); + const isMobile = useIsWithinBreakpoints(['xs']); + const closeDataViewEditor = useRef<() => void | undefined>(); const allDataViewItems = useMemo( @@ -179,9 +186,14 @@ export const DataViewSelectPopover: React.FunctionComponent -
+
- + {i18n.translate('xpack.stackAlerts.components.ui.alertParams.dataViewPopoverTitle', { defaultMessage: 'Data view',