feat(influxdb): changed multi query encoding in order to support InfluxDB >v0.11, closes #4533

This commit is contained in:
Torkel Ödegaard 2016-04-09 11:00:35 -04:00
parent 52e2091f2c
commit ed62822d44
2 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,8 @@
# 3.0.0-beta3 (unreleased)
### Enhancements
* **InfluxDB**: Changed multi query encoding to work with InfluxDB 0.11 & 0.12, closes [#4533](https://github.com/grafana/grafana/issues/4533)
### Bug fixes
* **Postgres**: Fixed page render crash when using postgres, fixes [#4558](https://github.com/grafana/grafana/issues/4558)
* **Table panel**: Fixed table panel bug when trying to show annotations in table panel, fixes [#4563](https://github.com/grafana/grafana/issues/4563)

View File

@ -55,7 +55,7 @@ export default class InfluxDatasource {
query = query.replace(/\$interval/g, (target.interval || options.interval));
return query;
}).join("\n");
}).join(";");
// replace grafana variables
allQueries = allQueries.replace(/\$timeFilter/g, timeFilter);
@ -133,6 +133,17 @@ export default class InfluxDatasource {
return this._influxRequest('GET', '/query', {q: query, epoch: 'ms'});
}
serializeParams(params) {
if (!params) { return '';}
return _.reduce(params, (memo, value, key) => {
if (value === null || value === undefined) { return memo; }
memo.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
return memo;
}, []).join("&");
}
testDatasource() {
return this.metricFindQuery('SHOW MEASUREMENTS LIMIT 1').then(() => {
return { status: "success", message: "Data source is working", title: "Success" };
@ -166,6 +177,7 @@ export default class InfluxDatasource {
data: data,
precision: "ms",
inspect: { type: 'influxdb' },
paramSerializer: this.serializeParams,
};
options.headers = options.headers || {};