Files
grafana/public/app/plugins/panel/table2/TablePanel.tsx

36 lines
869 B
TypeScript
Raw Normal View History

2019-03-05 16:07:46 -08:00
// Libraries
2019-03-07 16:52:20 -08:00
import React, { Component } from 'react';
2019-03-05 18:17:44 -08:00
2019-03-05 16:07:46 -08:00
// Types
import { Table } from '@grafana/ui';
import { PanelProps, applyFieldOverrides } from '@grafana/data';
2019-03-06 10:54:47 -08:00
import { Options } from './types';
import { config } from 'app/core/config';
2019-03-06 10:54:47 -08:00
2019-03-05 16:07:46 -08:00
interface Props extends PanelProps<Options> {}
const paddingBottom = 16;
2019-03-07 16:52:20 -08:00
export class TablePanel extends Component<Props> {
2019-03-06 10:10:04 -08:00
constructor(props: Props) {
super(props);
2019-03-05 18:17:44 -08:00
}
render() {
const { data, height, width, replaceVariables, options } = this.props;
2019-03-06 10:10:04 -08:00
if (data.series.length < 1) {
2019-03-05 16:07:46 -08:00
return <div>No Table Data...</div>;
}
const dataProcessed = applyFieldOverrides({
data: data.series,
fieldOptions: options.fieldOptions,
theme: config.theme,
replaceVariables,
})[0];
return <Table height={height - paddingBottom} width={width} data={dataProcessed} />;
2019-03-05 16:07:46 -08:00
}
}