Resetting errors and removing duplicates (#56054)

This commit is contained in:
igoristic 2020-01-28 11:25:04 -05:00 committed by GitHub
parent 8c2980213e
commit 9685eca401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 11 deletions

View file

@ -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) {

View file

@ -45,6 +45,7 @@ export class NoDataController extends MonitoringViewBaseController {
}
}
this.errors.length = 0;
if (catchReason) {
this.reason = catchReason;
} else if (!this.isCollectionEnabledUpdating && !this.isCollectionIntervalUpdating) {