Skip to content

Commit c1b50e6

Browse files
authored
[ENDPOINT] Reintroduced tabs to endpoint management and migrated pages to use common security components (#74886) (#75352)
* Reintroduced tabs to endpoint management and migrated pages to use common security components. * Empty trusted apps tab. * Changed casing in the translations. * Switched to using route path generation functions. * Added propagation of data-test-subj attribute to Wrapper component. * Fixed CommonProps import. * Moved out shared component for administration list page. * Removed unused file. * Removed unused translation keys. * Removed redundant snapshot. * Added some minimal tests. * Attempt to fix functional tests. * Attempt to fix functional tests again. * Reverted function declarations back to const. * Wrapped component in memo.
1 parent 27f124a commit c1b50e6

File tree

31 files changed

+325
-1274
lines changed

31 files changed

+325
-1274
lines changed

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

Lines changed: 0 additions & 802 deletions
This file was deleted.

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

Lines changed: 0 additions & 88 deletions
This file was deleted.

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

Lines changed: 0 additions & 184 deletions
This file was deleted.

x-pack/plugins/security_solution/public/common/components/wrapper_page/index.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
import classNames from 'classnames';
88
import React, { useEffect } from 'react';
99
import styled from 'styled-components';
10+
import { CommonProps } from '@elastic/eui';
1011

1112
import { useFullScreen } from '../../containers/use_full_screen';
1213
import { gutterTimeline } from '../../lib/helpers';
1314
import { AppGlobalStyle } from '../page/index';
1415

1516
const Wrapper = styled.div`
16-
padding: ${({ theme }) =>
17-
`${theme.eui.paddingSizes.l} ${gutterTimeline} ${theme.eui.paddingSizes.l} ${theme.eui.paddingSizes.l}`};
17+
padding: ${(props) => `${props.theme.eui.paddingSizes.l}`};
18+
1819
&.siemWrapperPage--restrictWidthDefault,
1920
&.siemWrapperPage--restrictWidthCustom {
2021
box-sizing: content-box;
@@ -29,6 +30,10 @@ const Wrapper = styled.div`
2930
height: 100%;
3031
}
3132
33+
&.siemWrapperPage--withTimeline {
34+
padding-right: ${gutterTimeline};
35+
}
36+
3237
&.siemWrapperPage--noPadding {
3338
padding: 0;
3439
}
@@ -38,18 +43,20 @@ Wrapper.displayName = 'Wrapper';
3843

3944
interface WrapperPageProps {
4045
children: React.ReactNode;
41-
className?: string;
4246
restrictWidth?: boolean | number | string;
4347
style?: Record<string, string>;
4448
noPadding?: boolean;
49+
noTimeline?: boolean;
4550
}
4651

47-
const WrapperPageComponent: React.FC<WrapperPageProps> = ({
52+
const WrapperPageComponent: React.FC<WrapperPageProps & CommonProps> = ({
4853
children,
4954
className,
5055
restrictWidth,
5156
style,
5257
noPadding,
58+
noTimeline,
59+
...otherProps
5360
}) => {
5461
const { globalFullScreen, setGlobalFullScreen } = useFullScreen();
5562
useEffect(() => {
@@ -59,6 +66,7 @@ const WrapperPageComponent: React.FC<WrapperPageProps> = ({
5966
const classes = classNames(className, {
6067
siemWrapperPage: true,
6168
'siemWrapperPage--noPadding': noPadding,
69+
'siemWrapperPage--withTimeline': !noTimeline,
6270
'siemWrapperPage--fullHeight': globalFullScreen,
6371
'siemWrapperPage--restrictWidthDefault':
6472
restrictWidth && typeof restrictWidth === 'boolean' && restrictWidth === true,
@@ -73,7 +81,7 @@ const WrapperPageComponent: React.FC<WrapperPageProps> = ({
7381
}
7482

7583
return (
76-
<Wrapper className={classes} style={customStyle || style}>
84+
<Wrapper className={classes} style={customStyle || style} {...otherProps}>
7785
{children}
7886
<AppGlobalStyle />
7987
</Wrapper>

x-pack/plugins/security_solution/public/management/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const MANAGEMENT_ROUTING_ROOT_PATH = '';
1313
export const MANAGEMENT_ROUTING_ENDPOINTS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.endpoints})`;
1414
export const MANAGEMENT_ROUTING_POLICIES_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.policies})`;
1515
export const MANAGEMENT_ROUTING_POLICY_DETAILS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.policies})/:policyId`;
16+
export const MANAGEMENT_ROUTING_TRUSTED_APPS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.trustedApps})`;
1617

1718
// --[ STORE ]---------------------------------------------------------------------------
1819
/** The SIEM global store namespace where the management state will be mounted */

x-pack/plugins/security_solution/public/management/common/routing.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
MANAGEMENT_ROUTING_ENDPOINTS_PATH,
1414
MANAGEMENT_ROUTING_POLICIES_PATH,
1515
MANAGEMENT_ROUTING_POLICY_DETAILS_PATH,
16+
MANAGEMENT_ROUTING_TRUSTED_APPS_PATH,
1617
} from './constants';
1718
import { AdministrationSubTab } from '../types';
1819
import { appendSearch } from '../../common/components/link_to/helpers';
@@ -72,13 +73,21 @@ export const getEndpointDetailsPath = (
7273
})}${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`;
7374
};
7475

75-
export const getPoliciesPath = (search?: string) =>
76-
`${generatePath(MANAGEMENT_ROUTING_POLICIES_PATH, {
76+
export const getPoliciesPath = (search?: string) => {
77+
return `${generatePath(MANAGEMENT_ROUTING_POLICIES_PATH, {
7778
tabName: AdministrationSubTab.policies,
7879
})}${appendSearch(search)}`;
80+
};
7981

80-
export const getPolicyDetailPath = (policyId: string, search?: string) =>
81-
`${generatePath(MANAGEMENT_ROUTING_POLICY_DETAILS_PATH, {
82+
export const getPolicyDetailPath = (policyId: string, search?: string) => {
83+
return `${generatePath(MANAGEMENT_ROUTING_POLICY_DETAILS_PATH, {
8284
tabName: AdministrationSubTab.policies,
8385
policyId,
8486
})}${appendSearch(search)}`;
87+
};
88+
89+
export const getTrustedAppsListPath = (search?: string) => {
90+
return `${generatePath(MANAGEMENT_ROUTING_TRUSTED_APPS_PATH, {
91+
tabName: AdministrationSubTab.trustedApps,
92+
})}${appendSearch(search)}`;
93+
};

x-pack/plugins/security_solution/public/management/common/translations.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ export const ENDPOINTS_TAB = i18n.translate('xpack.securitySolution.endpointsTab
1313
export const POLICIES_TAB = i18n.translate('xpack.securitySolution.policiesTab', {
1414
defaultMessage: 'Policies',
1515
});
16+
17+
export const TRUSTED_APPS_TAB = i18n.translate('xpack.securitySolution.trustedAppsTab', {
18+
defaultMessage: 'Trusted applications',
19+
});
20+
21+
export const BETA_BADGE_LABEL = i18n.translate('xpack.securitySolution.administration.list.beta', {
22+
defaultMessage: 'Beta',
23+
});

0 commit comments

Comments
 (0)