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
|
|
|
|
2021-03-23 05:58:09 -05:00
|
|
|
import { ErrorContainer } from './ErrorContainer';
|
|
|
|
|
|
|
|
interface Props {
|
2023-06-21 04:06:28 -05:00
|
|
|
exploreId: string;
|
2021-03-23 05:58:09 -05:00
|
|
|
}
|
|
|
|
export function ResponseErrorContainer(props: Props) {
|
2023-05-03 10:45:11 -05:00
|
|
|
const queryResponse = useSelector((state) => state.explore.panes[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} />;
|
|
|
|
}
|