Skip to content

Commit

Permalink
Add error handling message
Browse files Browse the repository at this point in the history
  • Loading branch information
fkanout committed Jul 29, 2022
1 parent 5c944e0 commit 10068aa
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
TooltipType,
} from '@elastic/charts';
import {
EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
EuiLoadingSpinner,
Expand Down Expand Up @@ -72,7 +73,32 @@ export const RuleAlertsSummary = ({ rule, filteredRuleTypes }: RuleAlertsSummary
}, [rule, ruleTypes]);

if (isLoadingRuleAlertsAggs) return <EuiLoadingSpinner />;
if (errorRuleAlertsAggs) return <EuiFlexItem>Error</EuiFlexItem>;
if (errorRuleAlertsAggs)
return (
<EuiEmptyPrompt
iconType="alert"
color="danger"
title={
<h5>
<FormattedMessage
id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.errorLoadingTitle"
defaultMessage="Unable to load the alerts summary"
/>
</h5>
}
body={
<p>
{
<FormattedMessage
id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.errorLoadingBody"
defaultMessage=" There was an error loading the alerts summary. Contact your
administrator for help."
/>
}
</p>
}
/>
);
const isVisibleFunction: FilterPredicate = (series) => series.splitAccessors.get('g') !== 'total';
return (
<EuiPanel hasShadow={false} hasBorder>
Expand Down

0 comments on commit 10068aa

Please sign in to comment.