From d54e62197aefe547a256ada0773b31595a7e5a46 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 15 Dec 2020 22:24:56 -0800 Subject: [PATCH] QueryOptions: Open QueryEditors: run queries after changing group options #29864 --- .../features/query/components/QueryGroup.tsx | 9 ++++++-- .../query/components/QueryGroupOptions.tsx | 22 +++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/public/app/features/query/components/QueryGroup.tsx b/public/app/features/query/components/QueryGroup.tsx index 8c4c5b65089..6bb3d3789ea 100644 --- a/public/app/features/query/components/QueryGroup.tsx +++ b/public/app/features/query/components/QueryGroup.tsx @@ -167,8 +167,13 @@ export class QueryGroup extends PureComponent { this.setState({ scrollTop: 1000 }); }; + onUpdateAndRun = (options: QueryGroupOptions) => { + this.props.onOptionsChange(options); + this.props.onRunQueries(); + }; + renderTopSection(styles: QueriesTabStyls) { - const { onOpenQueryInspector, options, onOptionsChange } = this.props; + const { onOpenQueryInspector, options } = this.props; const { dataSource, data } = this.state; return ( @@ -199,7 +204,7 @@ export class QueryGroup extends PureComponent { options={options} dataSource={dataSource} data={data} - onChange={onOptionsChange} + onChange={this.onUpdateAndRun} /> {onOpenQueryInspector && ( diff --git a/public/app/features/query/components/QueryGroupOptions.tsx b/public/app/features/query/components/QueryGroupOptions.tsx index ca31fef73e2..abd630de8d9 100644 --- a/public/app/features/query/components/QueryGroupOptions.tsx +++ b/public/app/features/query/components/QueryGroupOptions.tsx @@ -144,19 +144,23 @@ export class QueryGroupOptionsEditor extends PureComponent { maxDataPoints = null; } - onChange({ - ...options, - maxDataPoints: maxDataPoints, - }); + if (maxDataPoints !== options.maxDataPoints) { + onChange({ + ...options, + maxDataPoints, + }); + } }; onMinIntervalBlur = (event: ChangeEvent) => { const { options, onChange } = this.props; - - onChange({ - ...options, - minInterval: emptyToNull(event.target.value), - }); + const minInterval = emptyToNull(event.target.value); + if (minInterval !== options.minInterval) { + onChange({ + ...options, + minInterval, + }); + } }; renderCacheTimeoutOption() {