Commit a9cfb160 by Torkel Ödegaard

Added typeahead to series overrides, #425

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