From fccdb714941561d6d0bd79ce41c8fe610fcfbe7f Mon Sep 17 00:00:00 2001 From: Yuliia Naumenko Date: Sat, 29 May 2021 15:20:54 -0700 Subject: [PATCH] fixed due to comments --- .../components/rules/step_rule_actions/schema.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions/schema.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions/schema.tsx index 7129000cb7648..a697d922eda97 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions/schema.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions/schema.tsx @@ -42,18 +42,17 @@ export const validateRuleActionsField = (actionTypeRegistry: ActionTypeRegistryC ): Promise | void | undefined> => { const [{ value, path }] = data as [{ value: AlertAction[]; path: string }]; - const errors = await value.reduce(async (acc, actionItem) => { + const errors = []; + for (const actionItem of value) { const errorsArray = await validateSingleAction(actionItem, actionTypeRegistry); if (errorsArray.length) { const actionTypeName = getActionTypeName(actionItem.actionTypeId); const errorsListItems = errorsArray.map((error) => `* ${error}\n`); - return [...(await acc), `\n**${actionTypeName}:**\n${errorsListItems.join('')}`]; + errors.push(`\n**${actionTypeName}:**\n${errorsListItems.join('')}`); } - - return acc; - }, Promise.resolve([] as string[])); + } if (errors.length) { return {