mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
generate unique id when variable is multi
This commit is contained in:
parent
40ed235b3b
commit
4c59be4f5b
@ -389,11 +389,11 @@ export default class CloudWatchDatasource {
|
|||||||
var currentVariables = !_.isArray(variable.current.value)
|
var currentVariables = !_.isArray(variable.current.value)
|
||||||
? [variable.current]
|
? [variable.current]
|
||||||
: variable.current.value.map(v => {
|
: variable.current.value.map(v => {
|
||||||
return {
|
return {
|
||||||
text: v,
|
text: v,
|
||||||
value: v,
|
value: v,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
let useSelectedVariables =
|
let useSelectedVariables =
|
||||||
selectedVariables.some(s => {
|
selectedVariables.some(s => {
|
||||||
return s.value === currentVariables[0].value;
|
return s.value === currentVariables[0].value;
|
||||||
@ -404,8 +404,10 @@ export default class CloudWatchDatasource {
|
|||||||
scopedVar[variable.name] = v;
|
scopedVar[variable.name] = v;
|
||||||
t.refId = target.refId + '_' + v.value;
|
t.refId = target.refId + '_' + v.value;
|
||||||
t.dimensions[dimensionKey] = templateSrv.replace(t.dimensions[dimensionKey], scopedVar);
|
t.dimensions[dimensionKey] = templateSrv.replace(t.dimensions[dimensionKey], scopedVar);
|
||||||
if (target.id) {
|
if (variable.multi && target.id) {
|
||||||
t.id = target.id + window.btoa(v.value).replace(/=/g, '0'); // generate unique id
|
t.id = target.id + window.btoa(v.value).replace(/=/g, '0'); // generate unique id
|
||||||
|
} else {
|
||||||
|
t.id = target.id;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user