QueryActionComponent: Add dataSourceRef to ActionComponetProps (#39486)

* Add dataSourceRef to ActionComponetProps

* pass whole datasource instance settings into modal

Co-authored-by: Travis Patterson <travis.patterson@grafana.com>
This commit is contained in:
Andrew Hackmann 2021-09-27 08:40:19 -05:00 committed by GitHub
parent 0aac00839a
commit 184fa2a227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,10 +1,11 @@
import { DataQuery, TimeRange } from '@grafana/data'; import { DataQuery, DataSourceInstanceSettings, TimeRange } from '@grafana/data';
interface ActionComponentProps { interface ActionComponentProps {
query?: DataQuery; query?: DataQuery;
queries?: Array<Partial<DataQuery>>; queries?: Array<Partial<DataQuery>>;
onAddQuery?: (q: DataQuery) => void; onAddQuery?: (q: DataQuery) => void;
timeRange?: TimeRange; timeRange?: TimeRange;
dataSource?: DataSourceInstanceSettings;
} }
type QueryActionComponent = React.ComponentType<ActionComponentProps>; type QueryActionComponent = React.ComponentType<ActionComponentProps>;

View File

@ -303,13 +303,14 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
} }
renderExtraActions = () => { renderExtraActions = () => {
const { query, queries, data, onAddQuery } = this.props; const { query, queries, data, onAddQuery, dataSource } = this.props;
return RowActionComponents.getAllExtraRenderAction().map((c) => { return RowActionComponents.getAllExtraRenderAction().map((c) => {
return React.createElement(c, { return React.createElement(c, {
query, query,
queries, queries,
timeRange: data.timeRange, timeRange: data.timeRange,
onAddQuery: onAddQuery as (query: DataQuery) => void, onAddQuery: onAddQuery as (query: DataQuery) => void,
dataSource: dataSource,
}); });
}); });
}; };