2020-04-25 21:48:20 +01:00
|
|
|
import React, { PureComponent } from 'react';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2021-09-15 16:26:23 +01:00
|
|
|
import { QueryEditorProps, ExploreMode } from '@grafana/data';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2020-04-25 21:48:20 +01:00
|
|
|
import { CloudWatchDatasource } from '../datasource';
|
2022-04-22 14:33:13 +01:00
|
|
|
import { CloudWatchJsonData, CloudWatchQuery } from '../types';
|
|
|
|
|
|
2020-04-25 21:48:20 +01:00
|
|
|
import LogsQueryEditor from './LogsQueryEditor';
|
2022-04-22 14:33:13 +01:00
|
|
|
import { MetricsQueryEditor } from './MetricsQueryEditor';
|
2020-04-25 21:48:20 +01:00
|
|
|
|
2021-09-15 16:26:23 +01:00
|
|
|
export type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>;
|
2020-04-25 21:48:20 +01:00
|
|
|
|
2020-05-14 14:12:11 +02:00
|
|
|
export class PanelQueryEditor extends PureComponent<Props> {
|
2020-04-25 21:48:20 +01:00
|
|
|
render() {
|
2020-05-14 14:12:11 +02:00
|
|
|
const { query } = this.props;
|
2020-07-09 13:11:13 +01:00
|
|
|
const apiMode = query.queryMode ?? 'Metrics';
|
2020-04-25 21:48:20 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2020-06-18 15:54:29 +01:00
|
|
|
{apiMode === ExploreMode.Logs ? (
|
|
|
|
|
<LogsQueryEditor {...this.props} allowCustomValue />
|
|
|
|
|
) : (
|
|
|
|
|
<MetricsQueryEditor {...this.props} />
|
|
|
|
|
)}
|
2020-04-25 21:48:20 +01:00
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|