Fixes to edit view switching, and to templateValuesSrv

This commit is contained in:
Torkel Ödegaard 2015-02-28 10:29:17 +01:00
parent dcfad7d61b
commit 4a72c37fc1
3 changed files with 27 additions and 24 deletions

View File

@ -107,8 +107,10 @@ function (angular, $) {
showEditorPane(null, {}, newValue); showEditorPane(null, {}, newValue);
} else if (oldValue) { } else if (oldValue) {
scope.contextSrv.editview = null; scope.contextSrv.editview = null;
if (lastEditor === editViewMap[oldValue]) {
hideEditorPane(); hideEditorPane();
} }
}
}); });
scope.contextSrv.editview = null; scope.contextSrv.editview = null;

View File

@ -12,6 +12,7 @@ define([
var promiseCached; var promiseCached;
var list = []; var list = [];
var timezone; var timezone;
var self = this;
this.init = function() { this.init = function() {
$rootScope.onAppEvent('refresh', this.clearCache); $rootScope.onAppEvent('refresh', this.clearCache);
@ -33,15 +34,15 @@ define([
} }
timezone = dashboard.timezone; timezone = dashboard.timezone;
var annotations = _.where(dashboard.annotations.list, { enable: true }); var annotations = _.where(dashboard.annotations.list, {enable: true});
var promises = _.map(annotations, function(annotation) { var promises = _.map(annotations, function(annotation) {
var datasource = datasourceSrv.get(annotation.datasource); return datasourceSrv.get(annotation.datasource).then(function(datasource) {
return datasource.annotationQuery(annotation, rangeUnparsed) return datasource.annotationQuery(annotation, rangeUnparsed)
.then(this.receiveAnnotationResults) .then(self.receiveAnnotationResults)
.then(null, errorHandler); .then(null, errorHandler);
}, this); }, this);
});
promiseCached = $q.all(promises) promiseCached = $q.all(promises)
.then(function() { .then(function() {

View File

@ -97,9 +97,8 @@ function (angular, _, kbn) {
return $q.when([]); return $q.when([]);
} }
var datasource = datasourceSrv.get(variable.datasource); return datasourceSrv.get(variable.datasource).then(function(datasource) {
return datasource.metricFindQuery(variable.query) return datasource.metricFindQuery(variable.query).then(function (results) {
.then(function (results) {
variable.options = self.metricNamesToVariableValues(variable, results); variable.options = self.metricNamesToVariableValues(variable, results);
if (variable.includeAll) { if (variable.includeAll) {
@ -117,6 +116,7 @@ function (angular, _, kbn) {
return self.setVariableValue(variable, variable.options[0], true); return self.setVariableValue(variable, variable.options[0], true);
}); });
});
}; };
this.metricNamesToVariableValues = function(variable, metricNames) { this.metricNamesToVariableValues = function(variable, metricNames) {