[Cloud Security] fix 'show 1 alerts' bug (#191062)

## Summary

Using plural from `react-intl` in the Session View for `Show N alerts`
text

- part of https://github.com/elastic/security-team/issues/10316
- fixes https://github.com/elastic/kibana/issues/189880
This commit is contained in:
Maxim Kholod 2024-08-22 17:38:03 +02:00 committed by GitHub
parent 20ccb21c94
commit df5810f146
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 5 deletions

View file

@ -53,6 +53,19 @@ describe('ProcessTreeAlertsFiltersFilter component', () => {
expect(filterCountStatus).toBeTruthy();
});
it('should show pluralise correctly', async () => {
renderResult = mockedContext.render(
<ProcessTreeAlertsFilter {...props} totalAlertsCount={1} filteredAlertsCount={1} />
);
const filterCountStatus = renderResult.queryByTestId(
'sessionView:sessionViewAlertDetailsFilterStatus'
);
expect(filterCountStatus).toHaveTextContent('Showing 1 alert');
expect(filterCountStatus).toBeTruthy();
});
it('should call onAlertEventCategorySelected with alert category when filter item is clicked ', () => {
const mockAlertEventCategorySelectedEvent = jest.fn();
renderResult = mockedContext.render(

View file

@ -124,9 +124,10 @@ export const ProcessTreeAlertsFilter = ({
{totalAlertsCount === filteredAlertsCount && (
<FormattedMessage
id="xpack.sessionView.alertTotalCountStatusLabel"
defaultMessage="Showing {count} alerts"
defaultMessage="{count, plural, one {Showing <bold>#</bold> alert} other {Showing <bold>#</bold> alerts}}"
values={{
count: <strong>{totalAlertsCount}</strong>,
count: totalAlertsCount,
bold: (str: string) => <strong>{str}</strong>,
}}
/>
)}

View file

@ -41491,7 +41491,6 @@
"xpack.sessionView.alertFilteredCountStatusLabel": " Affichage de {count} alertes",
"xpack.sessionView.alerts": "Alertes",
"xpack.sessionView.alertsLoadMoreButton": "Charger plus d'alertes",
"xpack.sessionView.alertTotalCountStatusLabel": "Affichage de {count} alertes",
"xpack.sessionView.backToInvestigatedAlert": "Retour à l'alerte examinée",
"xpack.sessionView.blockedBadge": "Bloqué",
"xpack.sessionView.childProcesses": "Processus enfants",

View file

@ -41475,7 +41475,6 @@
"xpack.sessionView.alertFilteredCountStatusLabel": " {count}件のアラートを表示しています",
"xpack.sessionView.alerts": "アラート",
"xpack.sessionView.alertsLoadMoreButton": "その他のアラートを読み込む",
"xpack.sessionView.alertTotalCountStatusLabel": "{count}件のアラートを表示しています",
"xpack.sessionView.backToInvestigatedAlert": "調査されたアラートに戻る",
"xpack.sessionView.blockedBadge": "ブロック",
"xpack.sessionView.childProcesses": "子プロセス",

View file

@ -41518,7 +41518,6 @@
"xpack.sessionView.alertFilteredCountStatusLabel": " 正在显示 {count} 个告警",
"xpack.sessionView.alerts": "告警",
"xpack.sessionView.alertsLoadMoreButton": "加载更多告警",
"xpack.sessionView.alertTotalCountStatusLabel": "正在显示 {count} 个告警",
"xpack.sessionView.backToInvestigatedAlert": "返回到已调查告警",
"xpack.sessionView.blockedBadge": "已阻止",
"xpack.sessionView.childProcesses": "子进程",