Commit e3e6f511 authored by Torkel Ödegaard's avatar Torkel Ödegaard
Browse files

focus first input param after adding function

parent 293a2db3
......@@ -10,7 +10,7 @@ function (angular, _, config, gfunc, Parser) {
var module = angular.module('kibana.controllers');
module.controller('GraphiteTargetCtrl', function($scope, $http, filterSrv) {
module.controller('GraphiteTargetCtrl', function($scope, $http, filterSrv, $timeout) {
$scope.init = function() {
parseTarget();
......@@ -223,7 +223,9 @@ function (angular, _, config, gfunc, Parser) {
};
$scope.addFunction = function(funcDef) {
$scope.functions.push(gfunc.createFuncInstance(funcDef));
var newFunc = gfunc.createFuncInstance(funcDef);
newFunc.added = true;
$scope.functions.push(newFunc);
var aliasFunc = _.find($scope.functions, function(func) {
return func.def.name === 'alias';
......@@ -234,7 +236,9 @@ function (angular, _, config, gfunc, Parser) {
$scope.functions.push(aliasFunc);
}
$scope.targetChanged();
if (!funcDef.params) {
$scope.targetChanged();
}
};
$scope.duplicate = function() {
......
......@@ -121,6 +121,13 @@ function (angular, _, $) {
$('<span>)</span>').appendTo(elem);
$compile(elem.contents())($scope);
if ($scope.func.added) {
$scope.func.added = false;
setTimeout(function() {
elem.find('a').click();
}, 10);
}
}
};
......
Supports Markdown
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