Skip to content

Commit f8355f2

Browse files
[SecuritySolution] Update dashboard selection count (elastic#241326)
## Summary Fixes elastic#240407 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 5ef9b2c)
1 parent ea3f055 commit f8355f2

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

x-pack/solutions/security/plugins/security_solution/public/siem_migrations/common/components/bulk_actions/install_translated.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import React from 'react';
99
import { render, fireEvent } from '@testing-library/react';
1010
import { InstallTranslatedButton } from './install_translated';
1111
import { getDashboardMigrationDashboardMock } from '../../../../../common/siem_migrations/model/__mocks__';
12+
import type { BulkActionsItem } from './types';
1213

1314
describe('InstallTranslatedButton', () => {
1415
const mockInstallTranslatedItems = jest.fn();
@@ -29,6 +30,20 @@ describe('InstallTranslatedButton', () => {
2930
});
3031

3132
it('renders the button with correct text when items are selected', () => {
33+
const additionalItem = {
34+
...getDashboardMigrationDashboardMock(),
35+
id: 'EfDKfJkBBI4hy8QbQ_BC',
36+
migration_id: '9bcd7ea8-f617-4dc4-ab4a-da323c0a18b3',
37+
translation_result: 'full',
38+
} as BulkActionsItem;
39+
const selectedItems: BulkActionsItem[] = [getDashboardMigrationDashboardMock(), additionalItem];
40+
const { getByText } = render(
41+
<InstallTranslatedButton {...defaultProps} selectedItems={selectedItems} />
42+
);
43+
expect(getByText('Install selected (2)')).toBeInTheDocument();
44+
});
45+
46+
it('renders the button with correct text when partially translated items are selected', () => {
3247
const selectedItems = [getDashboardMigrationDashboardMock()];
3348
const { getByText } = render(
3449
<InstallTranslatedButton {...defaultProps} selectedItems={selectedItems} />

x-pack/solutions/security/plugins/security_solution/public/siem_migrations/common/components/bulk_actions/install_translated.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ export const InstallTranslatedButton = memo(
3232
const numberOfSelectedItems = selectedItems.length;
3333
const installTranslatedItemsSelected = useMemo(
3434
() =>
35-
selectedItems.filter((item) => item.translation_result === MigrationTranslationResult.FULL)
36-
.length,
35+
selectedItems.filter(
36+
(item) =>
37+
item.translation_result === MigrationTranslationResult.FULL ||
38+
item.translation_result === MigrationTranslationResult.PARTIAL
39+
).length,
3740
[selectedItems]
3841
);
3942
const isSelected = installTranslatedItemsSelected > 0;

0 commit comments

Comments
 (0)