Skip to content

Commit

Permalink
Resetting errors and removing duplicates (#56054) (#56302)
Browse files Browse the repository at this point in the history
  • Loading branch information
igoristic authored Jan 29, 2020
1 parent b677cb1 commit e8f8b5c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,27 @@ import {
import { FormattedMessage } from '@kbn/i18n/react';

const ErrorList = ({ errors }) => {
return errors.map((error, errorIndex) => {
const { message, statusCode, error: friendlyName } = error;
return (
<Fragment key={`checker-error-${errorIndex}`}>
<EuiDescriptionListTitle>
{statusCode} {friendlyName}
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>{message}</EuiDescriptionListDescription>
</Fragment>
);
});
const errorsMap = {};
return errors
.filter(err => {
const { statusCode, error, message } = err;
const key = `${statusCode}${error}${message}`;
if (!errorsMap[key]) {
errorsMap[key] = true;
return true;
}
})
.map((error, errorIndex) => {
const { message, statusCode, error: friendlyName } = error;
return (
<Fragment key={`checker-error-${errorIndex}`}>
<EuiDescriptionListTitle>
{statusCode} {friendlyName}
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>{message}</EuiDescriptionListDescription>
</Fragment>
);
});
};

export function CheckerErrors(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class NoDataController extends MonitoringViewBaseController {
}
}

this.errors.length = 0;
if (catchReason) {
this.reason = catchReason;
} else if (!this.isCollectionEnabledUpdating && !this.isCollectionIntervalUpdating) {
Expand Down

0 comments on commit e8f8b5c

Please sign in to comment.