github.com/thanos-io/thanos@v0.32.5/pkg/ui/react-app/src/pages/graph/GraphTabContent.tsx (about)

     1  import React, { FC } from 'react';
     2  import { UncontrolledAlert } from 'reactstrap';
     3  import Graph from './Graph';
     4  import { QueryParams } from '../../types/types';
     5  import { isPresent } from '../../utils';
     6  
     7  interface GraphTabContentProps {
     8    data: any;
     9    stacked: boolean;
    10    useLocalTime: boolean;
    11    lastQueryParams: QueryParams | null;
    12  }
    13  
    14  export const GraphTabContent: FC<GraphTabContentProps> = ({ data, stacked, useLocalTime, lastQueryParams }) => {
    15    if (!isPresent(data)) {
    16      return <UncontrolledAlert color="light">No data queried yet</UncontrolledAlert>;
    17    }
    18    if (data.result.length === 0) {
    19      return <UncontrolledAlert color="secondary">Empty query result</UncontrolledAlert>;
    20    }
    21    if (data.resultType !== 'matrix') {
    22      return (
    23        <UncontrolledAlert color="danger">
    24          Query result is of wrong type '{data.resultType}', should be 'matrix' (range vector).
    25        </UncontrolledAlert>
    26      );
    27    }
    28    return <Graph data={data} stacked={stacked} useLocalTime={useLocalTime} queryParams={lastQueryParams} />;
    29  };