Skip to content
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 @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('AlertSummaryView', () => {
</TestProviders>
);

['host.name', 'user.name', 'Rule type', 'query'].forEach((fieldId) => {
['host.name', 'user.name', 'Rule type', 'query', 'Source event id'].forEach((fieldId) => {
expect(getByText(fieldId));
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const summaryColumns: Array<EuiBasicTableColumn<AlertSummaryRow>> = [
<EuiIconTip
type="iInCircle"
color="subdued"
title="Alert Prevalence"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelolo24 I assume this one was forgotten in the initial PR. Let me know if we should keep the English copy here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, thanks! I missed this translation.

title={i18n.HIGHLIGHTED_FIELDS_ALERT_PREVALENCE}
content={<span>{i18n.HIGHLIGHTED_FIELDS_ALERT_PREVALENCE_TOOLTIP}</span>}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => ({
Expand Down Expand Up @@ -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(
Expand All @@ -88,6 +89,7 @@ describe('PrevalenceCellRenderer', () => {
);
expect(container.getElementsByClassName('euiLoadingSpinner')).toHaveLength(0);
expect(screen.queryByText('123')).toBeNull();
expect(screen.queryByText(getEmptyValue())).toBeTruthy();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AlertSummaryRow['description']>(
({ data, values, timelineId }) => {
const { loading, count, error } = useAlertPrevalence({
const { loading, count } = useAlertPrevalence({
field: data.field,
timelineId,
value: values,
Expand All @@ -22,11 +23,9 @@ const PrevalenceCell = React.memo<AlertSummaryRow['description']>(

if (loading) {
return <EuiLoadingSpinner />;
} else if (error) {
return null;
} else {
return defaultToEmptyTag(count);
}

return <>{count}</>;
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
);

Expand Down Expand Up @@ -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',
{
Expand Down