|
@@ -11,14 +11,23 @@ export default class ResponseParser {
|
|
|
return [];
|
|
return [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var influxdb11format = query.toLowerCase().indexOf('show tag values') >= 0;
|
|
|
|
|
-
|
|
|
|
|
var res = {};
|
|
var res = {};
|
|
|
_.each(influxResults.series, serie => {
|
|
_.each(influxResults.series, serie => {
|
|
|
_.each(serie.values, value => {
|
|
_.each(serie.values, value => {
|
|
|
if (_.isArray(value)) {
|
|
if (_.isArray(value)) {
|
|
|
- if (influxdb11format) {
|
|
|
|
|
- addUnique(res, value[1] || value[0]);
|
|
|
|
|
|
|
+ // In general, there are 2 possible shapes for the returned value.
|
|
|
|
|
+ // The first one is a two-element array,
|
|
|
|
|
+ // where the first element is somewhat a metadata value:
|
|
|
|
|
+ // the tag name for SHOW TAG VALUES queries,
|
|
|
|
|
+ // the time field for SELECT queries, etc.
|
|
|
|
|
+ // The second shape is an one-element array,
|
|
|
|
|
+ // that is containing an immediate value.
|
|
|
|
|
+ // For example, SHOW FIELD KEYS queries return such shape.
|
|
|
|
|
+ // Note, pre-0.11 versions return
|
|
|
|
|
+ // the second shape for SHOW TAG VALUES queries
|
|
|
|
|
+ // (while the newer versions—first).
|
|
|
|
|
+ if (value[1] !== undefined) {
|
|
|
|
|
+ addUnique(res, value[1]);
|
|
|
} else {
|
|
} else {
|
|
|
addUnique(res, value[0]);
|
|
addUnique(res, value[0]);
|
|
|
}
|
|
}
|
|
@@ -29,7 +38,7 @@ export default class ResponseParser {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
return _.map(res, value => {
|
|
return _.map(res, value => {
|
|
|
- return { text: value };
|
|
|
|
|
|
|
+ return { text: value.toString() };
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|