Skip to content

Commit

Permalink
updated copy
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Sep 16, 2020
1 parent acfa049 commit 526fcf3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
34 changes: 22 additions & 12 deletions x-pack/plugins/actions/server/builtin_action_types/es_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown> {
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,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const TestConnectorForm = ({

const steps = [
{
title: 'Fill out an example action',
title: 'Create an action',
children: ParamsFieldsComponent ? (
<Suspense
fallback={
Expand Down Expand Up @@ -84,15 +84,15 @@ export const TestConnectorForm = ({
),
},
{
title: 'Execute the example action',
title: 'Run the action',
children: (
<Fragment>
{executeEnabled ? null : (
<Fragment>
<EuiCallOut iconType="alert" color="warning">
<p>
<FormattedMessage
defaultMessage="Unsaved changes must be saved before the connector can be tested"
defaultMessage="Save your changes before testing the connector."
id="xpack.triggersActionsUI.sections.testConnectorForm.executeTestDisabled"
/>
</p>
Expand All @@ -109,7 +109,7 @@ export const TestConnectorForm = ({
onClick={onExecutAction}
>
<FormattedMessage
defaultMessage="Execute"
defaultMessage="Run"
id="xpack.triggersActionsUI.sections.testConnectorForm.executeTestButton"
/>
</EuiButton>
Expand All @@ -118,7 +118,7 @@ export const TestConnectorForm = ({
),
},
{
title: 'Execution Result',
title: 'Results',
children: pipe(
executionResult,
map((result) =>
Expand All @@ -137,20 +137,10 @@ export const TestConnectorForm = ({
};

const AwaitingExecution = () => (
<EuiCallOut
title={i18n.translate(
'xpack.triggersActionsUI.sections.testConnectorForm.awaitingExecutionTitle',
{
defaultMessage: 'Awaiting Action Parameters',
values: {},
}
)}
data-test-subj="executionAwaiting"
iconType="iInCircle"
>
<EuiCallOut data-test-subj="executionAwaiting">
<p>
<FormattedMessage
defaultMessage="Once you provide the Action Parameters by filling out the form above, you may execute the action and the result will be displayed here."
defaultMessage="When you run the action, the results will show up here."
id="xpack.triggersActionsUI.sections.testConnectorForm.awaitingExecutionDescription"
/>
</p>
Expand All @@ -162,7 +152,7 @@ const SuccessfulExecution = () => (
title={i18n.translate(
'xpack.triggersActionsUI.sections.testConnectorForm.executionSuccessfulTitle',
{
defaultMessage: 'Success',
defaultMessage: 'Action was successful',
values: {},
}
)}
Expand All @@ -172,12 +162,13 @@ const SuccessfulExecution = () => (
>
<p>
<FormattedMessage
defaultMessage="This action was successfully executed. We recommend you ensure the action has resulted in the expected effect."
defaultMessage="Ensure the results are what you expect."
id="xpack.triggersActionsUI.sections.testConnectorForm.executionSuccessfulDescription"
/>
</p>
</EuiCallOut>
);

const FailedExecussion = ({
executionResult: { message, serviceMessage },
}: {
Expand All @@ -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:
Expand All @@ -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,
Expand All @@ -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"
Expand Down

0 comments on commit 526fcf3

Please sign in to comment.