mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.6] [Security Solution][Alerts] Add suppression info to alert details insights (#145766) (#146749)
# Backport This will backport the following commits from `main` to `8.6`: - [[Security Solution][Alerts] Add suppression info to alert details insights (#145766)](https://github.com/elastic/kibana/pull/145766) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Marshall Main","email":"55718608+marshallmain@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-30T19:54:11Z","message":"[Security Solution][Alerts] Add suppression info to alert details insights (#145766)\n\n## Summary\r\n\r\nhttps://github.com/elastic/kibana/issues/145678 - Alert suppression info\r\ndoes not display in the details flyout (issue mentions highlighted\r\nfields, but we add it to `Insights` as shown in the\r\n[mocks](204872298
-92b9d48a-3853-4ec9-b15c-876f4183e3c1.png)","sha":"40184978d31870c37b43514bfe8fb4c143a28363","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","Team:Detection Alerts","v8.6.0","v8.7.0"],"number":145766,"url":"https://github.com/elastic/kibana/pull/145766","mergeCommit":{"message":"[Security Solution][Alerts] Add suppression info to alert details insights (#145766)\n\n## Summary\r\n\r\nhttps://github.com/elastic/kibana/issues/145678 - Alert suppression info\r\ndoes not display in the details flyout (issue mentions highlighted\r\nfields, but we add it to `Insights` as shown in the\r\n[mocks](204872298
-92b9d48a-3853-4ec9-b15c-876f4183e3c1.png)","sha":"40184978d31870c37b43514bfe8fb4c143a28363"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145766","number":145766,"mergeCommit":{"message":"[Security Solution][Alerts] Add suppression info to alert details insights (#145766)\n\n## Summary\r\n\r\nhttps://github.com/elastic/kibana/issues/145678 - Alert suppression info\r\ndoes not display in the details flyout (issue mentions highlighted\r\nfields, but we add it to `Insights` as shown in the\r\n[mocks](204872298
-92b9d48a-3853-4ec9-b15c-876f4183e3c1.png)","sha":"40184978d31870c37b43514bfe8fb4c143a28363"}}]}] BACKPORT--> Co-authored-by: Marshall Main <55718608+marshallmain@users.noreply.github.com>
This commit is contained in:
parent
7747da8246
commit
35cf7309fd
2 changed files with 43 additions and 1 deletions
|
@ -6,7 +6,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
|
||||
import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiTitle } from '@elastic/eui';
|
||||
import { euiStyled } from '@kbn/kibana-react-plugin/common';
|
||||
import { ALERT_SUPPRESSION_DOCS_COUNT } from '@kbn/rule-data-utils';
|
||||
import { find } from 'lodash/fp';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
@ -23,6 +25,13 @@ import { RelatedAlertsBySourceEvent } from './related_alerts_by_source_event';
|
|||
import { RelatedAlertsBySession } from './related_alerts_by_session';
|
||||
import { RelatedAlertsUpsell } from './related_alerts_upsell';
|
||||
|
||||
const StyledInsightItem = euiStyled(EuiFlexItem)`
|
||||
border: 1px solid ${({ theme }) => theme.eui.euiColorLightShade};
|
||||
padding: 10px 8px;
|
||||
border-radius: 6px;
|
||||
display: inline-flex;
|
||||
`;
|
||||
|
||||
interface Props {
|
||||
browserFields: BrowserFields;
|
||||
eventId: string;
|
||||
|
@ -68,6 +77,12 @@ export const Insights = React.memo<Props>(
|
|||
);
|
||||
const hasSourceEventInfo = hasData(sourceEventField);
|
||||
|
||||
const alertSuppressionField = find(
|
||||
{ category: 'kibana', field: ALERT_SUPPRESSION_DOCS_COUNT },
|
||||
data
|
||||
);
|
||||
const hasAlertSuppressionField = hasData(alertSuppressionField);
|
||||
|
||||
const userCasesPermissions = useGetUserCasesPermissions();
|
||||
const hasCasesReadPermissions = userCasesPermissions.read;
|
||||
|
||||
|
@ -101,6 +116,20 @@ export const Insights = React.memo<Props>(
|
|||
</EuiTitle>
|
||||
</EuiFlexItem>
|
||||
|
||||
{hasAlertSuppressionField && (
|
||||
<StyledInsightItem>
|
||||
<div>
|
||||
<EuiIcon type="layers" style={{ marginLeft: '4px', marginRight: '8px' }} />
|
||||
{i18n.SUPPRESSED_ALERTS_COUNT(parseInt(alertSuppressionField.values[0], 10))}
|
||||
<EuiBetaBadge
|
||||
label={i18n.SUPPRESSED_ALERTS_COUNT_TECHNICAL_PREVIEW}
|
||||
style={{ verticalAlign: 'middle', marginLeft: '8px' }}
|
||||
size="s"
|
||||
/>
|
||||
</div>
|
||||
</StyledInsightItem>
|
||||
)}
|
||||
|
||||
{hasCasesReadPermissions && (
|
||||
<EuiFlexItem>
|
||||
<RelatedCases eventId={eventId} />
|
||||
|
|
|
@ -149,3 +149,16 @@ export const INSIGHTS_UPSELL = i18n.translate(
|
|||
defaultMessage: 'Get more insights with a platinum subscription',
|
||||
}
|
||||
);
|
||||
|
||||
export const SUPPRESSED_ALERTS_COUNT = (count?: number) =>
|
||||
i18n.translate('xpack.securitySolution.alertDetails.overview.insights.suppressedAlertsCount', {
|
||||
defaultMessage: '{count} suppressed {count, plural, =1 {alert} other {alerts}}',
|
||||
values: { count },
|
||||
});
|
||||
|
||||
export const SUPPRESSED_ALERTS_COUNT_TECHNICAL_PREVIEW = i18n.translate(
|
||||
'xpack.securitySolution.alertDetails.overview.insights.suppressedAlertsCountTechnicalPreview',
|
||||
{
|
||||
defaultMessage: 'Technical Preview',
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue