ResponseErrorContainer.tsx 701 B

1234567891011121314151617181920212223
  1. import React from 'react';
  2. import { useSelector } from 'react-redux';
  3. import { LoadingState } from '@grafana/data';
  4. import { ExploreId, StoreState } from '../../types';
  5. import { ErrorContainer } from './ErrorContainer';
  6. interface Props {
  7. exploreId: ExploreId;
  8. }
  9. export function ResponseErrorContainer(props: Props) {
  10. const queryResponse = useSelector((state: StoreState) => state.explore[props.exploreId]?.queryResponse);
  11. const queryError = queryResponse?.state === LoadingState.Error ? queryResponse?.error : undefined;
  12. // Errors with ref ids are shown below the corresponding query
  13. if (queryError?.refId) {
  14. return null;
  15. }
  16. return <ErrorContainer queryError={queryError} />;
  17. }