fixes to templating

This commit is contained in:
Torkel Ödegaard 2014-08-29 10:17:00 +02:00
parent c4a4ecfc81
commit 61a618e473
3 changed files with 5 additions and 14 deletions

View File

@ -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(),
});
};

View File

@ -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;
};

View File

@ -18,7 +18,7 @@
<div class="editor-row row">
<div class="span8">
<div ng-if="variables.length === 0">
<em>No replacements defined</em>
<em>No template variables defined</em>
</div>
<table class="grafana-options-table">
<tr ng-repeat="variable in variables">