mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(influxdb_09): fixed handling of regex measurement in explore queries, fixes #2415
This commit is contained in:
@@ -44,7 +44,10 @@ function (_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (measurement) {
|
if (measurement) {
|
||||||
query += ' FROM "' + measurement + '"';
|
if (!measurement.match('^/.*/') && !measurement.match(/^merge\(.*\)/)) {
|
||||||
|
measurement = '"' + measurement+ '"';
|
||||||
|
}
|
||||||
|
query += ' FROM ' + measurement;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (withKey) {
|
if (withKey) {
|
||||||
|
|||||||
@@ -102,6 +102,12 @@ define([
|
|||||||
expect(query).to.be('SHOW TAG KEYS FROM "cpu"');
|
expect(query).to.be('SHOW TAG KEYS FROM "cpu"');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle regex measurement in tag keys query', function() {
|
||||||
|
var builder = new InfluxQueryBuilder({ measurement: '/.*/', tags: [] });
|
||||||
|
var query = builder.buildExploreQuery('TAG_KEYS');
|
||||||
|
expect(query).to.be('SHOW TAG KEYS FROM /.*/');
|
||||||
|
});
|
||||||
|
|
||||||
it('should have no conditions in tags keys query given query with no measurement or tag', function() {
|
it('should have no conditions in tags keys query given query with no measurement or tag', function() {
|
||||||
var builder = new InfluxQueryBuilder({ measurement: '', tags: [] });
|
var builder = new InfluxQueryBuilder({ measurement: '', tags: [] });
|
||||||
var query = builder.buildExploreQuery('TAG_KEYS');
|
var query = builder.buildExploreQuery('TAG_KEYS');
|
||||||
|
|||||||
Reference in New Issue
Block a user