From 4f61edd28df8c5cfbbb2da4335b189d25a59e7d0 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:23:26 +0100 Subject: [PATCH] Prometheus: Fix enabling of disabled queries when editing in dashboard (#31055) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix disable bug by passing hide prop * Make more universal fix * Revert to original fix * Update public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx Co-authored-by: Zoltán Bedi Co-authored-by: Zoltán Bedi --- .../datasource/prometheus/components/PromQueryEditor.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx b/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx index 009616ce03a..3876687ac74 100644 --- a/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx +++ b/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx @@ -92,7 +92,9 @@ export class PromQueryEditor extends PureComponent { onRunQuery = () => { const { query } = this; - this.props.onChange(query); + // Change of query.hide happens outside of this component and is just passed as prop. We have to update it when running queries. + const { hide } = this.props.query; + this.props.onChange({ ...query, hide }); this.props.onRunQuery(); };