diff --git a/public/app/partials/metrics.html b/public/app/partials/metrics.html
index 8ab5c4a1677..934feb1eb2c 100644
--- a/public/app/partials/metrics.html
+++ b/public/app/partials/metrics.html
@@ -1,8 +1,10 @@
diff --git a/public/app/plugins/datasource/graphite/add_graphite_func.js b/public/app/plugins/datasource/graphite/add_graphite_func.js
index 46d93f6481f..6c218513d57 100644
--- a/public/app/plugins/datasource/graphite/add_graphite_func.js
+++ b/public/app/plugins/datasource/graphite/add_graphite_func.js
@@ -22,6 +22,7 @@ function (angular, _, $, gfunc) {
link: function($scope, elem) {
var categories = gfunc.getCategories();
var allFunctions = getAllFunctionNames(categories);
+ var ctrl = $scope.ctrl;
$scope.functionMenu = createFunctionDropDownMenu(categories);
@@ -48,7 +49,7 @@ function (angular, _, $, gfunc) {
}
$scope.$apply(function() {
- $scope.addFunction(funcDef);
+ ctrl.addFunction(funcDef);
});
$input.trigger('blur');
diff --git a/public/app/plugins/datasource/graphite/func_editor.js b/public/app/plugins/datasource/graphite/func_editor.js
index 63ee4b3f7cf..cd1f747bc4d 100644
--- a/public/app/plugins/datasource/graphite/func_editor.js
+++ b/public/app/plugins/datasource/graphite/func_editor.js
@@ -27,6 +27,7 @@ function (angular, _, $) {
link: function postLink($scope, elem) {
var $funcLink = $(funcSpanTemplate);
var $funcControls = $(funcControlsTemplate);
+ var ctrl = $scope.ctrl;
var func = $scope.func;
var funcDef = func.def;
var scheduledRelink = false;
@@ -79,11 +80,13 @@ function (angular, _, $) {
func.updateParam($input.val(), paramIndex);
scheduledRelinkIfNeeded();
- $scope.$apply($scope.targetChanged);
- }
+ $scope.$apply(function() {
+ ctrl.targetChanged();
+ });
- $input.hide();
- $link.show();
+ $input.hide();
+ $link.show();
+ }
}
function inputKeyPress(paramIndex, e) {
@@ -198,7 +201,7 @@ function (angular, _, $) {
if ($target.hasClass('fa-remove')) {
toggleFuncControls();
$scope.$apply(function() {
- $scope.removeFunction($scope.func);
+ ctrl.removeFunction($scope.func);
});
return;
}
@@ -206,7 +209,7 @@ function (angular, _, $) {
if ($target.hasClass('fa-arrow-left')) {
$scope.$apply(function() {
_.move($scope.functions, $scope.$index, $scope.$index - 1);
- $scope.targetChanged();
+ ctrl.targetChanged();
});
return;
}
@@ -214,7 +217,7 @@ function (angular, _, $) {
if ($target.hasClass('fa-arrow-right')) {
$scope.$apply(function() {
_.move($scope.functions, $scope.$index, $scope.$index + 1);
- $scope.targetChanged();
+ ctrl.targetChanged();
});
return;
}
diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts
index 8d1922c4802..f6afe8a6d13 100644
--- a/public/app/plugins/datasource/graphite/query_ctrl.ts
+++ b/public/app/plugins/datasource/graphite/query_ctrl.ts
@@ -1,6 +1,7 @@
///
import './add_graphite_func';
+import './func_editor';
import angular from 'angular';
import _ from 'lodash';
diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html
index 5a5a468ece7..cb51f28ff0e 100644
--- a/public/app/plugins/datasource/prometheus/partials/query.editor.html
+++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html
@@ -9,14 +9,14 @@
-
+