Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
WafaaNasr committed Dec 2, 2022
1 parent 208a29e commit ce2aa16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ExceptionsAddToListsComponent: React.FC<ExceptionsAddToListsComponentProps
error,
isLoading,
pagination,
sortedLists,
lists,
listTableColumnsWithLinkSwitch,
onTableChange,
addToSelectedListDescription,
Expand All @@ -39,7 +39,7 @@ const ExceptionsAddToListsComponent: React.FC<ExceptionsAddToListsComponentProps
tableCaption="Table of exception lists"
data-test-subj="addExceptionToSharedListsTable"
error={error}
items={sortedLists}
items={lists}
loading={isLoading}
message={
isLoading ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {
EuiBasicTableColumn,
HorizontalAlignment,
} from '@elastic/eui';
import { EuiLoadingContent } from '@elastic/eui';

import type { ExceptionListSchema, ListArray } from '@kbn/securitysolution-io-ts-list-types';
import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
Expand Down Expand Up @@ -63,9 +62,6 @@ export const useAddToSharedListTable = ({
initialPageSize: 5,
showPerPageOptions: false,
});
const [message, setMessage] = useState<JSX.Element | string | undefined>(
<EuiLoadingContent lines={4} data-test-subj="exceptionItemListsTableLoading" />
);

const [error, setError] = useState<string | undefined>(undefined);

Expand All @@ -83,21 +79,21 @@ export const useAddToSharedListTable = ({
}
}, [listsToFetch]);

useEffect(() => {
getReferences();
}, [listsToFetch, getReferences]);

useEffect(() => {
const fillListsToDisplay = useCallback(async () => {
await getReferences();
if (exceptionListReferences) {
const lists: ExceptionListRuleReferencesSchema[] = [];
for (const [_, value] of Object.entries(exceptionListReferences))
if (value.type === ExceptionListTypeEnum.DETECTION) lists.push(value);

setMessage(undefined);
setListsToDisplay(lists);
setIsLoading(false);
}
}, [exceptionListReferences, showAllSharedLists]);
}, [exceptionListReferences, getReferences]);

useEffect(() => {
fillListsToDisplay();
}, [listsToFetch, getReferences, fillListsToDisplay]);

useEffect(() => {
onListSelectionChange(
Expand Down Expand Up @@ -148,9 +144,8 @@ export const useAddToSharedListTable = ({
return {
error,
isLoading,
message,
pagination,
sortedLists: listsToDisplay,
lists: listsToDisplay,
listTableColumnsWithLinkSwitch,
addToSelectedListDescription: i18n.ADD_TO_LISTS_DESCRIPTION,
onTableChange,
Expand Down

0 comments on commit ce2aa16

Please sign in to comment.