diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.test.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.test.tsx index cfcab676a4571..0ba8847c4148d 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.test.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.test.tsx @@ -16,20 +16,6 @@ import type { RequiredFieldInput } from '../../../../../common/api/detection_eng const ADD_REQUIRED_FIELD_BUTTON_TEST_ID = 'addRequiredFieldButton'; const REQUIRED_FIELDS_GENERAL_WARNING_TEST_ID = 'requiredFieldsGeneralWarning'; -jest.mock('../../../../common/lib/kibana', () => ({ - useKibana: jest.fn().mockReturnValue({ - services: { - docLinks: { - links: { - securitySolution: { - createDetectionRules: 'http://link-to-docs', - }, - }, - }, - }, - }), -})); - describe('RequiredFields form part', () => { it('displays the required fields label', () => { render(); @@ -228,7 +214,7 @@ describe('RequiredFields form part', () => { expect( screen.getByText( - 'Field "field-that-does-not-exist" is not found within specified index patterns' + `Field "field-that-does-not-exist" is not found within the rule's specified index patterns` ) ).toBeVisible(); @@ -255,7 +241,7 @@ describe('RequiredFields form part', () => { expect( screen.getByText( - 'Field "field1" with type "type-that-does-not-exist" is not found within specified index patterns' + `Field "field1" with type "type-that-does-not-exist" is not found within the rule's specified index patterns` ) ).toBeVisible(); @@ -284,7 +270,7 @@ describe('RequiredFields form part', () => { expect( screen.getByText( - 'Field "field-that-does-not-exist" is not found within specified index patterns' + `Field "field-that-does-not-exist" is not found within the rule's specified index patterns` ) ).toBeVisible(); diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.tsx index 803a3c46ec344..3f975ce098998 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields.tsx @@ -7,12 +7,14 @@ import React, { useMemo } from 'react'; import { EuiButtonEmpty, EuiCallOut, EuiFormRow, EuiSpacer, EuiText } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; import type { DataViewFieldBase } from '@kbn/es-query'; import type { RequiredFieldInput } from '../../../../../common/api/detection_engine'; import { UseArray, useFormData } from '../../../../shared_imports'; import type { FormHook, ArrayItem } from '../../../../shared_imports'; import { RequiredFieldsHelpInfo } from './required_fields_help_info'; import { RequiredFieldRow } from './required_fields_row'; +import * as defineRuleI18n from '../../../rule_creation_ui/components/step_define_rule/translations'; import * as i18n from './translations'; interface RequiredFieldsComponentProps { @@ -157,7 +159,15 @@ const RequiredFieldsList = ({ iconType="help" data-test-subj="requiredFieldsGeneralWarning" > -

{i18n.REQUIRED_FIELDS_GENERAL_WARNING_DESCRIPTION}

+

+ {defineRuleI18n.SOURCE}, + }} + /> +

)} diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx index 5fc7117e8bfce..2ae61bfc0152e 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx @@ -7,9 +7,10 @@ import React from 'react'; import { useToggle } from 'react-use'; -import { EuiLink, EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui'; +import { EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useKibana } from '../../../../common/lib/kibana'; +import * as defineRuleI18n from '../../../rule_creation_ui/components/step_define_rule/translations'; +import * as i18n from './translations'; /** * Theme doesn't expose width variables. Using provided size variables will require @@ -22,13 +23,12 @@ const POPOVER_WIDTH = 320; export function RequiredFieldsHelpInfo(): JSX.Element { const [isPopoverOpen, togglePopover] = useToggle(false); - const { docLinks } = useKibana().services; const button = ( ); @@ -37,16 +37,9 @@ export function RequiredFieldsHelpInfo(): JSX.Element { - - - ), + source: {defineRuleI18n.SOURCE}, }} /> diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/translations.ts b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/translations.ts index da966f29fa08f..bed9a4ea0024c 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/translations.ts +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/translations.ts @@ -28,17 +28,17 @@ export const FIELD_TYPE = i18n.translate( } ); -export const REQUIRED_FIELDS_GENERAL_WARNING_TITLE = i18n.translate( - 'xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.generalWarningTitle', +export const OPEN_HELP_POPOVER_ARIA_LABEL = i18n.translate( + 'xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.openHelpPopoverAriaLabel', { - defaultMessage: 'Some fields are not found within specified index patterns.', + defaultMessage: 'Open help popover', } ); -export const REQUIRED_FIELDS_GENERAL_WARNING_DESCRIPTION = i18n.translate( - 'xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.generalWarningDescription', +export const REQUIRED_FIELDS_GENERAL_WARNING_TITLE = i18n.translate( + 'xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.generalWarningTitle', { - defaultMessage: `This doesn't break rule execution, but it might indicate that required fields were set incorrectly. Please check that indices specified in index patterns exist and have expected fields and types in mappings.`, + defaultMessage: `Some fields aren't found within the rule's specified index patterns.`, } ); @@ -68,7 +68,7 @@ export const FIELD_NAME_NOT_FOUND_WARNING = (name: string) => 'xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.fieldNameNotFoundWarning', { values: { name }, - defaultMessage: `Field "{name}" is not found within specified index patterns`, + defaultMessage: `Field "{name}" is not found within the rule's specified index patterns`, } ); @@ -77,7 +77,7 @@ export const FIELD_TYPE_NOT_FOUND_WARNING = (name: string, type: string) => 'xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.fieldTypeNotFoundWarning', { values: { name, type }, - defaultMessage: `Field "{name}" with type "{type}" is not found within specified index patterns`, + defaultMessage: `Field "{name}" with type "{type}" is not found within the rule's specified index patterns`, } ); diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 00db92de8fb88..083ded718df5e 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -45103,4 +45103,4 @@ "xpack.serverlessObservability.nav.projectSettings": "Paramètres de projet", "xpack.serverlessObservability.nav.synthetics": "Synthetics" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 44c9d24e178e7..4cc917e9d5408 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -45073,4 +45073,4 @@ "xpack.serverlessObservability.nav.projectSettings": "プロジェクト設定", "xpack.serverlessObservability.nav.synthetics": "Synthetics" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 26974aebbaf97..b12268d5c4673 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -45121,4 +45121,4 @@ "xpack.serverlessObservability.nav.projectSettings": "项目设置", "xpack.serverlessObservability.nav.synthetics": "Synthetics" } -} \ No newline at end of file +}