@@ -310,7 +310,11 @@ def get_dashboard_data(self):
310310 print ("target-type is 'row': skipped" )
311311 continue
312312
313- if dtsrc in self .datasources and targets is not None :
313+ if isinstance (dtsrc , dict ):
314+ dtsrc = dtsrc ['uid' ]
315+ # else:
316+ # ff
317+ if (dtsrc in self .datasources or dtsrc == '-- Mixed --' ) and targets is not None :
314318
315319# print('dt: {0}'.format(datasources[dtsrc]))
316320 for target in targets :
@@ -323,6 +327,10 @@ def get_dashboard_data(self):
323327 if 'format' in target and target ['format' ] == 'table' :
324328 query_type = 'query'
325329
330+ # check if expr is defined or and unconfigurated query
331+ if 'expr' not in target :
332+ print ("target expr is not defined: skipped!" )
333+ continue
326334
327335 # check if target expr contains variable ($var)
328336 expr = target ['expr' ]
@@ -350,8 +358,19 @@ def get_dashboard_data(self):
350358 }
351359 if self .debug :
352360 print ("query GET datasource proxy uri: {0}" .format (self .api .client .url ))
361+ # determine datasource name if global name is 'mixed'
362+ if dtsrc == '-- Mixed --' and 'datasource' in target :
363+ datasource_name = target ['datasource' ]
364+ if isinstance (datasource_name , dict ):
365+ datasource_name = datasource_name ['uid' ]
366+ else :
367+ datasource_name = dtsrc
368+ if not datasource_name in self .datasources :
369+ print ("datasource '{0}' was not found" .format (datasource_name ))
370+ continue
371+
353372 try :
354- content = self .api .datasource .get_datasource_proxy_data ( str (self .datasources [dtsrc ]), ** params )
373+ content = self .api .datasource .get_datasource_proxy_data ( str (self .datasources [datasource_name ]), ** params )
355374 except :
356375 print ('invalid results...' )
357376 return False
0 commit comments