DebugPanel.tsx 964 B

123456789101112131415161718192021222324252627282930
  1. import React, { Component } from 'react';
  2. import { PanelProps } from '@grafana/data';
  3. import { CursorView } from './CursorView';
  4. import { EventBusLoggerPanel } from './EventBusLogger';
  5. import { RenderInfoViewer } from './RenderInfoViewer';
  6. import { StateView } from './StateView';
  7. import { DebugPanelOptions, DebugMode } from './types';
  8. type Props = PanelProps<DebugPanelOptions>;
  9. export class DebugPanel extends Component<Props> {
  10. render() {
  11. const { options } = this.props;
  12. switch (options.mode) {
  13. case DebugMode.Events:
  14. return <EventBusLoggerPanel eventBus={this.props.eventBus} />;
  15. case DebugMode.Cursor:
  16. return <CursorView eventBus={this.props.eventBus} />;
  17. case DebugMode.State:
  18. return <StateView {...this.props} />;
  19. case DebugMode.ThrowError:
  20. throw new Error('I failed you and for that i am deeply sorry');
  21. default:
  22. return <RenderInfoViewer {...this.props} />;
  23. }
  24. }
  25. }