Skip to content

Commit c2c7528

Browse files
committed
fix MultiCellPopover styles and add vertical divider to flyout description items
1 parent c2d1e28 commit c2c7528

5 files changed

Lines changed: 55 additions & 24 deletions

File tree

src/platform/packages/shared/kbn-grouping/src/containers/query/helpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const createGroupFilter = (
2424
multiValueFields?: string[]
2525
): StrictFilter[] => {
2626
const shouldIgnoreFieldSize = checkIsFlattenResults(selectedGroup, multiValueFields);
27-
2827
return values != null && values.length > 0
2928
? values.reduce(
3029
(acc: StrictFilter[], query) => [

x-pack/solutions/security/packages/kbn-cloud-security-posture/public/src/components/multi_value_cell_popover.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const MultiValueCellPopoverComponent = <T, K = string>({
4545
const closePopover = () => setIsPopoverOpen(false);
4646

4747
return (
48-
<EuiFlexGroup responsive={false} gutterSize="xs" alignItems="center">
48+
<EuiFlexGroup responsive={true} gutterSize="xs" alignItems="center">
4949
<EuiFlexItem grow={false}>
5050
{firstItemRenderer ? (
5151
firstItemRenderer(items[0])
@@ -72,6 +72,7 @@ const MultiValueCellPopoverComponent = <T, K = string>({
7272
closePopover={closePopover}
7373
panelPaddingSize="s"
7474
repositionOnScroll
75+
panelStyle={{ minWidth: 'min-content' }}
7576
>
7677
<EuiFlexGroup
7778
direction="column"
@@ -85,6 +86,7 @@ const MultiValueCellPopoverComponent = <T, K = string>({
8586
overflow-y: auto;
8687
max-width: min-content;
8788
width: min-content;
89+
min-width: unset;
8890
padding-right: ${euiTheme.size.s};
8991
`}
9092
>

x-pack/solutions/security/plugins/cloud_security_posture/public/components/csp_inline_description_list.tsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,31 @@ import React from 'react';
99
import { EuiDescriptionList, useEuiTheme } from '@elastic/eui';
1010
import type { EuiDescriptionListProps } from '@elastic/eui';
1111
import { CopyButton } from './copy_button';
12+
import { useFlyoutStyles } from './use_flyout_styles';
1213

13-
const getModifiedTitlesListItems = (listItems?: EuiDescriptionListProps['listItems']) =>
14-
listItems
15-
?.filter((item) => !!item?.title && !!item?.description)
16-
.map((item) => ({
17-
...item,
18-
title: `${item.title}:`,
19-
description:
20-
typeof item.description === 'string' ? (
14+
const getModifiedTitlesListItems = (
15+
listItems?: EuiDescriptionListProps['listItems'],
16+
dividerStyles?: string
17+
) => {
18+
const filteredItems = listItems?.filter((item) => !!item?.title && !!item?.description) || [];
19+
20+
return filteredItems.map((item, index) => ({
21+
...item,
22+
title: `${item.title}:`,
23+
description: (
24+
<>
25+
{typeof item.description === 'string' ? (
2126
<span>
2227
{item.description} <CopyButton copyText={item.description} />
2328
</span>
2429
) : (
2530
item.description
26-
),
27-
}));
31+
)}
32+
{index < filteredItems.length - 1 && <span className={dividerStyles} />}
33+
</>
34+
),
35+
}));
36+
};
2837

2938
// eui size m is 12px which is too small, and next after it is base which is 16px which is too big
3039
const fontSize = '1rem';
@@ -37,7 +46,8 @@ export const CspInlineDescriptionList = ({
3746
listItems: EuiDescriptionListProps['listItems'];
3847
}) => {
3948
const { euiTheme } = useEuiTheme();
40-
const modifiedTitlesListItems = getModifiedTitlesListItems(listItems);
49+
const { inlineDescriptionListStyle } = useFlyoutStyles();
50+
const modifiedTitlesListItems = getModifiedTitlesListItems(listItems, inlineDescriptionListStyle);
4151
return (
4252
<EuiDescriptionList
4353
data-test-subj={testId}
@@ -49,6 +59,8 @@ export const CspInlineDescriptionList = ({
4959
fontSize,
5060
paddingRight: 0,
5161
paddingInline: 0,
62+
marginInline: 'unset',
63+
marginInlineEnd: euiTheme.size.xs,
5264
},
5365
}}
5466
descriptionProps={{
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { useEuiTheme } from '@elastic/eui';
9+
import { css } from '@emotion/css';
10+
11+
export const useFlyoutStyles = () => {
12+
const { euiTheme } = useEuiTheme();
13+
14+
const inlineDescriptionListStyle = css`
15+
border-left: ${euiTheme.border.width.thick} solid ${euiTheme.colors.textSubdued};
16+
margin-left: 4px;
17+
margin-right: 4px;
18+
display: inline-block;
19+
vertical-align: middle;
20+
height: calc(${euiTheme.size.m} + ${euiTheme.size.s});
21+
`;
22+
23+
return {
24+
inlineDescriptionListStyle,
25+
};
26+
};

x-pack/solutions/security/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,7 @@ export const VulnerabilityOverviewTab = ({ vulnerabilityRecord }: VulnerabilityT
270270
return <EuiText>{emptyFixesMessageState}</EuiText>;
271271
}
272272
return (
273-
<EuiFlexGroup
274-
responsive={false}
275-
gutterSize="xs"
276-
alignItems="flexStart"
277-
direction="column"
278-
css={css`
279-
gap: ${euiTheme.size.s};
280-
`}
281-
>
273+
<EuiFlexGroup responsive={false} gutterSize="xs" alignItems="flexStart" direction="column">
282274
<EuiFlexItem>
283275
<EuiFlexGroup
284276
responsive={false}
@@ -321,8 +313,8 @@ export const VulnerabilityOverviewTab = ({ vulnerabilityRecord }: VulnerabilityT
321313
css={css`
322314
font-weight: ${euiTheme.font.weight.medium};
323315
`}
324-
id="xpack.csp.vulnerabilities.vulnerabilitiesFindingFlyout.flyoutDescriptionList.fixedVersionTitle"
325-
defaultMessage="Fixed version"
316+
id="xpack.csp.vulnerabilities.vulnerabilitiesFindingFlyout.flyoutDescriptionList.versionTitle"
317+
defaultMessage="Version"
326318
/>
327319
:
328320
</EuiText>

0 commit comments

Comments
 (0)