TablePanel.tsx 675 B

1234567891011121314151617181920212223242526272829
  1. // Libraries
  2. import React, { Component } from 'react';
  3. // Types
  4. import { PanelProps, ThemeContext } from '@grafana/ui';
  5. import { Options } from './types';
  6. import Table from '@grafana/ui/src/components/Table/Table';
  7. interface Props extends PanelProps<Options> {}
  8. export class TablePanel extends Component<Props> {
  9. constructor(props: Props) {
  10. super(props);
  11. }
  12. render() {
  13. const { data, options } = this.props;
  14. if (data.length < 1) {
  15. return <div>No Table Data...</div>;
  16. }
  17. return (
  18. <ThemeContext.Consumer>
  19. {theme => <Table {...this.props} {...options} theme={theme} data={data[0]} />}
  20. </ThemeContext.Consumer>
  21. );
  22. }
  23. }