From 187278aa082c5bb89b44d2d939745a5e41815185 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 27 Jun 2022 21:55:40 +0000 Subject: [PATCH] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../exception_item_card_conditions.test.tsx | 32 +++---- .../exception_item_card_conditions.tsx | 87 ++++++++----------- .../exception_item_card_header.test.tsx | 78 +++++++++-------- .../exception_item_card_header.tsx | 23 +++-- .../exception_item_card_meta.tsx | 53 +++++------ .../viewer/exception_item_card/index.tsx | 22 ++--- .../exception_item_card/translations.ts | 56 ++++++++---- 7 files changed, 184 insertions(+), 167 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.test.tsx index 91c73636654b0..fa770fd20cb6b 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.test.tsx @@ -18,34 +18,34 @@ describe('ExceptionItemCardConditions', () => { ); - + // Text is gonna look a bit off unformatted expect( wrapper.find('[data-test-subj="exceptionItemConditions-condition"]').at(0).text() diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.tsx index 7f5376e3a856b..4b884d2de4809 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_conditions.tsx @@ -6,15 +6,13 @@ */ import React, { memo, useCallback } from 'react'; -import { - EuiExpression, - EuiToken, - EuiFlexGroup, - EuiFlexItem, - EuiBadge, -} from '@elastic/eui'; +import { EuiExpression, EuiToken, EuiFlexGroup, EuiFlexItem, EuiBadge } from '@elastic/eui'; import styled from 'styled-components'; -import { ExceptionListItemSchema, ListOperatorTypeEnum, NonEmptyNestedEntriesArray } from '@kbn/securitysolution-io-ts-list-types'; +import { + ExceptionListItemSchema, + ListOperatorTypeEnum, + NonEmptyNestedEntriesArray, +} from '@kbn/securitysolution-io-ts-list-types'; import * as i18n from './translations'; @@ -65,40 +63,34 @@ export const ExceptionItemCardConditions = memo( const getNestedEntriesContent = useCallback( (type: string, nestedEntries: NonEmptyNestedEntriesArray) => { if (type === 'nested' && nestedEntries.length) { - return nestedEntries.map( - (entry) => { - const { - field: nestedField, - type: nestedType, - operator: nestedOperator, - } = entry; - const nestedValue = "value" in entry ? entry.value : ''; + return nestedEntries.map((entry) => { + const { field: nestedField, type: nestedType, operator: nestedOperator } = entry; + const nestedValue = 'value' in entry ? entry.value : ''; - return ( - - - - - - - - - - - - ); - } - ); + return ( + + + + + + + + + + + + ); + }); } }, [] @@ -107,13 +99,10 @@ export const ExceptionItemCardConditions = memo( return (
{entries.map((entry, index) => { - const { - field, - type - } = entry; - const value = "value" in entry ? entry.value : ''; - const nestedEntries = "entries" in entry ? entry.entries : []; - const operator = "operator" in entry ? entry.operator : ''; + const { field, type } = entry; + const value = 'value' in entry ? entry.value : ''; + const nestedEntries = 'entries' in entry ? entry.entries : []; + const operator = 'operator' in entry ? entry.operator : ''; return (
@@ -121,7 +110,7 @@ export const ExceptionItemCardConditions = memo( { key: 'edit', icon: 'pencil', label: i18n.EXCEPTION_ITEM_EDIT_BUTTON, - onClick: jest.fn() + onClick: jest.fn(), }, { key: 'delete', icon: 'trash', label: i18n.EXCEPTION_ITEM_DELETE_BUTTON, - onClick: jest.fn() + onClick: jest.fn(), }, ]} /> ); - expect( - wrapper.find('[data-test-subj="exceptionItemHeader-title"]').at(0).text() - ).toEqual('some name'); + expect(wrapper.find('[data-test-subj="exceptionItemHeader-title"]').at(0).text()).toEqual( + 'some name' + ); }); it('it displays actions', () => { @@ -59,29 +59,32 @@ describe('ExceptionItemCardHeader', () => { ); - + // click on popover - wrapper.find('button[data-test-subj="exceptionItemHeader-actionButton"]').at(0).simulate('click'); + wrapper + .find('button[data-test-subj="exceptionItemHeader-actionButton"]') + .at(0) + .simulate('click'); expect(wrapper.find('button[data-test-subj="exceptionItemHeader-actionItem"]')).toHaveLength(2); - + wrapper.find('button[data-test-subj="exceptionItemHeader-actionItem"]').at(0).simulate('click'); expect(handleEdit).toHaveBeenCalled(); @@ -96,26 +99,29 @@ describe('ExceptionItemCardHeader', () => { ); - - expect(wrapper.find('button[data-test-subj="exceptionItemHeader-actionButton"]').at(0).props().disabled).toBeTruthy(); + + expect( + wrapper.find('button[data-test-subj="exceptionItemHeader-actionButton"]').at(0).props() + .disabled + ).toBeTruthy(); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_header.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_header.tsx index 7a93a0b9258ca..ea69fb36068be 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_header.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_header.tsx @@ -6,12 +6,21 @@ */ import React, { memo, useMemo, useState } from 'react'; -import { EuiButtonIcon, EuiContextMenuPanelProps, EuiContextMenuPanel, EuiFlexGroup, EuiFlexItem, EuiPopover, EuiTitle, EuiContextMenuItem } from '@elastic/eui'; +import { + EuiButtonIcon, + EuiContextMenuPanelProps, + EuiContextMenuPanel, + EuiFlexGroup, + EuiFlexItem, + EuiPopover, + EuiTitle, + EuiContextMenuItem, +} from '@elastic/eui'; import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; export interface ExceptionItemCardHeaderProps { item: ExceptionListItemSchema; - actions: Array<{ key: string; icon: string; label: string; onClick: () => void; }>; + actions: Array<{ key: string; icon: string; label: string; onClick: () => void }>; disableActions?: boolean; dataTestSubj: string; } @@ -36,9 +45,9 @@ export const ExceptionItemCardHeader = memo( > {action.label} - )) + )); }, []); - + return ( @@ -48,7 +57,7 @@ export const ExceptionItemCardHeader = memo( ( onClick={onItemActionsClick} data-test-subj={`${dataTestSubj}-actionButton`} /> - )} + } panelPaddingSize="none" isOpen={isPopoverOpen} closePopover={onClosePopover} data-test-subj={`${dataTestSubj}-items`} > - + diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_meta.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_meta.tsx index 1153f49ae6088..8a1d8c00a1aec 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_meta.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/exception_item_card_meta.tsx @@ -19,7 +19,6 @@ export interface ExceptionItemCardMetaInfoProps { export const ExceptionItemCardMetaInfo = memo( ({ item, dataTestSubj }) => { - return ( ( data-test-subj={dataTestSubj} > - - )} + + } value2={item.created_by} dataTestSubj={`${dataTestSubj}-createdBy`} /> @@ -43,13 +41,13 @@ export const ExceptionItemCardMetaInfo = memo( - )} + } value2={item.updated_by} dataTestSubj={`${dataTestSubj}-updatedBy`} /> @@ -70,36 +68,33 @@ interface MetaInfoDetailsProps { const MetaInfoDetails = memo(({ label, value1, value2, dataTestSubj }) => { return ( - + - + - {value1} + + {value1} + - {i18n.EXCEPTION_ITEM_META_BY} + + {i18n.EXCEPTION_ITEM_META_BY} + - - {value2} + + + {value2} + diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/index.tsx index c65fca36e5b7d..c520d4f59fb43 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/index.tsx @@ -66,7 +66,7 @@ const ExceptionItemCardComponent = ({ return ( - + @@ -95,20 +95,20 @@ const ExceptionItemCardComponent = ({ /> - + {formattedComments.length > 0 && ( + buttonContent={ + {i18n.exceptionItemCommentsAccordion(formattedComments.length)} - )} + } arrowDisplay="none" data-test-subj="exceptionsViewerCommentAccordion" > diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/translations.ts b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/translations.ts index 793bd8984a3eb..bbd5f2fbaa155 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exception_item_card/translations.ts @@ -7,25 +7,40 @@ import { i18n } from '@kbn/i18n'; -export const EXCEPTION_ITEM_EDIT_BUTTON = i18n.translate('xpack.securitySolution.exceptions.exceptionItem.editItemButton', { - defaultMessage: 'Edit item', -}); +export const EXCEPTION_ITEM_EDIT_BUTTON = i18n.translate( + 'xpack.securitySolution.exceptions.exceptionItem.editItemButton', + { + defaultMessage: 'Edit item', + } +); -export const EXCEPTION_ITEM_DELETE_BUTTON = i18n.translate('xpack.securitySolution.exceptions.exceptionItem.deleteItemButton', { - defaultMessage: 'Delete item', -}); +export const EXCEPTION_ITEM_DELETE_BUTTON = i18n.translate( + 'xpack.securitySolution.exceptions.exceptionItem.deleteItemButton', + { + defaultMessage: 'Delete item', + } +); -export const EXCEPTION_ITEM_CREATED_LABEL = i18n.translate('xpack.securitySolution.exceptions.exceptionItem.createdLabel', { - defaultMessage: 'Created', -}); +export const EXCEPTION_ITEM_CREATED_LABEL = i18n.translate( + 'xpack.securitySolution.exceptions.exceptionItem.createdLabel', + { + defaultMessage: 'Created', + } +); -export const EXCEPTION_ITEM_UPDATED_LABEL = i18n.translate('xpack.securitySolution.exceptions.exceptionItem.updatedLabel', { - defaultMessage: 'Updated', -}); +export const EXCEPTION_ITEM_UPDATED_LABEL = i18n.translate( + 'xpack.securitySolution.exceptions.exceptionItem.updatedLabel', + { + defaultMessage: 'Updated', + } +); -export const EXCEPTION_ITEM_META_BY = i18n.translate('xpack.securitySolution.exceptions.exceptionItem.metaDetailsBy', { - defaultMessage: 'by', -}); +export const EXCEPTION_ITEM_META_BY = i18n.translate( + 'xpack.securitySolution.exceptions.exceptionItem.metaDetailsBy', + { + defaultMessage: 'by', + } +); export const exceptionItemCommentsAccordion = (comments: number) => i18n.translate('xpack.securitySolution.exceptions.exceptionItem.showCommentsLabel', { @@ -39,7 +54,7 @@ export const DESCRIPTOR_WHEN = i18n.translate( defaultMessage: 'WHEN', } ); - + export const CONDITION_OPERATOR_TYPE_MATCH = i18n.translate( 'xpack.securitySolution.exceptions.exceptionItem.conditions.matchOperator', { @@ -96,6 +111,9 @@ export const CONDITION_OPERATOR_TYPE_LIST = i18n.translate( } ); -export const CONDITION_AND = i18n.translate('xpack.securitySolution.exceptions.exceptionItem.conditions.and', { - defaultMessage: 'AND', -}); +export const CONDITION_AND = i18n.translate( + 'xpack.securitySolution.exceptions.exceptionItem.conditions.and', + { + defaultMessage: 'AND', + } +);