Quellcode durchsuchen

Stackdriver: Set target correctly

Erik Sundell vor 7 Jahren
Ursprung
Commit
191b6cc32c
1 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen
  1. 9 8
      public/app/plugins/datasource/stackdriver/query_ctrl.ts

+ 9 - 8
public/app/plugins/datasource/stackdriver/query_ctrl.ts

@@ -13,17 +13,18 @@ export class StackdriverQueryCtrl extends QueryCtrl {
   };
   };
   defaultDropdownValue = 'select';
   defaultDropdownValue = 'select';
 
 
+  defaults = {
+    project: {
+      id: 'default',
+      name: 'loading project...',
+    },
+    metricType: this.defaultDropdownValue,
+  };
+
   /** @ngInject */
   /** @ngInject */
   constructor($scope, $injector) {
   constructor($scope, $injector) {
     super($scope, $injector);
     super($scope, $injector);
-    this.target = {
-      project: {
-        id: 'default',
-        name: 'loading project...',
-      },
-      metricType: this.defaultDropdownValue,
-    };
-
+    _.defaultsDeep(this.target, this.defaults);
     this.getCurrentProject().then(this.getMetricTypes.bind(this));
     this.getCurrentProject().then(this.getMetricTypes.bind(this));
   }
   }