grafana/public/app/features/explore/ErrorContainer.tsx
Lukas Siatka 688283a5cc
Explore: adds QueryRowErrors component, moves error display to QueryRow (#22438)
* Explore: adds QueryRowErrors component

* Explore: updates QueryRow to use QueryRowErrors component

* Explore: updates PromQueryField to remove error render

* Explore: updates Elastic query field  to remove error render

* Explore: updates LokiQueryFieldForm to remove error render

* Explore: updates QueryRow component - brings back passing errors down

* Explore: removes QueryRowErrors component

* Explore: updates ErrorContainer component - moves out data filtering

* Explore: updates QueryRow component - changes QueryRowErrors to ErrorContainer

* Explore: updates Explore component - adds error filtering for ErrorContainer

* Explore: updates ErrorContainer and adds a basic test for it

* Explore: updates Explore component props name and adds a basic render test

* Explore: adds snapshots for Explore and ErrorContainer

* Explore: adds a test for error render

* Explore: adds a comment to Explore component explaining the way we filter non-query-row-specific errors

* Explore: adds getFirstNonQueryRowSpecificError method to explore utilities

* Explore: extracts getFirstNonQueryRowSpecificError method and slightly refactors Explore component

* Explore: updates Explore component tests to cover non-query-row-specific errors
2020-03-11 10:01:58 +01:00

30 lines
915 B
TypeScript

import React, { FunctionComponent } from 'react';
import { DataQueryError } from '@grafana/data';
import { FadeIn } from 'app/core/components/Animations/FadeIn';
export interface ErrorContainerProps {
queryError?: DataQueryError;
}
export const ErrorContainer: FunctionComponent<ErrorContainerProps> = props => {
const { queryError } = props;
const showError = queryError ? true : false;
const duration = showError ? 100 : 10;
const message = queryError ? queryError.message : null;
return (
<FadeIn in={showError} duration={duration}>
<div className="alert-container">
<div className="alert-error alert">
<div className="alert-icon">
<i className="fa fa-exclamation-triangle" />
</div>
<div className="alert-body">
<div className="alert-title">{message}</div>
</div>
</div>
</div>
</FadeIn>
);
};