mysql: pass timerange for template variable queries (#10071)

* mysql: pass timerange for template variable queries

* mysql: document time range macro usage in template variables

* mysql: docs for on time range change refresh mode for template queries

* Revert "mysql: docs for on time range change refresh mode for template queries"

This reverts commit 5325972aa4.
This commit is contained in:
Sven Klemm
2017-12-07 11:18:36 +01:00
committed by Daniel Lee
parent b44c599410
commit a62ebb3e59
2 changed files with 18 additions and 3 deletions

View File

@@ -103,12 +103,21 @@ export class MysqlDatasource {
format: 'table',
};
var data = {
queries: [interpolatedQuery],
};
if (optionalOptions && optionalOptions.range && optionalOptions.range.from) {
data['from'] = optionalOptions.range.from.valueOf().toString();
}
if (optionalOptions && optionalOptions.range && optionalOptions.range.to) {
data['to'] = optionalOptions.range.to.valueOf().toString();
}
return this.backendSrv.datasourceRequest({
url: '/api/tsdb/query',
method: 'POST',
data: {
queries: [interpolatedQuery],
}
data: data
})
.then(data => this.responseParser.parseMetricFindQueryResult(refId, data));
}