Commit e09c535f by Torkel Ödegaard Committed by GitHub

AngularQueryEditors: Fixes to Graphite query editor and other who refer to other queries (#30154)

* AngularQueryEditors: Fixes to Graphite query editor and other who refer to other queries

* Fixed missing call to old function
parent dc7a6c21
...@@ -72,9 +72,9 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -72,9 +72,9 @@ export class QueryEditorRow extends PureComponent<Props, State> {
} }
getAngularQueryComponentScope(): AngularQueryComponentScope { getAngularQueryComponentScope(): AngularQueryComponentScope {
const { query, onChange } = this.props; const { query, onChange, onRunQuery, queries } = this.props;
const { datasource } = this.state; const { datasource } = this.state;
const panel = new PanelModel({}); const panel = new PanelModel({ targets: queries });
const dashboard = {} as DashboardModel; const dashboard = {} as DashboardModel;
return { return {
...@@ -85,6 +85,7 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -85,6 +85,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
refresh: () => { refresh: () => {
// Old angular editors modify the query model and just call refresh // Old angular editors modify the query model and just call refresh
onChange(query); onChange(query);
onRunQuery();
}, },
render: () => () => console.log('legacy render function called, it does nothing'), render: () => () => console.log('legacy render function called, it does nothing'),
events: panel.events, events: panel.events,
...@@ -170,12 +171,8 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -170,12 +171,8 @@ export class QueryEditorRow extends PureComponent<Props, State> {
this.renderAngularQueryEditor(); this.renderAngularQueryEditor();
}; };
onRunQuery = () => {
this.props.onRunQuery();
};
renderPluginEditor = () => { renderPluginEditor = () => {
const { query, onChange, queries } = this.props; const { query, onChange, queries, onRunQuery } = this.props;
const { datasource, data } = this.state; const { datasource, data } = this.state;
if (datasource?.components?.QueryCtrl) { if (datasource?.components?.QueryCtrl) {
...@@ -191,7 +188,7 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -191,7 +188,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
query={query} query={query}
datasource={datasource} datasource={datasource}
onChange={onChange} onChange={onChange}
onRunQuery={this.onRunQuery} onRunQuery={onRunQuery}
data={data} data={data}
range={getTimeSrv().timeRange()} range={getTimeSrv().timeRange()}
queries={queries} queries={queries}
...@@ -224,7 +221,7 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -224,7 +221,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
onDisableQuery = () => { onDisableQuery = () => {
this.props.query.hide = !this.props.query.hide; this.props.query.hide = !this.props.query.hide;
this.onRunQuery(); this.props.onRunQuery();
this.forceUpdate(); this.forceUpdate();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment