瀏覽代碼

fix issue with metric find & functions being loaded multiple times

Dan Cech 8 年之前
父節點
當前提交
b483d42d34

+ 3 - 1
public/app/plugins/datasource/graphite/datasource.ts

@@ -429,7 +429,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
       url: '/functions',
     };
 
-    return self
+    self.funcDefs = self
       .doGraphiteRequest(httpOptions)
       .then(results => {
         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);
         return self.funcDefs;
       });
+
+    return self.funcDefs;
   };
 
   this.testDatasource = function() {

+ 1 - 1
public/app/plugins/datasource/graphite/query_ctrl.ts

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