mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* refactor to purecomponent * use subscription in component * correct onRunQueries * move more things from render function * fix issue with no queries * pr feedback * revert to FC * redo some code layout, simplify if * minor fixes after review
24 lines
712 B
TypeScript
24 lines
712 B
TypeScript
import React, { FC } from 'react';
|
||
import { DataFrame } from '@grafana/data';
|
||
import { Button, Table } from '@grafana/ui';
|
||
import { EmptyState } from './EmptyState';
|
||
|
||
interface Props {
|
||
instances: DataFrame[];
|
||
width: number;
|
||
height: number;
|
||
onTest: () => void;
|
||
}
|
||
|
||
export const PreviewInstancesTab: FC<Props> = ({ instances, onTest, height, width }) => {
|
||
if (!instances.length) {
|
||
return (
|
||
<EmptyState title="You haven’t tested your alert yet.">
|
||
<div>In order to see your instances, you need to test your alert first.</div>
|
||
<Button onClick={onTest}>Test alert now</Button>
|
||
</EmptyState>
|
||
);
|
||
}
|
||
return <Table data={instances[0]} height={height} width={width} />;
|
||
};
|