Files
grafana/public/app/plugins/panel/status-grid/StatusGridPanel.tsx
Leon Sorokin e3188458d5 Timeline & StatusGrid: cleanups (#34250)
* remove text alignment, per-box hover for grid, fix mergeValues

* unconditionally set spanNulls = -1

* fix stroke width offset math

* split multi-hover, so only single mark overlays in grid mode

* restore alignValue in state-timeline

* better descriptions, maybe

* init field.config.custom if necessary

* don't show last out-of-view value

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-05-18 16:38:39 -05:00

49 lines
1.1 KiB
TypeScript
Executable File

import React from 'react';
import { PanelProps } from '@grafana/data';
import { useTheme2, ZoomPlugin } from '@grafana/ui';
import { StatusPanelOptions } from './types';
import { TimelineChart } from '../state-timeline/TimelineChart';
import { TimelineMode } from '../state-timeline/types';
interface TimelinePanelProps extends PanelProps<StatusPanelOptions> {}
/**
* @alpha
*/
export const StatusGridPanel: 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}
frames={data.series}
structureRev={data.structureRev}
timeRange={timeRange}
timeZone={timeZone}
width={width}
height={height}
{...options}
// hardcoded
mode={TimelineMode.Samples}
>
{(config) => <ZoomPlugin config={config} onZoom={onChangeTimeRange} />}
</TimelineChart>
);
};