2021-03-23 05:58:09 -05:00
|
|
|
import React from 'react';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-03-23 05:58:09 -05:00
|
|
|
import { LoadingState } from '@grafana/data';
|
2022-09-19 04:49:35 -05:00
|
|
|
import { useSelector } from 'app/types';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2022-09-19 04:49:35 -05:00
|
|
|
import { ExploreId } from '../../types';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-03-23 05:58:09 -05:00
|
|
|
import { ErrorContainer } from './ErrorContainer';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
exploreId: ExploreId;
|
|
|
|
}
|
|
|
|
export function ResponseErrorContainer(props: Props) {
|
2022-09-19 04:49:35 -05:00
|
|
|
const queryResponse = useSelector((state) => state.explore[props.exploreId]?.queryResponse);
|
2021-09-22 04:33:31 -05:00
|
|
|
const queryError = queryResponse?.state === LoadingState.Error ? queryResponse?.error : undefined;
|
2021-03-23 05:58:09 -05:00
|
|
|
|
2022-04-14 05:57:56 -05:00
|
|
|
// Errors with ref ids are shown below the corresponding query
|
|
|
|
if (queryError?.refId) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-03-23 05:58:09 -05:00
|
|
|
return <ErrorContainer queryError={queryError} />;
|
|
|
|
}
|