Commit 71b5007e by Mitsuhiro Tanda

refactor

parent 07cce5f6
...@@ -354,17 +354,13 @@ function (angular, _, moment, dateMath, CloudWatchAnnotationQuery) { ...@@ -354,17 +354,13 @@ function (angular, _, moment, dateMath, CloudWatchAnnotationQuery) {
var self = this; var self = this;
return _.chain(targets) return _.chain(targets)
.map(function(target) { .map(function(target) {
var dimensionKey = null; var dimensionKey = _.findKey(target.dimensions, function(v) {
var variableName = null; return templateSrv.variableExists(v);
_.each(target.dimensions, function(v, k) {
if (templateSrv.variableExists(v)) {
dimensionKey = k;
variableName = v;
}
}); });
if (dimensionKey) { if (dimensionKey) {
var variable = _.find(templateSrv.variables, function(variable) { var variable = _.find(templateSrv.variables, function(variable) {
return templateSrv.containsVariable(variableName, variable.name); return templateSrv.containsVariable(target.dimensions[dimensionKey], variable.name);
}); });
return self.getExpandedVariables(target, dimensionKey, variable); return self.getExpandedVariables(target, dimensionKey, variable);
} else { } else {
......
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