Skip to content

Commit

Permalink
Fixed text on banners
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Oct 2, 2020
1 parent 086534b commit 64cf479
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
EuiBetaBadge,
EuiButtonEmpty,
EuiButton,
EuiTextColor,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -113,11 +112,11 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
history.push(routeToAlertDetails.replace(`:alertId`, alert.id));
};

const getAlertStatusErrorReason = () => {
if (alert.executionStatus.error) {
return alert.executionStatus.error.reason;
const getAlertStatusErrorReasonText = () => {
if (alert.executionStatus.error && alert.executionStatus.error.reason !== 'unknown') {
return `An error occurred when ${alert.executionStatus.error.reason} the alert.`;
} else {
return 'unknown';
return 'An error occurred for unknown reasons.';
}
};

Expand Down Expand Up @@ -293,27 +292,14 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
color="danger"
data-test-subj="alertErrorBanner"
size="s"
title={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.attentionBannerTitle"
defaultMessage="This alert has an error caused by the {errorReason} reason."
values={{
errorReason: getAlertStatusErrorReason(),
}}
/>
}
title={i18n.translate(
'xpack.triggersActionsUI.sections.alertDetails.attentionBannerTitle',
{
defaultMessage: `${getAlertStatusErrorReasonText()}`,
}
)}
iconType="alert"
>
<EuiTitle size="m">
<h3>
<EuiTextColor color="danger">
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.alertErrorMessageTitle"
defaultMessage="Error message:"
/>
</EuiTextColor>
</h3>
</EuiTitle>
<EuiText size="s" color="danger" data-test-subj="alertErrorMessageText">
{alert.executionStatus.error?.message}
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export const AlertsList: React.FunctionComponent = () => {
title={
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertsList.attentionBannerTitle"
defaultMessage="Found {totalStausesError} {totalStausesError, plural, one {{singleTitle}} other {# {multipleTitle}}} with an error."
defaultMessage="Error found in {totalStausesError} {totalStausesError, plural, one {{singleTitle}} other {# {multipleTitle}}}."
values={{
totalStausesError: alertsStatusesTotal.error,
singleTitle: 'alert',
Expand Down

0 comments on commit 64cf479

Please sign in to comment.