Commit 21146141 by Peter Holmberg Committed by GitHub

GEL: Editor UI updates (#27859)

* use new inline form styles

* remove fragment

* rename some of the GEL form labels

* s/gel type/operation for label

Co-authored-by: kyle <kyle@grafana.com>
parent c35bd84f
// Libraries // Libraries
import React, { PureComponent, ChangeEvent } from 'react'; import React, { PureComponent, ChangeEvent } from 'react';
import { InlineFormLabel, LegacyForms } from '@grafana/ui'; import { InlineField, InlineFieldRow, Input, Select, TextArea } from '@grafana/ui';
const { Select, FormField } = LegacyForms;
import { SelectableValue, ReducerID, QueryEditorProps } from '@grafana/data'; import { SelectableValue, ReducerID, QueryEditorProps } from '@grafana/data';
// Types // Types
...@@ -127,32 +126,39 @@ export class ExpressionQueryEditor extends PureComponent<Props, State> { ...@@ -127,32 +126,39 @@ export class ExpressionQueryEditor extends PureComponent<Props, State> {
return ( return (
<div> <div>
<div className="form-field"> <InlineField label="Operation">
<Select options={gelTypes} value={selected} onChange={this.onSelectGELType} /> <Select options={gelTypes} value={selected} onChange={this.onSelectGELType} width={25} />
{query.type === GELQueryType.reduce && ( </InlineField>
<>
<InlineFormLabel width={5}>Function:</InlineFormLabel>
<Select options={reducerTypes} value={reducer} onChange={this.onSelectReducer} />
<FormField label="Fields:" labelWidth={5} onChange={this.onExpressionChange} value={query.expression} />
</>
)}
</div>
{query.type === GELQueryType.math && ( {query.type === GELQueryType.math && (
<textarea value={query.expression} onChange={this.onExpressionChange} className="gf-form-input" rows={2} /> <InlineField label="Expression">
<TextArea value={query.expression} onChange={this.onExpressionChange} rows={2} />
</InlineField>
)}
{query.type === GELQueryType.reduce && (
<InlineFieldRow>
<InlineField label="Function">
<Select options={reducerTypes} value={reducer} onChange={this.onSelectReducer} width={25} />
</InlineField>
<InlineField label="Input">
<Input onChange={this.onExpressionChange} value={query.expression} width={25} />
</InlineField>
</InlineFieldRow>
)} )}
{query.type === GELQueryType.resample && ( {query.type === GELQueryType.resample && (
<> <InlineFieldRow>
<div> <InlineField label="Input">
<FormField label="Series:" labelWidth={5} onChange={this.onExpressionChange} value={query.expression} /> <Input onChange={this.onExpressionChange} value={query.expression} width={25} />
<FormField label="Rule:" labelWidth={5} onChange={this.onRuleChange} value={query.rule} /> </InlineField>
</div> <InlineField label="Window">
<div> <Input onChange={this.onRuleChange} value={query.rule} width={25} />
<InlineFormLabel width={12}>Downsample Function:</InlineFormLabel> </InlineField>
<Select options={downsamplingTypes} value={downsampler} onChange={this.onSelectDownsampler} /> <InlineField label="Downsample">
<InlineFormLabel width={12}>Upsample Function:</InlineFormLabel> <Select options={downsamplingTypes} value={downsampler} onChange={this.onSelectDownsampler} width={25} />
<Select options={upsamplingTypes} value={upsampler} onChange={this.onSelectUpsampler} /> </InlineField>
</div> <InlineField label="Upsample">
</> <Select options={upsamplingTypes} value={upsampler} onChange={this.onSelectUpsampler} width={25} />
</InlineField>
</InlineFieldRow>
)} )}
</div> </div>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment