## Summary Temporarily addresses https://github.com/elastic/kibana/issues/88450 A follow PR will address full fix. ### Issue Exceptions table search not functioning as expected. ### Diagnostic The exception list SO properties are mapped as keywords, meaning ES does not tokenize them. Need to add a `text` mapping for fields we want to search on in order for search to work as expected. Expectations for exceptions table search being: - I can search `Endpoint Security` and get results that match `Endpoint` or `Security` - I can search `"Endpoint Security"` and it will conduct an exact match search It's too late in the release cycle for mappings updates - a follow up PR will properly fix search. ### Without Search <img width="1766" alt="Screen Shot 2021-01-19 at 7 52 01 PM" src="https://user-images.githubusercontent.com/10927944/105112279-aed64300-5a90-11eb-95fc-1922eb2055e9.png"> ### Checklist - [ ] [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
This commit is contained in:
parent
4435006217
commit
f718e90a81
|
@ -5,16 +5,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useMemo, useEffect, useCallback, useState } from 'react';
|
import React, { useMemo, useEffect, useCallback, useState } from 'react';
|
||||||
import {
|
import { EuiBasicTable, EuiEmptyPrompt, EuiLoadingContent, EuiProgress } from '@elastic/eui';
|
||||||
EuiBasicTable,
|
|
||||||
EuiEmptyPrompt,
|
|
||||||
EuiLoadingContent,
|
|
||||||
EuiProgress,
|
|
||||||
EuiFieldSearch,
|
|
||||||
} from '@elastic/eui';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { History } from 'history';
|
import { History } from 'history';
|
||||||
import { set } from 'lodash/fp';
|
|
||||||
|
|
||||||
import { AutoDownload } from '../../../../../../common/components/auto_download/auto_download';
|
import { AutoDownload } from '../../../../../../common/components/auto_download/auto_download';
|
||||||
import { NamespaceType } from '../../../../../../../../lists/common';
|
import { NamespaceType } from '../../../../../../../../lists/common';
|
||||||
|
@ -77,14 +70,8 @@ export const ExceptionListsTable = React.memo<ExceptionListsTableProps>(
|
||||||
const [referenceModalState, setReferenceModalState] = useState<ReferenceModalState>(
|
const [referenceModalState, setReferenceModalState] = useState<ReferenceModalState>(
|
||||||
exceptionReferenceModalInitialState
|
exceptionReferenceModalInitialState
|
||||||
);
|
);
|
||||||
const [filters, setFilters] = useState<ExceptionListFilter>({
|
|
||||||
name: null,
|
|
||||||
list_id: null,
|
|
||||||
created_by: null,
|
|
||||||
});
|
|
||||||
const [loadingExceptions, exceptions, pagination, refreshExceptions] = useExceptionLists({
|
const [loadingExceptions, exceptions, pagination, refreshExceptions] = useExceptionLists({
|
||||||
errorMessage: i18n.ERROR_EXCEPTION_LISTS,
|
errorMessage: i18n.ERROR_EXCEPTION_LISTS,
|
||||||
filterOptions: filters,
|
|
||||||
http,
|
http,
|
||||||
namespaceTypes: ['single', 'agnostic'],
|
namespaceTypes: ['single', 'agnostic'],
|
||||||
notifications,
|
notifications,
|
||||||
|
@ -236,27 +223,6 @@ export const ExceptionListsTable = React.memo<ExceptionListsTableProps>(
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleSearch = useCallback((search: string) => {
|
|
||||||
const regex = search.split(/\s+(?=([^"]*"[^"]*")*[^"]*$)/);
|
|
||||||
const formattedFilter = regex
|
|
||||||
.filter((c) => c != null)
|
|
||||||
.reduce<ExceptionListFilter>(
|
|
||||||
(filter, term) => {
|
|
||||||
const [qualifier, value] = term.split(':');
|
|
||||||
|
|
||||||
if (qualifier == null) {
|
|
||||||
filter.name = search;
|
|
||||||
} else if (value != null && Object.keys(filter).includes(qualifier)) {
|
|
||||||
return set(qualifier, value, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return filter;
|
|
||||||
},
|
|
||||||
{ name: null, list_id: null, created_by: null }
|
|
||||||
);
|
|
||||||
setFilters(formattedFilter);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleCloseReferenceErrorModal = useCallback((): void => {
|
const handleCloseReferenceErrorModal = useCallback((): void => {
|
||||||
setDeletingListIds([]);
|
setDeletingListIds([]);
|
||||||
setShowReferenceErrorModal(false);
|
setShowReferenceErrorModal(false);
|
||||||
|
@ -354,17 +320,7 @@ export const ExceptionListsTable = React.memo<ExceptionListsTableProps>(
|
||||||
split
|
split
|
||||||
title={i18n.ALL_EXCEPTIONS}
|
title={i18n.ALL_EXCEPTIONS}
|
||||||
subtitle={<LastUpdatedAt showUpdating={loading} updatedAt={lastUpdated} />}
|
subtitle={<LastUpdatedAt showUpdating={loading} updatedAt={lastUpdated} />}
|
||||||
>
|
/>
|
||||||
<EuiFieldSearch
|
|
||||||
data-test-subj="exceptionsHeaderSearch"
|
|
||||||
aria-label={i18n.EXCEPTIONS_LISTS_SEARCH_PLACEHOLDER}
|
|
||||||
placeholder={i18n.EXCEPTIONS_LISTS_SEARCH_PLACEHOLDER}
|
|
||||||
onSearch={handleSearch}
|
|
||||||
disabled={initLoading}
|
|
||||||
incremental={false}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
</HeaderSection>
|
|
||||||
|
|
||||||
{loadingTableInfo && !initLoading && !showReferenceErrorModal && (
|
{loadingTableInfo && !initLoading && !showReferenceErrorModal && (
|
||||||
<Loader data-test-subj="loadingPanelAllRulesTable" overlay size="xl" />
|
<Loader data-test-subj="loadingPanelAllRulesTable" overlay size="xl" />
|
||||||
|
|
Loading…
Reference in a new issue