query_ctrl.ts 792 B

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