From 526fcf3e68c92d408676469f14ef29e1ea4f5ae2 Mon Sep 17 00:00:00 2001 From: Gidi Meir Morris Date: Wed, 16 Sep 2020 13:53:26 +0100 Subject: [PATCH] updated copy --- .../server/builtin_action_types/es_index.ts | 34 +++++++++++------- .../test_connector_form.tsx | 36 +++++++------------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/x-pack/plugins/actions/server/builtin_action_types/es_index.ts b/x-pack/plugins/actions/server/builtin_action_types/es_index.ts index e652f82c28009..868c07b775c78 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/es_index.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/es_index.ts @@ -90,24 +90,34 @@ async function executor( const err = find(result.items, 'index.error.reason'); if (err) { - throw new Error( + return wrapErr( `${err.index.error!.reason}${ err.index.error?.caused_by ? ` (${err.index.error?.caused_by?.reason})` : '' - }` + }`, + actionId, + logger ); } return { status: 'ok', data: result, actionId }; } catch (err) { - const message = i18n.translate('xpack.actions.builtin.esIndex.errorIndexingErrorMessage', { - defaultMessage: 'error indexing documents', - }); - logger.error(`error indexing documents: ${err.message}`); - return { - status: 'error', - actionId, - message, - serviceMessage: err.message, - }; + return wrapErr(err.message, actionId, logger); } } + +function wrapErr( + errMessage: string, + actionId: string, + logger: Logger +): ActionTypeExecutorResult { + const message = i18n.translate('xpack.actions.builtin.esIndex.errorIndexingErrorMessage', { + defaultMessage: 'error indexing documents', + }); + logger.error(`error indexing documents: ${errMessage}`); + return { + status: 'error', + actionId, + message, + serviceMessage: errMessage, + }; +} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx index 07c764a83b8d8..a73fd4e22e637 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx @@ -51,7 +51,7 @@ export const TestConnectorForm = ({ const steps = [ { - title: 'Fill out an example action', + title: 'Create an action', children: ParamsFieldsComponent ? ( {executeEnabled ? null : ( @@ -92,7 +92,7 @@ export const TestConnectorForm = ({

@@ -109,7 +109,7 @@ export const TestConnectorForm = ({ onClick={onExecutAction} > @@ -118,7 +118,7 @@ export const TestConnectorForm = ({ ), }, { - title: 'Execution Result', + title: 'Results', children: pipe( executionResult, map((result) => @@ -137,20 +137,10 @@ export const TestConnectorForm = ({ }; const AwaitingExecution = () => ( - +

@@ -162,7 +152,7 @@ const SuccessfulExecution = () => ( title={i18n.translate( 'xpack.triggersActionsUI.sections.testConnectorForm.executionSuccessfulTitle', { - defaultMessage: 'Success', + defaultMessage: 'Action was successful', values: {}, } )} @@ -172,12 +162,13 @@ const SuccessfulExecution = () => ( >

); + const FailedExecussion = ({ executionResult: { message, serviceMessage }, }: { @@ -188,8 +179,7 @@ const FailedExecussion = ({ title: i18n.translate( 'xpack.triggersActionsUI.sections.testConnectorForm.executionFailureDescription', { - defaultMessage: - 'This action has failed to execute and has resulted in the following message:', + defaultMessage: 'The following error was found:', } ), description: @@ -207,7 +197,7 @@ const FailedExecussion = ({ title: i18n.translate( 'xpack.triggersActionsUI.sections.testConnectorForm.executionFailureAdditionalDetails', { - defaultMessage: 'Some additional details have been provided by the action:', + defaultMessage: 'Details:', } ), description: serviceMessage, @@ -218,7 +208,7 @@ const FailedExecussion = ({ title={i18n.translate( 'xpack.triggersActionsUI.sections.testConnectorForm.executionFailureTitle', { - defaultMessage: 'Error', + defaultMessage: 'Action failed to run', } )} data-test-subj="executionFailureResult"