mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
InfluxDB: Fixed new group by dropdown now showing (#26031)
This commit is contained in:
@@ -90,6 +90,12 @@ export class InfluxQueryBuilder {
|
|||||||
if (tag.key === withKey) {
|
if (tag.key === withKey) {
|
||||||
return memo;
|
return memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// value operators not supported in these types of queries
|
||||||
|
if (tag.operator === '>' || tag.operator === '<') {
|
||||||
|
return memo;
|
||||||
|
}
|
||||||
|
|
||||||
memo.push(renderTagCondition(tag, memo.length));
|
memo.push(renderTagCondition(tag, memo.length));
|
||||||
return memo;
|
return memo;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
|
|||||||
const plusButton = this.uiSegmentSrv.newPlusButton();
|
const plusButton = this.uiSegmentSrv.newPlusButton();
|
||||||
this.groupBySegment.value = plusButton.value;
|
this.groupBySegment.value = plusButton.value;
|
||||||
this.groupBySegment.html = plusButton.html;
|
this.groupBySegment.html = plusButton.html;
|
||||||
|
this.groupBySegment.fake = true;
|
||||||
this.panelCtrl.refresh();
|
this.panelCtrl.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,6 +309,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
|
|||||||
if (segment.type === 'condition') {
|
if (segment.type === 'condition') {
|
||||||
return Promise.resolve([this.uiSegmentSrv.newSegment('AND'), this.uiSegmentSrv.newSegment('OR')]);
|
return Promise.resolve([this.uiSegmentSrv.newSegment('AND'), this.uiSegmentSrv.newSegment('OR')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (segment.type === 'operator') {
|
if (segment.type === 'operator') {
|
||||||
const nextValue = this.tagSegments[index + 1].value;
|
const nextValue = this.tagSegments[index + 1].value;
|
||||||
if (/^\/.*\/$/.test(nextValue)) {
|
if (/^\/.*\/$/.test(nextValue)) {
|
||||||
|
|||||||
@@ -32,6 +32,15 @@ describe('InfluxQueryBuilder', () => {
|
|||||||
expect(query).toBe('SHOW TAG KEYS WHERE "host" = \'se1\'');
|
expect(query).toBe('SHOW TAG KEYS WHERE "host" = \'se1\'');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should ignore condition if operator is a value operator', () => {
|
||||||
|
const builder = new InfluxQueryBuilder({
|
||||||
|
measurement: '',
|
||||||
|
tags: [{ key: 'value', value: '10', operator: '>' }],
|
||||||
|
});
|
||||||
|
const query = builder.buildExploreQuery('TAG_KEYS');
|
||||||
|
expect(query).toBe('SHOW TAG KEYS');
|
||||||
|
});
|
||||||
|
|
||||||
it('should have no conditions in measurement query for query with no tags', () => {
|
it('should have no conditions in measurement query for query with no tags', () => {
|
||||||
const builder = new InfluxQueryBuilder({ measurement: '', tags: [] });
|
const builder = new InfluxQueryBuilder({ measurement: '', tags: [] });
|
||||||
const query = builder.buildExploreQuery('MEASUREMENTS');
|
const query = builder.buildExploreQuery('MEASUREMENTS');
|
||||||
|
|||||||
Reference in New Issue
Block a user