grafana/public/app/plugins/datasource/stackdriver/query_ctrl.ts

28 lines
792 B
TypeScript
Raw Normal View History

import _ from 'lodash';
2018-09-04 19:21:02 +08:00
import { QueryCtrl } from 'app/plugins/sdk';
2019-02-05 22:28:03 +08:00
import { StackdriverQuery } from './types';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { auto } from 'angular';
2018-09-04 19:21:02 +08:00
export class StackdriverQueryCtrl extends QueryCtrl {
static templateUrl = 'partials/query.editor.html';
templateSrv: TemplateSrv;
2018-09-04 19:21:02 +08:00
/** @ngInject */
constructor($scope: any, $injector: auto.IInjectorService, templateSrv: TemplateSrv) {
2018-09-04 19:21:02 +08:00
super($scope, $injector);
2019-01-08 20:52:19 +08:00
this.templateSrv = templateSrv;
this.onQueryChange = this.onQueryChange.bind(this);
this.onExecuteQuery = this.onExecuteQuery.bind(this);
2018-12-13 07:16:48 +08:00
}
2019-02-05 22:28:03 +08:00
onQueryChange(target: StackdriverQuery) {
2018-12-19 21:19:27 +08:00
Object.assign(this.target, target);
2018-12-13 07:16:48 +08:00
}
onExecuteQuery() {
2018-12-19 21:19:27 +08:00
this.$scope.ctrl.refresh();
2018-09-13 17:02:31 +08:00
}
2018-09-04 19:21:02 +08:00
}