Commit 5bc6d857 by Erik Sundell

stackdriver: broadcasting through $scope doesnt work anymore since…

stackdriver: broadcasting through $scope doesnt work anymore since query_filter_ctrl is now a sibling directive to query_aggregation_ctrl, so broadcasting is now done using $rootScope
parent a63877bd
...@@ -32,7 +32,11 @@ export class StackdriverAggregationCtrl { ...@@ -32,7 +32,11 @@ export class StackdriverAggregationCtrl {
this.alignOptions = options.alignOptions; this.alignOptions = options.alignOptions;
this.setAggOptions(); this.setAggOptions();
this.setAlignOptions(); this.setAlignOptions();
$scope.$on('metricTypeChanged', this.setAlignOptions.bind(this)); const self = this;
$scope.$on('metricTypeChanged', () => {
self.setAggOptions();
self.setAlignOptions();
});
} }
setAlignOptions() { setAlignOptions() {
......
...@@ -41,7 +41,7 @@ export class StackdriverFilterCtrl { ...@@ -41,7 +41,7 @@ export class StackdriverFilterCtrl {
datasource: any; datasource: any;
/** @ngInject */ /** @ngInject */
constructor(private $scope, private uiSegmentSrv, private templateSrv) { constructor(private $scope, private uiSegmentSrv, private templateSrv, private $rootScope) {
this.datasource = $scope.datasource; this.datasource = $scope.datasource;
this.target = $scope.target; this.target = $scope.target;
this.metricType = $scope.defaultDropdownValue; this.metricType = $scope.defaultDropdownValue;
...@@ -180,7 +180,7 @@ export class StackdriverFilterCtrl { ...@@ -180,7 +180,7 @@ export class StackdriverFilterCtrl {
this.target.unit = unit; this.target.unit = unit;
this.target.valueType = valueType; this.target.valueType = valueType;
this.target.metricKind = metricKind; this.target.metricKind = metricKind;
this.$scope.$broadcast('metricTypeChanged'); this.$rootScope.$broadcast('metricTypeChanged');
} }
async getGroupBys(segment, index, removeText?: string, removeUsed = true) { async getGroupBys(segment, index, removeText?: string, removeUsed = true) {
......
...@@ -420,7 +420,7 @@ function createCtrlWithFakes(existingFilters?: string[]) { ...@@ -420,7 +420,7 @@ function createCtrlWithFakes(existingFilters?: string[]) {
refresh: () => {}, refresh: () => {},
}; };
return new StackdriverFilterCtrl(scope, fakeSegmentServer, new TemplateSrvStub()); return new StackdriverFilterCtrl(scope, fakeSegmentServer, new TemplateSrvStub(), { $broadcast: param => {} });
} }
function createTarget(existingFilters?: string[]) { function createTarget(existingFilters?: string[]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment