stackdriver: make it possible to use aligner template variable

This commit is contained in:
Erik Sundell 2018-11-02 10:52:55 +01:00
parent 2a6aec721e
commit a027a87d50
1 changed files with 4 additions and 2 deletions

View File

@ -43,7 +43,7 @@ export class StackdriverAggregationCtrl {
setAlignOptions() {
this.alignOptions = getAlignmentOptionsByMetric(this.target.valueType, this.target.metricKind);
if (!this.alignOptions.find(o => o.value === this.target.aggregation.perSeriesAligner)) {
if (!this.alignOptions.find(o => o.value === this.templateSrv.replace(this.target.aggregation.perSeriesAligner))) {
this.target.aggregation.perSeriesAligner = this.alignOptions.length > 0 ? this.alignOptions[0].value : '';
}
}
@ -62,7 +62,9 @@ export class StackdriverAggregationCtrl {
}
formatAlignmentText() {
const selectedAlignment = this.alignOptions.find(ap => ap.value === this.target.aggregation.perSeriesAligner);
const selectedAlignment = this.alignOptions.find(
ap => ap.value === this.templateSrv.replace(this.target.aggregation.perSeriesAligner)
);
return `${kbn.secondsToHms(this.$scope.alignmentPeriod)} interval (${selectedAlignment.text})`;
}