diff --git a/public/app/plugins/datasource/stackdriver/constants.ts b/public/app/plugins/datasource/stackdriver/constants.ts index 3846bfc68a1..eb808d48408 100644 --- a/public/app/plugins/datasource/stackdriver/constants.ts +++ b/public/app/plugins/datasource/stackdriver/constants.ts @@ -33,3 +33,15 @@ export const aggOptions = [ { text: '50th percentile', value: 'REDUCE_PERCENTILE_50' }, { text: '5th percentile', value: 'REDUCE_PERCENTILE_05' }, ]; + +export const alignmentPeriods = [ + { text: 'auto', value: 'auto' }, + { text: '1m', value: '+60s' }, + { text: '5m', value: '+300s' }, + { text: '30m', value: '+1800s' }, + { text: '1h', value: '+3600s' }, + { text: '6h', value: '+21600s' }, + { text: '1d', value: '+86400s' }, + { text: '1w', value: '+604800s' }, + { text: '1m', value: '+18748800s' }, +]; diff --git a/public/app/plugins/datasource/stackdriver/datasource.ts b/public/app/plugins/datasource/stackdriver/datasource.ts index 9c1706095bf..fb78f1fb559 100644 --- a/public/app/plugins/datasource/stackdriver/datasource.ts +++ b/public/app/plugins/datasource/stackdriver/datasource.ts @@ -31,6 +31,7 @@ export default class StackdriverDatasource { primaryAggregation: t.aggregation.crossSeriesReducer, secondaryAggregation: t.aggregation.secondaryCrossSeriesReducer, perSeriesAligner: t.aggregation.perSeriesAligner, + alignmentPeriod: t.aggregation.alignmentPeriod, groupBys: t.aggregation.groupBys, view: t.view || 'FULL', filters: t.filters, diff --git a/public/app/plugins/datasource/stackdriver/partials/query.editor.html b/public/app/plugins/datasource/stackdriver/partials/query.editor.html index 23a7493c7b7..42b93c1826e 100755 --- a/public/app/plugins/datasource/stackdriver/partials/query.editor.html +++ b/public/app/plugins/datasource/stackdriver/partials/query.editor.html @@ -53,16 +53,21 @@
-
-
- +
+
+
+ +
+
diff --git a/public/app/plugins/datasource/stackdriver/query_ctrl.ts b/public/app/plugins/datasource/stackdriver/query_ctrl.ts index 981a58b9685..d82414382f8 100644 --- a/public/app/plugins/datasource/stackdriver/query_ctrl.ts +++ b/public/app/plugins/datasource/stackdriver/query_ctrl.ts @@ -1,7 +1,8 @@ import _ from 'lodash'; import { QueryCtrl } from 'app/plugins/sdk'; import appEvents from 'app/core/app_events'; -import { aggOptions, alignOptions } from './constants'; +import * as options from './constants'; +// mport BaseComponent, * as extras from './A'; export interface QueryMeta { rawQuery: string; @@ -33,6 +34,7 @@ export class StackdriverQueryCtrl extends QueryCtrl { defaultRemoveGroupByValue = '-- remove group by --'; defaultRemoveFilterValue = '-- remove filter --'; loadLabelsPromise: Promise; + stackdriverConstants; defaults = { project: { @@ -43,7 +45,7 @@ export class StackdriverQueryCtrl extends QueryCtrl { aggregation: { crossSeriesReducer: 'REDUCE_MEAN', secondaryCrossSeriesReducer: 'REDUCE_NONE', - alignmentPeriod: '', + alignmentPeriod: 'auto', perSeriesAligner: 'ALIGN_MEAN', groupBys: [], }, @@ -54,10 +56,6 @@ export class StackdriverQueryCtrl extends QueryCtrl { groupBySegments: any[]; filterSegments: any[]; removeSegment: any; - - aggOptions = []; - alignOptions = []; - showHelp: boolean; showLastQuery: boolean; lastQueryMeta: QueryMeta; @@ -72,8 +70,7 @@ export class StackdriverQueryCtrl extends QueryCtrl { this.panelCtrl.events.on('data-received', this.onDataReceived.bind(this), $scope); this.panelCtrl.events.on('data-error', this.onDataError.bind(this), $scope); - this.alignOptions = alignOptions; - this.aggOptions = aggOptions; + this.stackdriverConstants = options; this.getCurrentProject() .then(this.getMetricTypes.bind(this))