diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx index 1b25a2cb91e8..280dd8acbc7e 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/exception_items_renderer.tsx @@ -81,6 +81,7 @@ export interface ExceptionBuilderProps { isAndDisabled: boolean; isNestedDisabled: boolean; isOrDisabled: boolean; + isOrHidden?: boolean; listId: string; listNamespaceType: NamespaceType; listType: ExceptionListType; @@ -103,6 +104,7 @@ export const ExceptionBuilderComponent = ({ isAndDisabled, isNestedDisabled, isOrDisabled, + isOrHidden = false, listId, listNamespaceType, listType, @@ -433,6 +435,7 @@ export const ExceptionBuilderComponent = ({ { expect(wrapper.find('[data-test-subj="exceptionsNestedButton"] button')).toHaveLength(0); }); + test('it hides "or" button', () => { + const wrapper = mount( + + ); + + expect(wrapper.find('[data-test-subj="exceptionsOrButton"] button')).toHaveLength(0); + }); + test('it invokes "onOrClicked" when "or" button is clicked', () => { const onOrClicked = jest.fn(); diff --git a/x-pack/plugins/lists/public/exceptions/components/builder/logic_buttons.tsx b/x-pack/plugins/lists/public/exceptions/components/builder/logic_buttons.tsx index 3846b844bb55..aa308ecdc345 100644 --- a/x-pack/plugins/lists/public/exceptions/components/builder/logic_buttons.tsx +++ b/x-pack/plugins/lists/public/exceptions/components/builder/logic_buttons.tsx @@ -20,6 +20,7 @@ interface BuilderLogicButtonsProps { isNested: boolean; isNestedDisabled: boolean; isOrDisabled: boolean; + isOrHidden?: boolean; showNestedButton: boolean; onAddClickWhenNested: () => void; onAndClicked: () => void; @@ -32,6 +33,7 @@ export const BuilderLogicButtons: React.FC = ({ isNested, isNestedDisabled = true, isOrDisabled = false, + isOrHidden = false, showNestedButton = false, onAddClickWhenNested, onAndClicked, @@ -50,18 +52,20 @@ export const BuilderLogicButtons: React.FC = ({ {i18n.AND} - - - {i18n.OR} - - + {!isOrHidden && ( + + + {i18n.OR} + + + )} {showNestedButton && ( = memo( listNamespaceType: 'agnostic', ruleName: RULE_NAME, indexPatterns, - isOrDisabled: true, // TODO: pending to be validated + isOrDisabled: true, + isOrHidden: true, isAndDisabled: false, isNestedDisabled: false, dataTestSubj: 'alert-exception-builder',