From b785fc914fd13bc0cc252dad6cb8e5a7860e35c7 Mon Sep 17 00:00:00 2001 From: Khristinin Nikita Date: Wed, 20 Jul 2022 15:43:40 +0200 Subject: [PATCH] Fix validation --- .../components/rules/step_define_rule/index.tsx | 16 +++++++--------- .../components/rules/step_define_rule/schema.tsx | 6 ------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx index 3944e44c0e0c1..eadd0983182b2 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx @@ -288,6 +288,12 @@ const StepDefineRuleComponent: FC = ({ const onChangeDataSource = useCallback( (optionId: string) => { form.setFieldValue('dataSourceType', optionId); + form.getFields().index.reset({ + resetValue: false, + }); + form.getFields().dataViewId.reset({ + resetValue: false, + }); }, [form] ); @@ -651,7 +657,7 @@ const StepDefineRuleComponent: FC = ({ let dataForDescription: Partial = initialState; if (dataSourceType === DataSourceType.IndexPatterns) { - dataForDescription = omit(initialState, ['dataSourceType', 'dataViewID']); + dataForDescription = omit(initialState, ['dataSourceType', 'dataViewId']); } else if (dataSourceType === DataSourceType.DataView) { dataForDescription = omit(initialState, ['dataSourceType', 'index']); } @@ -672,14 +678,6 @@ const StepDefineRuleComponent: FC = ({ = { }, ], }, - dataSourceType: { - defaultValue: DataSourceType.IndexPatterns, - fieldsToValidateOnChange: ['dataSourceType', 'index', 'dataViewId'], - type: FIELD_TYPES.TEXT, - validations: [], - }, };