Dashboard: replace datasource name with a reference object (#33817)

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Elfo404 <me@giordanoricci.com>
This commit is contained in:
Ryan McKinley
2021-10-29 10:57:24 -07:00
committed by GitHub
parent 61fbdb60ff
commit 7319efe077
78 changed files with 759 additions and 320 deletions

View File

@@ -75,10 +75,13 @@ export class DashboardExporter {
let datasourceVariable: any = null;
// ignore data source properties that contain a variable
if (datasource && datasource.indexOf('$') === 0) {
datasourceVariable = variableLookup[datasource.substring(1)];
if (datasourceVariable && datasourceVariable.current) {
datasource = datasourceVariable.current.value;
if (datasource && (datasource as any).uid) {
const uid = (datasource as any).uid as string;
if (uid.indexOf('$') === 0) {
datasourceVariable = variableLookup[uid.substring(1)];
if (datasourceVariable && datasourceVariable.current) {
datasource = datasourceVariable.current.value;
}
}
}