grafana/public/app/plugins/panel/timeline/TimelinePanel.tsx

46 lines
986 B
TypeScript
Raw Normal View History

import React from 'react';
import { PanelProps } from '@grafana/data';
2021-05-13 13:57:45 -05:00
import { useTheme2, ZoomPlugin } from '@grafana/ui';
import { TimelineOptions } from './types';
import { TimelineChart } from './TimelineChart';
interface TimelinePanelProps extends PanelProps<TimelineOptions> {}
/**
* @alpha
*/
2021-05-13 13:57:45 -05:00
export const TimelinePanel: React.FC<TimelinePanelProps> = ({
data,
timeRange,
timeZone,
options,
width,
height,
onChangeTimeRange,
}) => {
const theme = useTheme2();
if (!data || !data.series?.length) {
return (
<div className="panel-empty">
<p>No data found in response</p>
</div>
);
}
return (
<TimelineChart
theme={theme}
2021-05-05 03:44:31 -05:00
frames={data.series}
structureRev={data.structureRev}
timeRange={timeRange}
timeZone={timeZone}
width={width}
height={height}
{...options}
2021-05-13 13:57:45 -05:00
>
{(config) => <ZoomPlugin config={config} onZoom={onChangeTimeRange} />}
2021-05-13 13:57:45 -05:00
</TimelineChart>
);
};