grafana/public/app/plugins/datasource/cloudwatch/components/PanelQueryEditor.tsx
Isabella Siu 55a9c98ae3
CloudWatch: Use metrics query header for logs (#44668)
Co-authored-by: Sarah Zinger <sarahzinger@users.noreply.github.com>
Co-authored-by: Yaelle Chaudy <42030685+yaelleC@users.noreply.github.com>
2022-02-01 11:36:51 -05:00

26 lines
817 B
TypeScript

import React, { PureComponent } from 'react';
import { QueryEditorProps, ExploreMode } from '@grafana/data';
import { CloudWatchJsonData, CloudWatchQuery } from '../types';
import { CloudWatchDatasource } from '../datasource';
import { MetricsQueryEditor } from './MetricsQueryEditor';
import LogsQueryEditor from './LogsQueryEditor';
export type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>;
export class PanelQueryEditor extends PureComponent<Props> {
render() {
const { query } = this.props;
const apiMode = query.queryMode ?? 'Metrics';
return (
<>
{apiMode === ExploreMode.Logs ? (
<LogsQueryEditor {...this.props} allowCustomValue />
) : (
<MetricsQueryEditor {...this.props} />
)}
</>
);
}
}