From 01f3d728ef1678837bcfbb4670e52c1a70d5dc7f Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Mon, 21 Apr 2014 18:07:55 +0200 Subject: [PATCH] Added labels per series management --- src/app/partials/influxdb/editor.html | 12 ++++++++++++ src/app/services/influxdb/influxdbDatasource.js | 9 ++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/app/partials/influxdb/editor.html b/src/app/partials/influxdb/editor.html index fbeaa3fbdf0..0c7b077bc19 100644 --- a/src/app/partials/influxdb/editor.html +++ b/src/app/partials/influxdb/editor.html @@ -51,6 +51,18 @@ data-min-length=0 data-items=100 ng-blur="get_data()"> +
  • + label +
  • + +
  • + +
  • from series
  • diff --git a/src/app/services/influxdb/influxdbDatasource.js b/src/app/services/influxdb/influxdbDatasource.js index ebeb7443c78..e80f7a82d4c 100644 --- a/src/app/services/influxdb/influxdbDatasource.js +++ b/src/app/services/influxdb/influxdbDatasource.js @@ -91,7 +91,7 @@ function (angular, _, kbn) { target.query = query; } - return this.doInfluxRequest(query).then(handleInfluxQueryResponse); + return this.doInfluxRequest(query, target.label).then(handleInfluxQueryResponse); }, this); @@ -130,7 +130,7 @@ function (angular, _, kbn) { }); } - InfluxDatasource.prototype.doInfluxRequest = function(query) { + InfluxDatasource.prototype.doInfluxRequest = function(query, name) { var _this = this; var deferred = $q.defer(); @@ -151,6 +151,7 @@ function (angular, _, kbn) { }; return $http(options).success(function (data) { + data.label = name; deferred.resolve(data); }); }, 10); @@ -169,9 +170,7 @@ function (angular, _, kbn) { return; } - console.log("series:"+series.name + ": "+series.points.length + " points"); - - var target = series.name + "." + column + getKey(results.config.params.q); + var target = data.label || series.name + "." + column; var datapoints = []; for(var i = 0; i < series.points.length; i++) {