diff --git a/x-pack/plugins/cases/public/components/all_cases/assignees_filter.tsx b/x-pack/plugins/cases/public/components/all_cases/assignees_filter.tsx index 8e88eec447e6c..7e556ee46eeab 100644 --- a/x-pack/plugins/cases/public/components/all_cases/assignees_filter.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/assignees_filter.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { EuiFilterButton } from '@elastic/eui'; +import { EuiFilterButton, EuiFilterGroup } from '@elastic/eui'; import { UserProfilesPopover } from '@kbn/user-profile-components'; import { isEmpty } from 'lodash'; import React, { useCallback, useMemo, useState } from 'react'; @@ -91,44 +91,46 @@ const AssigneesFilterPopoverComponent: React.FC = ( const isLoadingData = isLoading || isLoadingSuggest; return ( - 0} - numActiveFilters={selectedAssignees.length} - aria-label={i18n.FILTER_ASSIGNEES_ARIA_LABEL} - > - {i18n.ASSIGNEES} - - } - selectableProps={{ - onChange, - onSearchChange, - selectedStatusMessage, - options: searchResultProfiles, - selectedOptions: selectedAssignees, - isLoading: isLoadingData || isUserTyping, - height: 'full', - searchPlaceholder: i18n.SEARCH_USERS, - clearButtonLabel: i18n.CLEAR_FILTERS, - emptyMessage: , - noMatchesMessage: !isUserTyping && !isLoadingData ? : , - limit: MAX_ASSIGNEES_FILTER_LENGTH, - limitReachedMessage, - singleSelection: false, - nullOptionLabel: i18n.NO_ASSIGNEES, - }} - /> + + 0} + numActiveFilters={selectedAssignees.length} + aria-label={i18n.FILTER_ASSIGNEES_ARIA_LABEL} + > + {i18n.ASSIGNEES} + + } + selectableProps={{ + onChange, + onSearchChange, + selectedStatusMessage, + options: searchResultProfiles, + selectedOptions: selectedAssignees, + isLoading: isLoadingData || isUserTyping, + height: 'full', + searchPlaceholder: i18n.SEARCH_USERS, + clearButtonLabel: i18n.CLEAR_FILTERS, + emptyMessage: , + noMatchesMessage: !isUserTyping && !isLoadingData ? : , + limit: MAX_ASSIGNEES_FILTER_LENGTH, + limitReachedMessage, + singleSelection: false, + nullOptionLabel: i18n.NO_ASSIGNEES, + }} + /> + ); }; AssigneesFilterPopoverComponent.displayName = 'AssigneesFilterPopover'; diff --git a/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx b/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx index cbfdb30d122aa..b56c926bab965 100644 --- a/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx @@ -18,6 +18,8 @@ import { EuiTextColor, EuiSpacer, useEuiTheme, + EuiFilterGroup, + EuiText, } from '@elastic/eui'; import { isEqual } from 'lodash/fp'; import * as i18n from './translations'; @@ -63,16 +65,17 @@ const getEuiSelectableCheckedOptions = ( ) => options.filter((option) => option.checked === 'on') as Array>; interface UseFilterParams { - buttonLabel?: string; buttonIconType?: string; + buttonLabel?: string; hideActiveOptionsNumber?: boolean; id: string; limit?: number; limitReachedMessage?: string; onChange: (params: { filterId: string; selectedOptionKeys: string[] }) => void; options: Array>; - selectedOptionKeys?: string[]; renderOption?: (option: FilterOption) => React.ReactNode; + selectedOptionKeys?: string[]; + transparentBackground?: boolean; } export const MultiSelectFilter = ({ buttonLabel, @@ -85,6 +88,7 @@ export const MultiSelectFilter = ({ options: rawOptions, selectedOptionKeys = [], renderOption, + transparentBackground, }: UseFilterParams) => { const { euiTheme } = useEuiTheme(); const [isPopoverOpen, setIsPopoverOpen] = useState(false); @@ -118,74 +122,85 @@ export const MultiSelectFilter = ({ }; return ( - 0 : undefined} - numActiveFilters={showActiveOptionsNumber ? selectedOptionKeys.length : undefined} - aria-label={buttonLabel} - > - {buttonLabel} - - } - isOpen={isPopoverOpen} - closePopover={() => setIsPopoverOpen(false)} - panelPaddingSize="none" - repositionOnScroll + - {isInvalid && ( - <> - - - - - )} - > - options={options} - searchable - searchProps={{ - placeholder: buttonLabel, - compressed: false, - 'data-test-subj': `${id}-search-input`, - }} - emptyMessage={i18n.EMPTY_FILTER_MESSAGE} - onChange={_onChange} - singleSelection={false} - renderOption={renderOption} - > - {(list, search) => ( -
0 : undefined} + numActiveFilters={showActiveOptionsNumber ? selectedOptionKeys.length : undefined} + aria-label={buttonLabel} > - {search} + + {buttonLabel} + + + } + isOpen={isPopoverOpen} + closePopover={() => setIsPopoverOpen(false)} + panelPaddingSize="none" + repositionOnScroll + > + {isInvalid && ( + <> + + + + + )} + > + options={options} + searchable + searchProps={{ + placeholder: buttonLabel, + compressed: false, + 'data-test-subj': `${id}-search-input`, + }} + emptyMessage={i18n.EMPTY_FILTER_MESSAGE} + onChange={_onChange} + singleSelection={false} + renderOption={renderOption} + > + {(list, search) => (
- {i18n.OPTIONS(options.length)} + {search} +
+ {i18n.OPTIONS(options.length)} +
+ + {list}
- - {list} -
- )} - -
+ )} + + + ); }; diff --git a/x-pack/plugins/cases/public/components/all_cases/table_filter_config/more_filters_selectable.tsx b/x-pack/plugins/cases/public/components/all_cases/table_filter_config/more_filters_selectable.tsx index e89ff2af07242..d191b339a05aa 100644 --- a/x-pack/plugins/cases/public/components/all_cases/table_filter_config/more_filters_selectable.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/table_filter_config/more_filters_selectable.tsx @@ -27,6 +27,7 @@ export const MoreFiltersSelectable = ({ onChange={onChange} options={options} selectedOptionKeys={activeFilters} + transparentBackground={true} /> ); }; diff --git a/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx b/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx index 17854c7c33547..ad8c63350e3ab 100644 --- a/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/table_filters.test.tsx @@ -534,7 +534,7 @@ describe('CasesTableFilters ', () => { userEvent.click(screen.getByRole('option', { name: 'Toggle' })); expect(screen.getByRole('button', { name: 'Toggle' })).toBeInTheDocument(); - const filterBar = screen.getByTestId('cases-table-filters-group'); + const filterBar = screen.getByTestId('cases-table-filters'); const allFilters = within(filterBar).getAllByRole('button'); const orderedFilterLabels = ['Severity', 'Status', 'Tags', 'Categories', 'Toggle', 'More']; orderedFilterLabels.forEach((label, index) => { @@ -587,7 +587,7 @@ describe('CasesTableFilters ', () => { userEvent.click(screen.getByRole('option', { name: 'Status' })); expect(screen.queryByRole('button', { name: 'Status' })).not.toBeInTheDocument(); - const filterBar = screen.getByTestId('cases-table-filters-group'); + const filterBar = screen.getByTestId('cases-table-filters'); const allFilters = within(filterBar).getAllByRole('button'); const orderedFilterLabels = ['Severity', 'Tags', 'Categories', 'More']; orderedFilterLabels.forEach((label, index) => { @@ -673,7 +673,7 @@ describe('CasesTableFilters ', () => { appMockRender.render(); - const filterBar = screen.getByTestId('cases-table-filters-group'); + const filterBar = screen.getByTestId('cases-table-filters'); let allFilters: HTMLElement[]; await waitFor(() => { allFilters = within(filterBar).getAllByRole('button'); @@ -703,7 +703,7 @@ describe('CasesTableFilters ', () => { appMockRender.render(); - const filterBar = screen.getByTestId('cases-table-filters-group'); + const filterBar = screen.getByTestId('cases-table-filters'); let allFilters: HTMLElement[]; await waitFor(() => { allFilters = within(filterBar).getAllByRole('button'); @@ -756,7 +756,7 @@ describe('CasesTableFilters ', () => { it('when a filter is active and isnt last in the list, it should move the filter to last position after deactivating and activating', async () => { appMockRender.render(); - const filterBar = screen.getByTestId('cases-table-filters-group'); + const filterBar = screen.getByTestId('cases-table-filters'); let allFilters = within(filterBar).getAllByRole('button'); let orderedFilterLabels = ['Severity', 'Status', 'Tags', 'Categories', 'More']; orderedFilterLabels.forEach((label, index) => { @@ -788,7 +788,7 @@ describe('CasesTableFilters ', () => { }); appMockRender.render(); - const filterBar = screen.getByTestId('cases-table-filters-group'); + const filterBar = screen.getByTestId('cases-table-filters'); let allFilters: HTMLElement[]; await waitFor(() => { allFilters = within(filterBar).getAllByRole('button'); diff --git a/x-pack/plugins/cases/public/components/all_cases/table_filters.tsx b/x-pack/plugins/cases/public/components/all_cases/table_filters.tsx index 8d472402b4e77..8672671bd8ab6 100644 --- a/x-pack/plugins/cases/public/components/all_cases/table_filters.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/table_filters.tsx @@ -6,7 +6,7 @@ */ import React, { useCallback, useState } from 'react'; -import { EuiFlexGroup, EuiFlexItem, EuiFieldSearch, EuiFilterGroup, EuiButton } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiFieldSearch, EuiButton } from '@elastic/eui'; import { mergeWith, isEqual } from 'lodash'; import { MoreFiltersSelectable } from './table_filter_config/more_filters_selectable'; import type { CaseStatuses } from '../../../common/types/domain'; @@ -126,7 +126,12 @@ const CasesTableFiltersComponent = ({ }, [onCreateCasePressed]); return ( - + {isSelectorView && onCreateCasePressed ? ( - - - {activeFilters.map((filter) => ( - {filter.render({ filterOptions })} - ))} - {isSelectorView || ( - - )} - - + {activeFilters.map((filter) => ( + + {filter.render({ filterOptions })} + + ))} + + {isSelectorView || ( + + + + )} ); };