mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
Primarily- moving majority of the types and utils from @grafana/ui to @grafana/data * Move types from grafana-ui to grafana-data * Move valueFormats to grafana-data * Move utils from grafana-ui to grafana-data * Update imports in grafana-ui * revert data's tsconfig change * Update imports in grafana-runtime * Fix import paths in grafana-ui * Move rxjs to devDeps * Core import updates batch 1 * Import updates batch 2 * Imports fix batch 3 * Imports fixes batch i don't know * Fix imorts in grafana-toolkit * Fix imports after master merge
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import React, { FunctionComponent } from 'react';
|
|
import { DataQueryError } from '@grafana/data';
|
|
import { FadeIn } from 'app/core/components/Animations/FadeIn';
|
|
import { getFirstQueryErrorWithoutRefId, getValueWithRefId } from 'app/core/utils/explore';
|
|
|
|
interface Props {
|
|
queryErrors: DataQueryError[];
|
|
}
|
|
|
|
export const ErrorContainer: FunctionComponent<Props> = props => {
|
|
const { queryErrors } = props;
|
|
const refId = getValueWithRefId(queryErrors);
|
|
const queryError = refId ? null : getFirstQueryErrorWithoutRefId(queryErrors);
|
|
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>
|
|
);
|
|
};
|