diff --git a/packages/grafana-data/src/types/datasource.ts b/packages/grafana-data/src/types/datasource.ts index 2c2e7b7eb30..da6404504ce 100644 --- a/packages/grafana-data/src/types/datasource.ts +++ b/packages/grafana-data/src/types/datasource.ts @@ -128,6 +128,7 @@ export interface DataSourcePluginMeta extends PluginMet sort?: number; streaming?: boolean; unlicensed?: boolean; + backend?: boolean; isBackend?: boolean; } diff --git a/public/app/features/datasources/state/actions.ts b/public/app/features/datasources/state/actions.ts index b4c5639198a..3899e244d0a 100644 --- a/public/app/features/datasources/state/actions.ts +++ b/public/app/features/datasources/state/actions.ts @@ -135,7 +135,7 @@ export function loadDataSourceMeta(dataSource: DataSourceSettings): ThunkResult< const isBackend = plugin.DataSourceClass.prototype instanceof DataSourceWithBackend; const meta = { ...pluginInfo, - isBackend: isBackend, + isBackend: pluginInfo.backend || isBackend, }; dispatch(dataSourceMetaLoaded(meta)); diff --git a/public/app/features/query/components/QueryActionComponent.ts b/public/app/features/query/components/QueryActionComponent.ts index a29232ef8a8..6960c1180c6 100644 --- a/public/app/features/query/components/QueryActionComponent.ts +++ b/public/app/features/query/components/QueryActionComponent.ts @@ -7,9 +7,10 @@ interface ActionComponentProps { onChangeDataSource?: (ds: DataSourceInstanceSettings) => void; timeRange?: TimeRange; dataSource?: DataSourceInstanceSettings; + key: string | number; } -type QueryActionComponent = React.ComponentType; +type QueryActionComponent = (props: ActionComponentProps) => JSX.Element | null; class QueryActionComponents { extraRenderActions: QueryActionComponent[] = []; diff --git a/public/app/features/query/components/QueryEditorRow.tsx b/public/app/features/query/components/QueryEditorRow.tsx index 739ac4596d2..b378f14cbad 100644 --- a/public/app/features/query/components/QueryEditorRow.tsx +++ b/public/app/features/query/components/QueryEditorRow.tsx @@ -305,16 +305,18 @@ export class QueryEditorRow extends PureComponent { const { query, queries, data, onAddQuery, dataSource } = this.props; - return RowActionComponents.getAllExtraRenderAction().map((c, index) => { - return React.createElement(c, { - query, - queries, - timeRange: data.timeRange, - onAddQuery: onAddQuery as (query: DataQuery) => void, - dataSource: dataSource, - key: index, - }); - }); + return RowActionComponents.getAllExtraRenderAction() + .map((action, index) => + action({ + query, + queries, + timeRange: data.timeRange, + onAddQuery: onAddQuery as (query: DataQuery) => void, + dataSource, + key: index, + }) + ) + .filter(Boolean); }; renderActions = (props: QueryOperationRowRenderProps) => { diff --git a/public/app/features/query/components/QueryGroup.tsx b/public/app/features/query/components/QueryGroup.tsx index 13aa597d892..0f27e27b843 100644 --- a/public/app/features/query/components/QueryGroup.tsx +++ b/public/app/features/query/components/QueryGroup.tsx @@ -306,13 +306,15 @@ export class QueryGroup extends PureComponent { } renderExtraActions() { - return GroupActionComponents.getAllExtraRenderAction().map((c, index) => { - return React.createElement(c, { - onAddQuery: this.onAddQuery, - onChangeDataSource: this.onChangeDataSource, - key: index, - }); - }); + return GroupActionComponents.getAllExtraRenderAction() + .map((action, index) => + action({ + onAddQuery: this.onAddQuery, + onChangeDataSource: this.onChangeDataSource, + key: index, + }) + ) + .filter(Boolean); } renderAddQueryRow(dsSettings: DataSourceInstanceSettings, styles: QueriesTabStyles) {