Commit 9ebf769b by Torkel Ödegaard

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

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