diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/save_with_errors_confirmation/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/save_with_errors_confirmation/index.tsx index 839513bf0e34c..3f14945bedadc 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/save_with_errors_confirmation/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/save_with_errors_confirmation/index.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { EuiConfirmModal } from '@elastic/eui'; +import { EuiConfirmModal, EuiSpacer, EuiText } from '@elastic/eui'; import * as i18n from './translations'; @@ -32,7 +32,19 @@ const SaveWithErrorsModalComponent = ({ confirmButtonText={i18n.SAVE_WITH_ERRORS_CONFIRM_BUTTON} defaultFocusedButton="confirm" > - <>{i18n.SAVE_WITH_ERRORS_MODAL_MESSAGE(errors.length)} + <> + {i18n.SAVE_WITH_ERRORS_MODAL_MESSAGE(errors.length)} + + + ); }; diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/pages/rule_editing/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/pages/rule_editing/index.tsx index 1ecbde5b00d7b..6c139acbbdbff 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/pages/rule_editing/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/pages/rule_editing/index.tsx @@ -436,11 +436,20 @@ const EditRulePageComponent: FC<{ rule: RuleResponse }> = ({ rule }) => { const onSubmit = useCallback(async () => { setNonBlockingRuleErrors([]); + const actionsStepFormValid = await actionsStepForm.validate(); + if (rule.immutable) { + // Since users cannot edit Define, About and Schedule tabs of the rule, we skip validation of those to avoid + // user confusion of seeing that those tabs have error and not being able to see or do anything about that. + // We will need to remove this condition once rule customization work is done. + if (actionsStepFormValid) { + await saveChanges(); + } + return; + } + const defineStepFormValid = await defineStepForm.validate(); const aboutStepFormValid = await aboutStepForm.validate(); const scheduleStepFormValid = await scheduleStepForm.validate(); - const actionsStepFormValid = await actionsStepForm.validate(); - if ( defineStepFormValid && aboutStepFormValid && @@ -465,6 +474,7 @@ const EditRulePageComponent: FC<{ rule: RuleResponse }> = ({ rule }) => { showSaveWithErrorsModal(); } }, [ + rule.immutable, defineStepForm, aboutStepForm, scheduleStepForm, diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/eql_rule.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/eql_rule.cy.ts index a14218fcdda56..dea2e554e8e4f 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/eql_rule.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/eql_rule.cy.ts @@ -231,7 +231,6 @@ describe('EQL rules', { tags: ['@ess', '@serverless'] }, () => { const rule = getEqlRule(); it('validates missing data source', () => { - login(); visit(CREATE_RULE_URL); selectEqlRuleType(); getIndexPatternClearButton().click(); @@ -258,7 +257,6 @@ describe('EQL rules', { tags: ['@ess', '@serverless'] }, () => { }); it('validates missing data fields', () => { - login(); visit(CREATE_RULE_URL); selectEqlRuleType(); @@ -282,7 +280,6 @@ describe('EQL rules', { tags: ['@ess', '@serverless'] }, () => { }); it('validates syntax errors', () => { - login(); visit(CREATE_RULE_URL); selectEqlRuleType();