Commit a9cfb160 by Torkel Ödegaard

Added typeahead to series overrides, #425

parent 468c9a90
...@@ -12,6 +12,8 @@ function (_, kbn) { ...@@ -12,6 +12,8 @@ function (_, kbn) {
} }
function matchSeriesOverride(aliasOrRegex, seriesAlias) { function matchSeriesOverride(aliasOrRegex, seriesAlias) {
if (!aliasOrRegex) { return false; }
if (aliasOrRegex[0] === '/') { if (aliasOrRegex[0] === '/') {
var match = aliasOrRegex.match(new RegExp('^/(.*?)/(g?i?m?y?)$')); var match = aliasOrRegex.match(new RegExp('^/(.*?)/(g?i?m?y?)$'));
var regex = new RegExp(match[1], match[2]); var regex = new RegExp(match[1], match[2]);
......
...@@ -44,6 +44,12 @@ define([ ...@@ -44,6 +44,12 @@ define([
$scope.render(); $scope.render();
}; };
$scope.getSeriesNames = function() {
return _.map($scope.legend, function(info) {
return info.alias;
});
};
$scope.updateCurrentOverrides = function() { $scope.updateCurrentOverrides = function() {
$scope.currentOverrides = []; $scope.currentOverrides = [];
_.each($scope.overrideMenu, function(option) { _.each($scope.overrideMenu, function(option) {
......
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
<div class="grafana-target-inner"> <div class="grafana-target-inner">
<ul class="grafana-target-controls-left"> <ul class="grafana-target-controls-left">
<li class="grafana-target-segment>" <li class="grafana-target-segment">
<i class="icon-remove" ng-click="removeSeriesOverride(override)"></i> <i class="icon-remove pointer" ng-click="removeSeriesOverride(override)"></i>
</li> </li>
</ul> </ul>
...@@ -84,7 +84,9 @@ ...@@ -84,7 +84,9 @@
<li> <li>
<input type="text" <input type="text"
ng-model="override.alias" ng-model="override.alias"
ng-model-onblur ng-change="render()" bs-typeahead="getSeriesNames"
ng-blur="render()"
data-min-length=0 data-items=100
class="input-medium grafana-target-segment-input" > class="input-medium grafana-target-segment-input" >
</li> </li>
<li class="grafana-target-segment" ng-repeat="option in currentOverrides"> <li class="grafana-target-segment" ng-repeat="option in currentOverrides">
......
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