From edbde6c06b25b6f1986eb4c3e4e89beeaaebc104 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Fri, 11 Dec 2020 15:19:24 +0100 Subject: [PATCH] Expressions: Add placeholders to hint on input (#29773) * math placeholder * resample changes --- .../expressions/ExpressionQueryEditor.tsx | 77 ++++++++++++++----- 1 file changed, 57 insertions(+), 20 deletions(-) diff --git a/public/app/features/expressions/ExpressionQueryEditor.tsx b/public/app/features/expressions/ExpressionQueryEditor.tsx index 19fcbec4b2b..c3281d0598e 100644 --- a/public/app/features/expressions/ExpressionQueryEditor.tsx +++ b/public/app/features/expressions/ExpressionQueryEditor.tsx @@ -1,5 +1,6 @@ // Libraries import React, { PureComponent, ChangeEvent } from 'react'; +import { css } from 'emotion'; import { InlineField, InlineFieldRow, Input, Select, TextArea } from '@grafana/ui'; import { SelectableValue, ReducerID, QueryEditorProps } from '@grafana/data'; @@ -39,6 +40,11 @@ const upsamplingTypes: Array> = [ { value: 'fillna', label: 'fillna', description: 'Fill with NaNs' }, ]; +const mathPlaceholder = + 'Math operations on one more queries, you reference the query by ${refId} ie. $A, $B, $C etc\n' + + 'Example: $A + $B\n' + + 'Available functions: abs(), log(), nan(), inf(), null()'; + export class ExpressionQueryEditor extends PureComponent { state = {}; @@ -123,42 +129,73 @@ export class ExpressionQueryEditor extends PureComponent { const reducer = reducerTypes.find(o => o.value === query.reducer); const downsampler = downsamplingTypes.find(o => o.value === query.downsampler); const upsampler = upsamplingTypes.find(o => o.value === query.upsampler); + const labelWidth = 14; return (
- +