Skip to content

Commit

Permalink
Merge branch 'main' into task/olm-4416-rbac-policy-list-and-details
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares authored Nov 30, 2022
2 parents 055f631 + 4018497 commit f67c59e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -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;

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

0 comments on commit f67c59e

Please sign in to comment.