mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* 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>
36 lines
869 B
TypeScript
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} />;
|
|
}
|
|
}
|