Added labels per series management

parent bba76cac
...@@ -52,6 +52,18 @@ ...@@ -52,6 +52,18 @@
ng-blur="get_data()"> ng-blur="get_data()">
</li> </li>
<li class="grafana-target-segment" ng-hide="target.rawQuery"> <li class="grafana-target-segment" ng-hide="target.rawQuery">
label
</li>
<li ng-hide="target.rawQuery">
<input type="text"
class="input-small grafana-target-segment-input"
ng-model="target.label"
spellcheck='false'
placeholder="label"
ng-blur="seriesBlur()">
</li>
<li class="grafana-target-segment" ng-hide="target.rawQuery">
from series from series
</li> </li>
......
...@@ -91,7 +91,7 @@ function (angular, _, kbn) { ...@@ -91,7 +91,7 @@ function (angular, _, kbn) {
target.query = query; target.query = query;
} }
return this.doInfluxRequest(query).then(handleInfluxQueryResponse); return this.doInfluxRequest(query, target.label).then(handleInfluxQueryResponse);
}, this); }, this);
...@@ -130,7 +130,7 @@ function (angular, _, kbn) { ...@@ -130,7 +130,7 @@ function (angular, _, kbn) {
}); });
} }
InfluxDatasource.prototype.doInfluxRequest = function(query) { InfluxDatasource.prototype.doInfluxRequest = function(query, name) {
var _this = this; var _this = this;
var deferred = $q.defer(); var deferred = $q.defer();
...@@ -151,6 +151,7 @@ function (angular, _, kbn) { ...@@ -151,6 +151,7 @@ function (angular, _, kbn) {
}; };
return $http(options).success(function (data) { return $http(options).success(function (data) {
data.label = name;
deferred.resolve(data); deferred.resolve(data);
}); });
}, 10); }, 10);
...@@ -169,9 +170,7 @@ function (angular, _, kbn) { ...@@ -169,9 +170,7 @@ function (angular, _, kbn) {
return; return;
} }
console.log("series:"+series.name + ": "+series.points.length + " points"); var target = data.label || series.name + "." + column;
var target = series.name + "." + column + getKey(results.config.params.q);
var datapoints = []; var datapoints = [];
for(var i = 0; i < series.points.length; i++) { for(var i = 0; i < series.points.length; i++) {
......
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