import { css } from '@emotion/css'; import React from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import { GrafanaTheme2, isTimeSeriesFrames, PanelData, ThresholdsConfig } from '@grafana/data'; import { GraphTresholdsStyleMode, LoadingState } from '@grafana/schema'; import { useStyles2 } from '@grafana/ui'; import appEvents from 'app/core/app_events'; import { GraphContainer } from 'app/features/explore/Graph/GraphContainer'; import { ExpressionResult } from '../expressions/Expression'; import { getStatusMessage } from './util'; interface Props { data: PanelData; thresholds?: ThresholdsConfig; thresholdsType?: GraphTresholdsStyleMode; onThresholdsChange?: (thresholds: ThresholdsConfig) => void; } /** The VizWrapper is just a simple component that renders either a table or a graph based on the type of data we receive from "PanelData" */ export const VizWrapper = ({ data, thresholds, thresholdsType }: Props) => { const styles = useStyles2(getStyles); const isTimeSeriesData = isTimeSeriesFrames(data.series); const statusMessage = getStatusMessage(data); const thresholdsStyle = thresholdsType ? { mode: thresholdsType } : undefined; const timeRange = { from: data.timeRange.from.valueOf(), to: data.timeRange.to.valueOf(), }; return (