Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Exceptions] - Remove exceptions table search #88784

Merged
merged 2 commits into from
Jan 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@
*/

import React, { useMemo, useEffect, useCallback, useState } from 'react';
import {
EuiBasicTable,
EuiEmptyPrompt,
EuiLoadingContent,
EuiProgress,
EuiFieldSearch,
} from '@elastic/eui';
import { EuiBasicTable, EuiEmptyPrompt, EuiLoadingContent, EuiProgress } from '@elastic/eui';
import styled from 'styled-components';
import { History } from 'history';
import { set } from 'lodash/fp';

import { AutoDownload } from '../../../../../../common/components/auto_download/auto_download';
import { NamespaceType } from '../../../../../../../../lists/common';
Expand Down Expand Up @@ -77,14 +70,8 @@ export const ExceptionListsTable = React.memo<ExceptionListsTableProps>(
const [referenceModalState, setReferenceModalState] = useState<ReferenceModalState>(
exceptionReferenceModalInitialState
);
const [filters, setFilters] = useState<ExceptionListFilter>({
name: null,
list_id: null,
created_by: null,
});
const [loadingExceptions, exceptions, pagination, refreshExceptions] = useExceptionLists({
errorMessage: i18n.ERROR_EXCEPTION_LISTS,
filterOptions: filters,
http,
namespaceTypes: ['single', 'agnostic'],
notifications,
Expand Down Expand Up @@ -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 => {
setDeletingListIds([]);
setShowReferenceErrorModal(false);
Expand Down Expand Up @@ -354,17 +320,7 @@ export const ExceptionListsTable = React.memo<ExceptionListsTableProps>(
split
title={i18n.ALL_EXCEPTIONS}
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 && (
<Loader data-test-subj="loadingPanelAllRulesTable" overlay size="xl" />
Expand Down