Skip to content

Commit

Permalink
Update for version 20210604-grafana7
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Ferrero committed Jun 4, 2021
1 parent 8e4418e commit bcbd913
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/directives/metric_name_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export class MetricNameFieldCtrl {
this.$scope = $scope;
this.$q = $q;
this.uiSegmentSrv = uiSegmentSrv;
if (this.$scope.ctrl.target) {
if (this.$scope.ctrl.target.query) {
this.value = this.$scope.ctrl.target.query.metricName;
}
}
this.promiseUtils = new PromiseUtils($q);
this.segment = this.value ? uiSegmentSrv.newSegment(this.value) : uiSegmentSrv.newSelectMetric();
this.aliasAddedVisible = !_.isNil(this.alias);
Expand Down
8 changes: 7 additions & 1 deletion src/directives/tags_select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ export class TagsSelectCtrl {
public availableValues: string[];
public selectedValues: string[];
public segments: any[];
public $scope: any;

/** @ngInject **/
constructor(private uiSegmentSrv) {
constructor( $scope, private uiSegmentSrv) {
this.$scope = $scope;
this.selectedValues = this.selectedValues || [];
this.availableValues = this.tagValues;
this.segments = this.selectedValues.map((tagValue) => this.uiSegmentSrv.newSegment(tagValue));
this.segments.push(this.uiSegmentSrv.newPlusButton());
setTimeout( ( ) => { this.segments = this.selectedValues.map( ( tagValue ) => this.uiSegmentSrv.newSegment(tagValue) );
this.segments.push(this.uiSegmentSrv.newPlusButton());
this.$scope.$apply();
}, 500);
}

public onChange(): void {
Expand Down

0 comments on commit bcbd913

Please sign in to comment.