Skip to content

Commit 9e99f73

Browse files
authored
[SECURITY_SOLUTION][ENDPOINT] Fix Policy Details Name to ensure it truncates the value when its too long (#71526)
* Fix title not truncated on policy details
1 parent b217cb3 commit 9e99f73

File tree

3 files changed

+58
-13
lines changed

3 files changed

+58
-13
lines changed

x-pack/plugins/security_solution/public/common/components/endpoint/__snapshots__/page_view.test.tsx.snap

Lines changed: 40 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/security_solution/public/common/components/endpoint/page_view.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
EuiTab,
1818
EuiTabs,
1919
EuiTitle,
20+
EuiTitleProps,
2021
} from '@elastic/eui';
2122
import React, { memo, MouseEventHandler, ReactNode, useMemo } from 'react';
2223
import styled from 'styled-components';
@@ -45,6 +46,9 @@ const StyledEuiPage = styled(EuiPage)`
4546
.endpoint-navTabs {
4647
margin-left: ${(props) => props.theme.eui.euiSizeM};
4748
}
49+
.endpoint-header-leftSection {
50+
overflow: hidden;
51+
}
4852
`;
4953

5054
const isStringOrNumber = /(string|number)/;
@@ -54,13 +58,15 @@ const isStringOrNumber = /(string|number)/;
5458
* Can be used when wanting to customize the `headerLeft` value but still use the standard
5559
* title component
5660
*/
57-
export const PageViewHeaderTitle = memo<{ children: ReactNode }>(({ children }) => {
58-
return (
59-
<EuiTitle size="l">
60-
<h1 data-test-subj="pageViewHeaderLeftTitle">{children}</h1>
61-
</EuiTitle>
62-
);
63-
});
61+
export const PageViewHeaderTitle = memo<Omit<EuiTitleProps, 'children'> & { children: ReactNode }>(
62+
({ children, size = 'l', ...otherProps }) => {
63+
return (
64+
<EuiTitle {...otherProps} size={size}>
65+
<h1 data-test-subj="pageViewHeaderLeftTitle">{children}</h1>
66+
</EuiTitle>
67+
);
68+
}
69+
);
6470

6571
PageViewHeaderTitle.displayName = 'PageViewHeaderTitle';
6672

@@ -135,7 +141,10 @@ export const PageView = memo<PageViewProps>(
135141
<EuiPageBody>
136142
{(headerLeft || headerRight) && (
137143
<EuiPageHeader className="endpoint-header">
138-
<EuiPageHeaderSection data-test-subj="pageViewHeaderLeft">
144+
<EuiPageHeaderSection
145+
className="endpoint-header-leftSection"
146+
data-test-subj="pageViewHeaderLeft"
147+
>
139148
{isStringOrNumber.test(typeof headerLeft) ? (
140149
<PageViewHeaderTitle>{headerLeft}</PageViewHeaderTitle>
141150
) : (

x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export const PolicyDetails = React.memo(() => {
168168
defaultMessage="Back to policy list"
169169
/>
170170
</EuiButtonEmpty>
171-
<PageViewHeaderTitle>{policyItem.name}</PageViewHeaderTitle>
171+
<PageViewHeaderTitle className="eui-textTruncate">{policyItem.name}</PageViewHeaderTitle>
172172
</div>
173173
);
174174

0 commit comments

Comments
 (0)