mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Cloud Security] Update Vuln Mgmt Asset page (#155676)
## Summary https://github.com/elastic/security-team/issues/6393 This PR is to address the issue where the asset page for Vuln mgmt page is showing options for pages that hasn't been developed yet. The fix includes 1. Removing Dashboard and Rule options on Asset tab if integration is Vuln Mgmt 2. Updating the link for Findings to redirect users to Findings/Vulnerability instead of Findings/Configuration if integration is Vuln Mgmt 3. Update parent integration asset to include both Dropdown from Cloud Posture and Vulnerability Management **Definition of done** - [x] Show all relevant pages split by Cloud Posture and Vulnerability Management in the parent integration assets - [x] Show only vulnerabilitiy management findings link when viewing Vulnerability Management->Assets - [x] Make sure KSPM and CSPM shows the same links available today <img width="1667" alt="Screen Shot 2023-04-24 at 5 24 10 PM" src="https://user-images.githubusercontent.com/8703149/234144304-782cdd29-8d0a-42eb-a210-56423868b0f7.png"> <img width="1654" alt="Screen Shot 2023-04-25 at 11 32 24 AM" src="https://user-images.githubusercontent.com/8703149/234370092-383b29b2-0c29-4f7e-9fcd-29c53edd4f10.png">
This commit is contained in:
parent
b6b03556db
commit
d4b6e2fa04
2 changed files with 53 additions and 2 deletions
|
@ -8,6 +8,10 @@
|
|||
import React from 'react';
|
||||
import { type CustomAssetsAccordionProps, CustomAssetsAccordion } from '@kbn/fleet-plugin/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { EuiSpacer } from '@elastic/eui';
|
||||
import { CloudSecurityPolicyTemplate } from '../../../common/types';
|
||||
import { VULN_MGMT_POLICY_TEMPLATE } from '../../../common/constants';
|
||||
import { useKibana } from '../../common/hooks/use_kibana';
|
||||
import { benchmarksNavigation, cloudPosturePages } from '../../common/navigation/constants';
|
||||
|
||||
|
@ -15,6 +19,21 @@ const SECURITY_APP_NAME = 'securitySolutionUI';
|
|||
|
||||
export const CspCustomAssetsExtension = () => {
|
||||
const { application } = useKibana().services;
|
||||
const integration = useParams<{ integration: CloudSecurityPolicyTemplate | undefined }>()
|
||||
.integration;
|
||||
|
||||
const viewsCNVM: CustomAssetsAccordionProps['views'] = [
|
||||
{
|
||||
name: cloudPosturePages.findings.name,
|
||||
url: application.getUrlForApp(SECURITY_APP_NAME, {
|
||||
path: cloudPosturePages.findings.path + '/vulnerabilities',
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.csp.createPackagePolicy.customAssetsTab.vulnerabilityFindingsViewLabel',
|
||||
{ defaultMessage: 'View Vulnerability Findings ' }
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const views: CustomAssetsAccordionProps['views'] = [
|
||||
{
|
||||
|
@ -27,7 +46,9 @@ export const CspCustomAssetsExtension = () => {
|
|||
},
|
||||
{
|
||||
name: cloudPosturePages.findings.name,
|
||||
url: application.getUrlForApp(SECURITY_APP_NAME, { path: cloudPosturePages.findings.path }),
|
||||
url: application.getUrlForApp(SECURITY_APP_NAME, {
|
||||
path: cloudPosturePages.findings.path,
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.csp.createPackagePolicy.customAssetsTab.findingsViewLabel',
|
||||
{ defaultMessage: 'View CSP Findings ' }
|
||||
|
@ -42,6 +63,34 @@ export const CspCustomAssetsExtension = () => {
|
|||
},
|
||||
];
|
||||
|
||||
if (!integration) {
|
||||
return (
|
||||
<>
|
||||
<CustomAssetsAccordion
|
||||
views={views}
|
||||
initialIsOpen
|
||||
title={i18n.translate(
|
||||
'xpack.csp.createPackagePolicy.customAssetsTab.cloudPostureTitleLabel',
|
||||
{ defaultMessage: 'Cloud Posture ' }
|
||||
)}
|
||||
/>
|
||||
<EuiSpacer size="m" />
|
||||
<CustomAssetsAccordion
|
||||
views={viewsCNVM}
|
||||
initialIsOpen
|
||||
title={i18n.translate(
|
||||
'xpack.csp.createPackagePolicy.customAssetsTab.cloudNativeVulnerabilityManagementTitleLabel',
|
||||
{ defaultMessage: 'Cloud Native Vulnerability Management ' }
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (integration === VULN_MGMT_POLICY_TEMPLATE) {
|
||||
return <CustomAssetsAccordion views={viewsCNVM} initialIsOpen />;
|
||||
}
|
||||
|
||||
return <CustomAssetsAccordion views={views} initialIsOpen />;
|
||||
};
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
|
|
|
@ -31,11 +31,13 @@ export interface CustomAssetsAccordionProps {
|
|||
description: string;
|
||||
}>;
|
||||
initialIsOpen?: boolean;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export const CustomAssetsAccordion: FunctionComponent<CustomAssetsAccordionProps> = ({
|
||||
views,
|
||||
initialIsOpen = false,
|
||||
title,
|
||||
}) => {
|
||||
const { application } = useStartServices();
|
||||
|
||||
|
@ -46,7 +48,7 @@ export const CustomAssetsAccordion: FunctionComponent<CustomAssetsAccordionProps
|
|||
<EuiFlexGroup justifyContent="center" alignItems="center" gutterSize="s" responsive={false}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiText size="m">
|
||||
<h3>{AssetTitleMap.view}</h3>
|
||||
<h3>{title ?? AssetTitleMap.view}</h3>
|
||||
</EuiText>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue