Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Cloud Security] add vulnerabilties data set to filter for links from CNVM dashboard (#197648) #198140

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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