diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/__mocks__/index.ts b/x-pack/plugins/security_solution/public/common/components/event_details/__mocks__/index.ts index a6e1a9875bd62..4183f12eec72a 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/public/common/components/event_details/__mocks__/index.ts @@ -477,6 +477,12 @@ export const mockAlertDetailsData = [ values: ['2020-11-25T15:36:40.924914552Z'], originalValue: '2020-11-25T15:36:40.924914552Z', }, + { + category: 'kibana', + field: 'kibana.alert.original_event.id', + values: ['f7bc2422-cb1e-4427-ba33-6f496ee8360c'], + originalValue: 'f7bc2422-cb1e-4427-ba33-6f496ee8360c', + }, { category: 'kibana', field: 'kibana.alert.original_event.code', diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.test.tsx index 53c0d143600fb..650b915f50214 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.test.tsx @@ -68,7 +68,7 @@ describe('AlertSummaryView', () => { ); - ['host.name', 'user.name', 'Rule type', 'query'].forEach((fieldId) => { + ['host.name', 'user.name', 'Rule type', 'query', 'Source event id'].forEach((fieldId) => { expect(getByText(fieldId)); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/get_alert_summary_rows.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/get_alert_summary_rows.tsx index 0527acfef1f9a..8d2de0439967c 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/get_alert_summary_rows.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/get_alert_summary_rows.tsx @@ -37,6 +37,7 @@ const alwaysDisplayedFields: EventSummaryField[] = [ { id: 'agent.id', overrideField: AGENT_STATUS_FIELD_NAME, label: i18n.AGENT_STATUS }, { id: 'user.name' }, { id: ALERT_RULE_TYPE, label: i18n.RULE_TYPE }, + { id: 'kibana.alert.original_event.id', label: i18n.SOURCE_EVENT_ID }, ]; /** diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx index 451ffd64584a7..78cb55166555d 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx @@ -47,7 +47,7 @@ const summaryColumns: Array> = [ {i18n.HIGHLIGHTED_FIELDS_ALERT_PREVALENCE_TOOLTIP}} /> diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.test.tsx index 83b4c63484dd3..6a0e6bf4e6b9d 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.test.tsx @@ -15,6 +15,7 @@ import { EventFieldsData } from '../types'; import { TimelineId } from '../../../../../common/types'; import { AlertSummaryRow } from '../helpers'; import { useAlertPrevalence } from '../../../containers/alerts/use_alert_prevalence'; +import { getEmptyValue } from '../../../components/empty_value'; jest.mock('../../../lib/kibana'); jest.mock('../../../containers/alerts/use_alert_prevalence', () => ({ @@ -75,10 +76,10 @@ describe('PrevalenceCellRenderer', () => { }); describe('When an error was returned', () => { - test('it should return null', async () => { + test('it should return empty value placeholder', async () => { mockUseAlertPrevalence.mockImplementation(() => ({ loading: false, - count: 123, + count: undefined, error: true, })); const { container } = render( @@ -88,6 +89,7 @@ describe('PrevalenceCellRenderer', () => { ); expect(container.getElementsByClassName('euiLoadingSpinner')).toHaveLength(0); expect(screen.queryByText('123')).toBeNull(); + expect(screen.queryByText(getEmptyValue())).toBeTruthy(); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.tsx index ed8b610b39d1f..46de86d4bff1b 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/table/prevalence_cell.tsx @@ -9,11 +9,12 @@ import React from 'react'; import { EuiLoadingSpinner } from '@elastic/eui'; import { AlertSummaryRow } from '../helpers'; +import { defaultToEmptyTag } from '../../../components/empty_value'; import { useAlertPrevalence } from '../../../containers/alerts/use_alert_prevalence'; const PrevalenceCell = React.memo( ({ data, values, timelineId }) => { - const { loading, count, error } = useAlertPrevalence({ + const { loading, count } = useAlertPrevalence({ field: data.field, timelineId, value: values, @@ -22,11 +23,9 @@ const PrevalenceCell = React.memo( if (loading) { return ; - } else if (error) { - return null; + } else { + return defaultToEmptyTag(count); } - - return <>{count}; } ); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts b/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts index 52f73e9de481a..6e32beb7da02a 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts @@ -46,7 +46,7 @@ export const HIGHLIGHTED_FIELDS_VALUE = i18n.translate( export const HIGHLIGHTED_FIELDS_ALERT_PREVALENCE = i18n.translate( 'xpack.securitySolution.alertDetails.overview.highlightedFields.alertPrevalence', { - defaultMessage: 'Alert Prevalence', + defaultMessage: 'Alert prevalence', } ); @@ -117,6 +117,13 @@ export const RULE_TYPE = i18n.translate('xpack.securitySolution.detections.alert defaultMessage: 'Rule type', }); +export const SOURCE_EVENT_ID = i18n.translate( + 'xpack.securitySolution.detections.alerts.sourceEventId', + { + defaultMessage: 'Source event id', + } +); + export const MULTI_FIELD_TOOLTIP = i18n.translate( 'xpack.securitySolution.eventDetails.multiFieldTooltipContent', {