Files
grafana/public/app/plugins/panel/table2/TablePanel.tsx
Torkel Ödegaard 3347b45a95 Table: Component progress & custom FieldConfig options (#21231)
* Table: Set & use field display processor

* Use applyFieldOverrides outside in story instead

* Change types a bit

* Table: Move to flexible layout

* Simplest possible custom field option

* Skip default column

* Added textAlign

* Explore: Set display processor for table data frame

* Fixed storybook

* Refactoring

* Progress on cell display mode

* Major progress

* Progress & refactoring

* Fixes

* Updated tests

* Added more tests

* Table: Progress on cell style customization

* Restored testdata random walk table scenario

* put back unrelated change

* remove unused things

* Updated table story

* Renamed property

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2019-12-23 06:22:54 +01:00

36 lines
869 B
TypeScript

// Libraries
import React, { Component } from 'react';
// Types
import { Table } from '@grafana/ui';
import { PanelProps, applyFieldOverrides } from '@grafana/data';
import { Options } from './types';
import { config } from 'app/core/config';
interface Props extends PanelProps<Options> {}
const paddingBottom = 16;
export class TablePanel extends Component<Props> {
constructor(props: Props) {
super(props);
}
render() {
const { data, height, width, replaceVariables, options } = this.props;
if (data.series.length < 1) {
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} />;
}
}