From f99ae3a43eb572806ef4bb49be915a80c4826187 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 22 Sep 2022 07:44:33 -0600 Subject: [PATCH] fix: updated layout to incease the field width (#141084) (#141387) Fixes: #126083 Changed the layout of the Add Field popover so that field `Field` can have full width and users can see long index properties without any issue. Please see if new layout makes sense. This solves the width problem without any customization. |Old Layout| New Layout| |--|--| |![image](https://user-images.githubusercontent.com/7485038/191256799-b38b4e23-6bb0-492d-8908-bf63eeb7994c.png)|![image](https://user-images.githubusercontent.com/7485038/191256474-77263af3-e593-46a9-a31e-be54a9518f45.png)| (cherry picked from commit 2b4fc2ed9020078cfefd46b144559032f65d68cd) Co-authored-by: Jatin Kathuria --- .../components/edit_data_provider/index.tsx | 80 +++++++++---------- .../add_data_provider_popover.tsx | 7 +- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/x-pack/plugins/security_solution/public/timelines/components/edit_data_provider/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/edit_data_provider/index.tsx index 223a8f8cccd9f..38c27ba4a0d51 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/edit_data_provider/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/edit_data_provider/index.tsx @@ -36,8 +36,7 @@ import { import * as i18n from './translations'; const EDIT_DATA_PROVIDER_WIDTH = 400; -const FIELD_COMBO_BOX_WIDTH = 195; -const OPERATOR_COMBO_BOX_WIDTH = 160; +const OPERATOR_COMBO_BOX_WIDTH = 152; const SAVE_CLASS_NAME = 'edit-data-provider-save'; const VALUE_INPUT_CLASS_NAME = 'edit-data-provider-value'; @@ -189,25 +188,29 @@ export const StatefulEditDataProvider = React.memo( return ( + + + + + + - - - - - - + + - + + + ( placeholder={i18n.SELECT_AN_OPERATOR} selectedOptions={updatedOperator} singleSelection={{ asPlainText: true }} - style={{ width: `${OPERATOR_COMBO_BOX_WIDTH}px` }} + style={{ minWidth: OPERATOR_COMBO_BOX_WIDTH }} /> + {type !== DataProviderType.template && + updatedOperator.length > 0 && + updatedOperator[0].label !== i18n.EXISTS && + updatedOperator[0].label !== i18n.DOES_NOT_EXIST ? ( + + + + + + ) : null} @@ -228,27 +247,6 @@ export const StatefulEditDataProvider = React.memo( - {type !== DataProviderType.template && - updatedOperator.length > 0 && - updatedOperator[0].label !== i18n.EXISTS && - updatedOperator[0].label !== i18n.DOES_NOT_EXIST ? ( - - - - - - ) : null} - - - - - diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx index f6482217fb3bc..c2ea31c8fe6eb 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import styled from 'styled-components'; import { pick } from 'lodash/fp'; import React, { useCallback, useMemo, useState } from 'react'; import type { EuiContextMenuPanelItemDescriptor } from '@elastic/eui'; @@ -33,6 +34,10 @@ interface AddDataProviderPopoverProps { timelineId: string; } +const AddFieldPopoverContainer = styled.div` + min-width: 350px; +`; + const AddDataProviderPopoverComponent: React.FC = ({ browserFields, timelineId, @@ -205,7 +210,7 @@ const AddDataProviderPopoverComponent: React.FC = ( panelPaddingSize="none" repositionOnScroll > - {content} + {content} ); };