Skip to content

Commit

Permalink
[Cloud Security] add vulnerabilties data set to filter for links from…
Browse files Browse the repository at this point in the history
… CNVM dashboard (elastic#197648)

## Summary

- fixes elastic/security-team#10915
  • Loading branch information
maxcold authored Oct 29, 2024
1 parent db18039 commit b4ed7a1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ export const useNavigateFindings = () => {

export const useNavigateVulnerabilities = () =>
useNavigate(findingsNavigation.vulnerabilities.path);

export const useNavigateNativeVulnerabilities = () => {
const navToVulnerabilities = useNavigateVulnerabilities();

return useCallback(
(filterParams: NavFilter = {}, groupBy?: string[]) => {
navToVulnerabilities(
{ ...filterParams, 'data_stream.dataset': 'cloud_security_posture.vulnerabilities' },
groupBy
);
},
[navToVulnerabilities]
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import React, { useMemo } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiHealth } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useNavigateVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings';
import { useNavigateNativeVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings';
import { VULNERABILITIES_SEVERITY } from '@kbn/cloud-security-posture-common';
import { getSeverityStatusColor } from '@kbn/cloud-security-posture';
import { VulnCounterCard, type VulnCounterCardProps } from '../../components/vuln_counter_card';
import { useVulnerabilityDashboardApi } from '../../common/api/use_vulnerability_dashboard_api';
import { CompactFormattedNumber } from '../../components/compact_formatted_number';

export const VulnerabilityStatistics = () => {
const navToVulnerabilities = useNavigateVulnerabilities();
const navToVulnerabilities = useNavigateNativeVulnerabilities();
const getVulnerabilityDashboard = useVulnerabilityDashboardApi();

const stats: VulnCounterCardProps[] = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import type { NavFilter } from '@kbn/cloud-security-posture/src/utils/query_utils';
import { useNavigateVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings';
import { useNavigateNativeVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings';
import type { VulnSeverity } from '@kbn/cloud-security-posture-common';
import { CVSScoreBadge, SeverityStatusBadge } from '@kbn/cloud-security-posture';
import {
Expand All @@ -33,7 +33,7 @@ import { VULNERABILITY_GROUPING_OPTIONS, VULNERABILITY_FIELDS } from '../../comm
export const VulnerabilityTablePanelSection = () => {
const getVulnerabilityDashboard = useVulnerabilityDashboardApi();
const { euiTheme } = useEuiTheme();
const navToVulnerabilities = useNavigateVulnerabilities();
const navToVulnerabilities = useNavigateNativeVulnerabilities();

const onCellClick = useCallback(
(filters: NavFilter) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EuiButton, EuiComboBox } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import { useNavigateVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings';
import { useNavigateNativeVulnerabilities } from '@kbn/cloud-security-posture/src/hooks/use_navigate_findings';
import type { VulnSeverity } from '@kbn/cloud-security-posture-common';
import { VULNERABILITIES_SEVERITY } from '@kbn/cloud-security-posture-common';
import { getSeverityStatusColor } from '@kbn/cloud-security-posture';
Expand Down Expand Up @@ -50,7 +50,7 @@ const theme: PartialTheme = {
};

const ViewAllButton = () => {
const navToVulnerabilities = useNavigateVulnerabilities();
const navToVulnerabilities = useNavigateNativeVulnerabilities();

return (
<EuiButton onClick={() => navToVulnerabilities()} size="s">
Expand Down

0 comments on commit b4ed7a1

Please sign in to comment.