From 7ccba047c60a6ebaa13018ebb4f5474f234a7735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Fri, 19 Feb 2021 09:49:59 +0100 Subject: [PATCH] QueryEditor: handle query.hide changes in angular based query-editors (#31336) * handle query.hide changes in angular query-editors * better comment --- .../app/features/query/components/QueryEditorRow.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/app/features/query/components/QueryEditorRow.tsx b/public/app/features/query/components/QueryEditorRow.tsx index 70606c79aef..3fe2fedced3 100644 --- a/public/app/features/query/components/QueryEditorRow.tsx +++ b/public/app/features/query/components/QueryEditorRow.tsx @@ -80,6 +80,8 @@ export class QueryEditorRow extends PureComponent { const panel = new PanelModel({ targets: queries }); const dashboard = {} as DashboardModel; + const me = this; + return { datasource: datasource, target: query, @@ -89,6 +91,14 @@ export class QueryEditorRow extends PureComponent { // Old angular editors modify the query model and just call refresh // Important that this use this.props here so that as this fuction is only created on mount and it's // important not to capture old prop functions in this closure + + // the "hide" attribute of the quries can be changed from the "outside", + // it will be applied to "this.props.query.hide", but not to "query.hide". + // so we have to apply it. + if (query.hide !== me.props.query.hide) { + query.hide = me.props.query.hide; + } + this.props.onChange(query); this.props.onRunQuery(); },