Commit 61a618e4 by Torkel Ödegaard

fixes to templating

parent c4a4ecfc
...@@ -127,9 +127,9 @@ function (angular, _, moment, config, store) { ...@@ -127,9 +127,9 @@ function (angular, _, moment, config, store) {
to = Date.now(); to = Date.now();
} }
$scope.filter.setTime({ timeSrv.setTime({
from:moment.utc(from).toDate(), from: moment.utc(from).toDate(),
to:moment.utc(to).toDate(), to: moment.utc(to).toDate(),
}); });
}; };
......
...@@ -20,7 +20,6 @@ function (angular, _) { ...@@ -20,7 +20,6 @@ function (angular, _) {
$scope.init = function() { $scope.init = function() {
$scope.editor = { index: 0 }; $scope.editor = { index: 0 };
$scope.datasources = datasourceSrv.getMetricSources(); $scope.datasources = datasourceSrv.getMetricSources();
$scope.currentDatasource = _.findWhere($scope.datasources, { default: true });
$scope.variables = templateSrv.variables; $scope.variables = templateSrv.variables;
$scope.reset(); $scope.reset();
...@@ -39,10 +38,8 @@ function (angular, _) { ...@@ -39,10 +38,8 @@ function (angular, _) {
}; };
$scope.add = function() { $scope.add = function() {
$scope.current.datasource = $scope.currentDatasource.name;
$scope.variables.push($scope.current); $scope.variables.push($scope.current);
$scope.reset(); $scope.update();
$scope.editor.index = 0;
}; };
$scope.runQuery = function() { $scope.runQuery = function() {
...@@ -52,12 +49,6 @@ function (angular, _) { ...@@ -52,12 +49,6 @@ function (angular, _) {
$scope.edit = function(variable) { $scope.edit = function(variable) {
$scope.current = variable; $scope.current = variable;
$scope.currentIsNew = false; $scope.currentIsNew = false;
$scope.currentDatasource = _.findWhere($scope.datasources, { name: variable.datasource });
if (!$scope.currentDatasource) {
$scope.currentDatasource = $scope.datasources[0];
}
$scope.editor.index = 2; $scope.editor.index = 2;
}; };
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="editor-row row"> <div class="editor-row row">
<div class="span8"> <div class="span8">
<div ng-if="variables.length === 0"> <div ng-if="variables.length === 0">
<em>No replacements defined</em> <em>No template variables defined</em>
</div> </div>
<table class="grafana-options-table"> <table class="grafana-options-table">
<tr ng-repeat="variable in variables"> <tr ng-repeat="variable in variables">
......
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