diff --git a/public/app/features/dashboard/panel_editor/QueriesTab.tsx b/public/app/features/dashboard/panel_editor/QueriesTab.tsx index bef23c03496..0553a61287c 100644 --- a/public/app/features/dashboard/panel_editor/QueriesTab.tsx +++ b/public/app/features/dashboard/panel_editor/QueriesTab.tsx @@ -176,7 +176,7 @@ export class QueriesTab extends PureComponent { }; render() { - const { panel } = this.props; + const { panel, dashboard } = this.props; const { currentDS, scrollTop } = this.state; const queryInspector: EditorToolbarView = { @@ -205,6 +205,7 @@ export class QueriesTab extends PureComponent { dataSourceValue={query.datasource || panel.datasource} key={query.refId} panel={panel} + dashboard={dashboard} query={query} onChange={query => this.onQueryChange(query, index)} onRemoveQuery={this.onRemoveQuery} diff --git a/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx b/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx index 0b8d2c39908..704edb1f062 100644 --- a/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx +++ b/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx @@ -12,10 +12,12 @@ import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv'; // Types import { PanelModel } from '../state/PanelModel'; import { DataQuery, DataSourceApi, TimeRange } from '@grafana/ui'; +import { DashboardModel } from '../state/DashboardModel'; interface Props { panel: PanelModel; query: DataQuery; + dashboard: DashboardModel; onAddQuery: (query?: DataQuery) => void; onRemoveQuery: (query: DataQuery) => void; onMoveQuery: (query: DataQuery, direction: number) => void; @@ -83,13 +85,14 @@ export class QueryEditorRow extends PureComponent { }; getAngularQueryComponentScope(): AngularQueryComponentScope { - const { panel, query } = this.props; + const { panel, query, dashboard } = this.props; const { datasource } = this.state; return { datasource: datasource, target: query, panel: panel, + dashboard: dashboard, refresh: () => panel.refresh(), render: () => panel.render(), events: panel.events, @@ -265,6 +268,7 @@ export class QueryEditorRow extends PureComponent { export interface AngularQueryComponentScope { target: DataQuery; panel: PanelModel; + dashboard: DashboardModel; events: Emitter; refresh: () => void; render: () => void;