DatasourceRef: keep uid/type ref when using template variables (#41785)

This commit is contained in:
Ryan McKinley
2021-11-16 22:55:12 -08:00
committed by GitHub
parent b4faee786f
commit bce7cb3ebf
6 changed files with 23 additions and 4 deletions

View File

@@ -114,6 +114,7 @@ function describeQueryRunnerScenario(
ctx.queryCalledWith = options;
return Promise.resolve(response);
},
getRef: () => ({ type: 'test', uid: 'TestDB-uid' }),
testDatasource: jest.fn(),
};

View File

@@ -235,7 +235,7 @@ export class PanelQueryRunner {
// Attach the data source name to each query
request.targets = request.targets.map((query) => {
if (!query.datasource) {
query.datasource = { uid: ds.uid };
query.datasource = ds.getRef();
}
return query;
});