support [[var]] in cloudwatch datasource (#7649)

* support [[var]] form in cloudwatch datasource

* support multi variable in single dimension

* fix test
This commit is contained in:
Mitsuhiro Tanda
2017-02-23 23:02:35 +09:00
committed by Torkel Ödegaard
parent d88286ab81
commit 68bb417db9
2 changed files with 21 additions and 12 deletions

View File

@@ -134,11 +134,18 @@ describe('CloudWatchDatasource', function() {
{
name: 'instance_id',
options: [
{ value: 'i-23456789', selected: false },
{ value: 'i-34567890', selected: true }
{ text: 'i-23456789', value: 'i-23456789', selected: false },
{ text: 'i-34567890', value: 'i-34567890', selected: true }
]
}
],
replace: function (target, scopedVars) {
if (target === '$instance_id' && scopedVars['instance_id']['text'] === 'i-34567890') {
return 'i-34567890';
} else {
return '';
}
},
getVariableName: function (e) { return 'instance_id'; },
variableExists: function (e) { return true; },
containsVariable: function (str, variableName) { return str.indexOf('$' + variableName) !== -1; }