diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 210ef172b78ea..5dbb563fda702 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2283,6 +2283,7 @@ x-pack/test/security_solution_cypress/cypress/tasks/expandable_flyout @elastic/ /x-pack/plugins/security_solution/public/common/components/with_hover_actions @elastic/security-threat-hunting-explore /x-pack/plugins/security_solution/public/common/containers/matrix_histogram @elastic/security-threat-hunting-explore /x-pack/plugins/security_solution/public/common/lib/cell_actions @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/hooks/use_form_with_warn @elastic/security-detection-rule-management /x-pack/plugins/security_solution/public/cases @elastic/security-threat-hunting-explore /x-pack/plugins/security_solution/public/explore @elastic/security-threat-hunting-explore /x-pack/plugins/security_solution/public/overview @elastic/security-threat-hunting-explore diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts index b586e0593ab6f..b26f935612755 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts @@ -36,11 +36,18 @@ interface Params { signal?: AbortSignal; } -export interface EqlResponseError { - code: EQL_ERROR_CODES; - messages?: string[]; - error?: Error; -} +export type EqlResponseError = + | { + code: + | EQL_ERROR_CODES.INVALID_SYNTAX + | EQL_ERROR_CODES.INVALID_EQL + | EQL_ERROR_CODES.MISSING_DATA_SOURCE; + messages: string[]; + } + | { + code: EQL_ERROR_CODES.FAILED_REQUEST; + error: Error; + }; export interface ValidateEqlResponse { valid: boolean; 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/common/hooks/use_confirm_validation_errors_modal/confirm_validation_errors_modal.tsx similarity index 59% rename from x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/save_with_errors_confirmation/index.tsx rename to x-pack/plugins/security_solution/public/common/hooks/use_confirm_validation_errors_modal/confirm_validation_errors_modal.tsx index 3f14945bedadc..52ef0465e39aa 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/common/hooks/use_confirm_validation_errors_modal/confirm_validation_errors_modal.tsx @@ -5,41 +5,39 @@ * 2.0. */ -import React from 'react'; - +import React, { memo } from 'react'; import { EuiConfirmModal, EuiSpacer, EuiText } from '@elastic/eui'; - import * as i18n from './translations'; -interface SaveWithErrorsModalProps { +interface ConfirmValidationErrorsModalProps { errors: string[]; onCancel: () => void; onConfirm: () => void; } -const SaveWithErrorsModalComponent = ({ +export const ConfirmValidationErrorsModal = memo(function ConfirmValidationErrorsModal({ errors, onCancel, onConfirm, -}: SaveWithErrorsModalProps) => { +}: ConfirmValidationErrorsModalProps): JSX.Element { return ( <> - {i18n.SAVE_WITH_ERRORS_MODAL_MESSAGE(errors.length)} + {i18n.SAVE_WITH_ERRORS_MESSAGE(errors.length)}