fix issue with metric find & functions being loaded multiple times

This commit is contained in:
Dan Cech 2018-01-11 11:21:02 -05:00
parent 60ba6ee6a2
commit b483d42d34
No known key found for this signature in database
GPG Key ID: 6F1146C5B66FBD41
2 changed files with 4 additions and 2 deletions

View File

@ -429,7 +429,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
url: '/functions', url: '/functions',
}; };
return self self.funcDefs = self
.doGraphiteRequest(httpOptions) .doGraphiteRequest(httpOptions)
.then(results => { .then(results => {
if (results.status !== 200 || typeof results.data !== 'object') { if (results.status !== 200 || typeof results.data !== 'object') {
@ -530,6 +530,8 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
self.funcDefs = gfunc.getFuncDefs(self.graphiteVersion); self.funcDefs = gfunc.getFuncDefs(self.graphiteVersion);
return self.funcDefs; return self.funcDefs;
}); });
return self.funcDefs;
}; };
this.testDatasource = function() { this.testDatasource = function() {

View File

@ -106,7 +106,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
} }
getAltSegments(index, prefix) { getAltSegments(index, prefix) {
var query = '*' + prefix + '*'; var query = prefix && prefix.length > 0 ? '*' + prefix + '*' : '*';
if (index > 0) { if (index > 0) {
query = this.queryModel.getSegmentPathUpTo(index) + '.' + query; query = this.queryModel.getSegmentPathUpTo(index) + '.' + query;
} }