PanelQueryEditor.tsx 849 B

12345678910111213141516171819202122232425262728
  1. import React, { PureComponent } from 'react';
  2. import { QueryEditorProps } from '@grafana/data';
  3. import { CloudWatchDatasource } from '../datasource';
  4. import { isCloudWatchMetricsQuery } from '../guards';
  5. import { CloudWatchJsonData, CloudWatchQuery } from '../types';
  6. import { MetricsQueryEditor } from '././MetricsQueryEditor/MetricsQueryEditor';
  7. import LogsQueryEditor from './LogsQueryEditor';
  8. export type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>;
  9. export class PanelQueryEditor extends PureComponent<Props> {
  10. render() {
  11. const { query } = this.props;
  12. return (
  13. <>
  14. {isCloudWatchMetricsQuery(query) ? (
  15. <MetricsQueryEditor {...this.props} query={query} />
  16. ) : (
  17. <LogsQueryEditor {...this.props} allowCustomValue />
  18. )}
  19. </>
  20. );
  21. }
  22. }