query_ctrl.ts 767 B

12345678910111213141516171819202122232425
  1. import { QueryCtrl } from 'app/plugins/sdk';
  2. import { StackdriverQuery } from './types';
  3. import { TemplateSrv } from 'app/features/templating/template_srv';
  4. import { auto } from 'angular';
  5. export class StackdriverQueryCtrl extends QueryCtrl {
  6. static templateUrl = 'partials/query.editor.html';
  7. templateSrv: TemplateSrv;
  8. /** @ngInject */
  9. constructor($scope: any, $injector: auto.IInjectorService, templateSrv: TemplateSrv) {
  10. super($scope, $injector);
  11. this.templateSrv = templateSrv;
  12. this.onQueryChange = this.onQueryChange.bind(this);
  13. this.onExecuteQuery = this.onExecuteQuery.bind(this);
  14. }
  15. onQueryChange(target: StackdriverQuery) {
  16. Object.assign(this.target, target);
  17. }
  18. onExecuteQuery() {
  19. this.$scope.ctrl.refresh();
  20. }
  21. }