Commit 6a161216 by bergquist

fix(influxdb): fixes bug with empty tagColumn for annotations

parent 51c4385c
...@@ -89,7 +89,7 @@ function (_, TableModel) { ...@@ -89,7 +89,7 @@ function (_, TableModel) {
if (column === 'sequence_number') { return; } if (column === 'sequence_number') { return; }
if (!titleCol) { titleCol = index; } if (!titleCol) { titleCol = index; }
if (column === self.annotation.titleColumn) { titleCol = index; return; } if (column === self.annotation.titleColumn) { titleCol = index; return; }
if (_.includes(self.annotation.tagsColumn.replace(' ', '').split(","), column)) { tagsCol.push(index); return; } if (_.includes((self.annotation.tagsColumn || '').replace(' ', '').split(","), column)) { tagsCol.push(index); return; }
if (column === self.annotation.textColumn) { textCol = index; return; } if (column === self.annotation.textColumn) { textCol = index; return; }
}); });
......
...@@ -208,30 +208,56 @@ describe('when generating timeseries from influxdb response', function() { ...@@ -208,30 +208,56 @@ describe('when generating timeseries from influxdb response', function() {
}); });
describe('given annotation response', function() { describe('given annotation response', function() {
var options = { describe('with empty tagsColumn', function() {
alias: '', var options = {
annotation: { alias: '',
tagsColumn: 'datacenter, source' annotation: {},
}, series: [
series: [ {
{ name: "logins.count",
name: "logins.count", tags: {datacenter: 'Africa', server: 'server2'},
tags: {datacenter: 'Africa', server: 'server2'}, columns: ["time", "datacenter", "hostname", "source", "value"],
columns: ["time", "datacenter", "hostname", "source", "value"], values: [
values: [ [1481549440372, "America", "10.1.100.10", "backend", 215.7432653659507],
[1481549440372, "America", "10.1.100.10", "backend", 215.7432653659507], ]
] }
} ]
] };
};
it('should multiple tags', function() {
var series = new InfluxSeries(options);
var annotations = series.getAnnotations();
it('should multiple tags', function() { expect(annotations[0].tags.length).to.be(0);
var series = new InfluxSeries(options); });
var annotations = series.getAnnotations(); });
expect(annotations[0].tags.length).to.be(2); describe('given annotation response', function() {
expect(annotations[0].tags[0]).to.be('America'); var options = {
expect(annotations[0].tags[1]).to.be('backend'); alias: '',
annotation: {
tagsColumn: 'datacenter, source'
},
series: [
{
name: "logins.count",
tags: {datacenter: 'Africa', server: 'server2'},
columns: ["time", "datacenter", "hostname", "source", "value"],
values: [
[1481549440372, "America", "10.1.100.10", "backend", 215.7432653659507],
]
}
]
};
it('should multiple tags', function() {
var series = new InfluxSeries(options);
var annotations = series.getAnnotations();
expect(annotations[0].tags.length).to.be(2);
expect(annotations[0].tags[0]).to.be('America');
expect(annotations[0].tags[1]).to.be('backend');
});
}); });
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment