From 61a618e4739900a6a70daa1651b9097d1783a214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 29 Aug 2014 10:17:00 +0200 Subject: [PATCH] fixes to templating --- src/app/controllers/dashboardNavCtrl.js | 6 +++--- src/app/controllers/templateEditorCtrl.js | 11 +---------- src/app/partials/templating_editor.html | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/app/controllers/dashboardNavCtrl.js b/src/app/controllers/dashboardNavCtrl.js index 94b683e54fa..6f08ffb255e 100644 --- a/src/app/controllers/dashboardNavCtrl.js +++ b/src/app/controllers/dashboardNavCtrl.js @@ -127,9 +127,9 @@ function (angular, _, moment, config, store) { to = Date.now(); } - $scope.filter.setTime({ - from:moment.utc(from).toDate(), - to:moment.utc(to).toDate(), + timeSrv.setTime({ + from: moment.utc(from).toDate(), + to: moment.utc(to).toDate(), }); }; diff --git a/src/app/controllers/templateEditorCtrl.js b/src/app/controllers/templateEditorCtrl.js index 731bd433968..16d388b97fd 100644 --- a/src/app/controllers/templateEditorCtrl.js +++ b/src/app/controllers/templateEditorCtrl.js @@ -20,7 +20,6 @@ function (angular, _) { $scope.init = function() { $scope.editor = { index: 0 }; $scope.datasources = datasourceSrv.getMetricSources(); - $scope.currentDatasource = _.findWhere($scope.datasources, { default: true }); $scope.variables = templateSrv.variables; $scope.reset(); @@ -39,10 +38,8 @@ function (angular, _) { }; $scope.add = function() { - $scope.current.datasource = $scope.currentDatasource.name; $scope.variables.push($scope.current); - $scope.reset(); - $scope.editor.index = 0; + $scope.update(); }; $scope.runQuery = function() { @@ -52,12 +49,6 @@ function (angular, _) { $scope.edit = function(variable) { $scope.current = variable; $scope.currentIsNew = false; - $scope.currentDatasource = _.findWhere($scope.datasources, { name: variable.datasource }); - - if (!$scope.currentDatasource) { - $scope.currentDatasource = $scope.datasources[0]; - } - $scope.editor.index = 2; }; diff --git a/src/app/partials/templating_editor.html b/src/app/partials/templating_editor.html index 345ba8a5003..f930e153dd8 100644 --- a/src/app/partials/templating_editor.html +++ b/src/app/partials/templating_editor.html @@ -18,7 +18,7 @@
- No replacements defined + No template variables defined