From dd6f5efabe487e4a330f75a934973db29bf92bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 11 Nov 2019 10:04:22 +0100 Subject: [PATCH] Templating: Made default template variable query editor field a text area with dynamic automatic height (#20288) --- .../templating/DefaultVariableQueryEditor.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/public/app/features/templating/DefaultVariableQueryEditor.tsx b/public/app/features/templating/DefaultVariableQueryEditor.tsx index e361d76bcc9..90ad322d59e 100644 --- a/public/app/features/templating/DefaultVariableQueryEditor.tsx +++ b/public/app/features/templating/DefaultVariableQueryEditor.tsx @@ -1,5 +1,4 @@ import React, { PureComponent } from 'react'; -import { Input } from '@grafana/ui'; import { VariableQueryProps } from 'app/types/plugins'; export default class DefaultVariableQueryEditor extends PureComponent { @@ -8,20 +7,30 @@ export default class DefaultVariableQueryEditor extends PureComponent) => { + onChange = (event: React.FormEvent) => { this.setState({ value: event.currentTarget.value }); }; - onBlur = (event: React.FormEvent) => { + onBlur = (event: React.FormEvent) => { this.props.onChange(event.currentTarget.value, event.currentTarget.value); }; + getLineCount() { + const { value } = this.state; + + if (typeof value === 'string') { + return value.split('\n').length; + } + + return 1; + } + render() { return (
Query -