import React, { PureComponent } from 'react'; import { DataSourceApi, QueryEditorProps, SelectableValue } from '@grafana/data'; import { InlineField, Select } from '@grafana/ui'; import { ClassicConditions } from './components/ClassicConditions'; import { Math } from './components/Math'; import { Reduce } from './components/Reduce'; import { Resample } from './components/Resample'; import { ExpressionQuery, ExpressionQueryType, gelTypes } from './types'; import { getDefaults } from './utils/expressionTypes'; type Props = QueryEditorProps, ExpressionQuery>; const labelWidth = 14; export class ExpressionQueryEditor extends PureComponent { onSelectExpressionType = (item: SelectableValue) => { const { query, onChange } = this.props; onChange(getDefaults({ ...query, type: item.value! })); }; renderExpressionType() { const { onChange, onRunQuery, query, queries } = this.props; const refIds = queries!.filter((q) => query.refId !== q.refId).map((q) => ({ value: q.refId, label: q.refId })); switch (query.type) { case ExpressionQueryType.math: return ; case ExpressionQueryType.reduce: return ; case ExpressionQueryType.resample: return ; case ExpressionQueryType.classic: return ; } } render() { const { query } = this.props; const selected = gelTypes.find((o) => o.value === query.type); return (