ソースを参照

Added scopedVars argument in datasourceSrv.get in DataPanel

Torkel Ödegaard 6 年 前
コミット
aeb3553491

+ 1 - 1
public/app/features/dashboard/dashgrid/DataPanel.tsx

@@ -116,7 +116,7 @@ export class DataPanel extends Component<Props, State> {
     this.setState({ loading: LoadingState.Loading });
 
     try {
-      const ds = await this.dataSourceSrv.get(datasource);
+      const ds = await this.dataSourceSrv.get(datasource, scopedVars);
 
       // TODO interpolate variables
       const minInterval = this.props.minInterval || ds.interval;

+ 1 - 0
public/app/features/plugins/datasource_srv.ts

@@ -26,6 +26,7 @@ export class DatasourceSrv {
       return this.get(config.defaultDatasource);
     }
 
+    // Interpolation here is to support template variable in data source selection
     name = this.templateSrv.replace(name, scopedVars, (value, variable) => {
       if (Array.isArray(value)) {
         return value[0];