Skip to content

Commit 159dfba

Browse files
authored
Merge pull request #15 from mullerpeter/bugfix/scoped-variables
🐛 fix: use scoped variables in template replacment
2 parents 7a2f5b0 + 3ed99e6 commit 159dfba

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Changelog
22

3+
## 1.1.2
4+
5+
- Use scoped Variables in template variable replacement
6+
7+
---
8+
39
### 1.1.0
410

511
- Adds proper type reflection to support all databricks data types. (except type `BINARY` which is not supported)
6-
---
712

813
### 1.0.0
914

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mullerpeter-databricks-datasource",
33
"private": true,
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"description": "Databricks SQL Connector",
66
"scripts": {
77
"build": "grafana-toolkit plugin:build",

src/datasource.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { DataSourceInstanceSettings } from '@grafana/data';
1+
import { DataSourceInstanceSettings, ScopedVars } from '@grafana/data';
22
import { DataSourceWithBackend, getTemplateSrv } from '@grafana/runtime';
33
import { MyDataSourceOptions, MyQuery } from './types';
44

55
export class DataSource extends DataSourceWithBackend<MyQuery, MyDataSourceOptions> {
66
constructor(instanceSettings: DataSourceInstanceSettings<MyDataSourceOptions>) {
77
super(instanceSettings);
88
}
9-
applyTemplateVariables(query: MyQuery) {
9+
applyTemplateVariables(query: MyQuery, scopedVars: ScopedVars) {
1010
const templateSrv = getTemplateSrv();
1111
return {
1212
...query,
13-
rawSqlQuery: query.rawSqlQuery ? templateSrv.replace(query.rawSqlQuery) : ''
13+
rawSqlQuery: query.rawSqlQuery ? templateSrv.replace(query.rawSqlQuery, scopedVars) : ''
1414
};
1515
}
1616
}

0 commit comments

Comments
 (0)