Commit 9ebf769b by Torkel Ödegaard

Fixes #191, update graph after adding new function and not changing default value

parent b3965632
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"company": "Coding Instinct AB" "company": "Coding Instinct AB"
}, },
"name": "grafana", "name": "grafana",
"version": "1.5.0", "version": "1.5.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "http://github.com/torkelo/grafana.git" "url": "http://github.com/torkelo/grafana.git"
......
...@@ -211,10 +211,14 @@ function (angular, _, config, gfunc, Parser) { ...@@ -211,10 +211,14 @@ function (angular, _, config, gfunc, Parser) {
return; return;
} }
var oldTarget = $scope.target.target;
var target = getSegmentPathUpTo($scope.segments.length); var target = getSegmentPathUpTo($scope.segments.length);
target = _.reduce($scope.functions, wrapFunction, target); $scope.target.target = _.reduce($scope.functions, wrapFunction, target);
$scope.target.target = target;
if ($scope.target.target !== oldTarget) {
$scope.$parent.get_data(); $scope.$parent.get_data();
}
}; };
$scope.removeFunction = function(func) { $scope.removeFunction = function(func) {
......
...@@ -60,11 +60,8 @@ function (angular, _, $) { ...@@ -60,11 +60,8 @@ function (angular, _, $) {
if ($input.val() !== '') { if ($input.val() !== '') {
$link.text($input.val()); $link.text($input.val());
if (func.updateParam($input.val(), paramIndex)) { func.updateParam($input.val(), paramIndex);
$scope.$apply(function() { $scope.$apply($scope.targetChanged);
$scope.targetChanged();
});
}
} }
$input.hide(); $input.hide();
......
...@@ -314,8 +314,6 @@ function (_) { ...@@ -314,8 +314,6 @@ function (_) {
}; };
FuncInstance.prototype.updateParam = function(strValue, index) { FuncInstance.prototype.updateParam = function(strValue, index) {
var oldValue = this.params[index];
if (this.def.params[index].type === 'int') { if (this.def.params[index].type === 'int') {
this.params[index] = parseInt(strValue, 10); this.params[index] = parseInt(strValue, 10);
} }
...@@ -324,8 +322,6 @@ function (_) { ...@@ -324,8 +322,6 @@ function (_) {
} }
this.updateText(); this.updateText();
return oldValue !== this.params[index];
}; };
FuncInstance.prototype.updateText = function () { FuncInstance.prototype.updateText = function () {
......
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