query_ctrl.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import _ from 'lodash';
  2. import { QueryCtrl } from 'app/plugins/sdk';
  3. import './query_filter_ctrl';
  4. import { StackdriverPicker } from './components/StackdriverPicker';
  5. import { react2AngularDirective } from 'app/core/utils/react2angular';
  6. import { registerAngularDirectives } from './angular_wrappers';
  7. import { Target } from './types';
  8. export class StackdriverQueryCtrl extends QueryCtrl {
  9. static templateUrl = 'partials/query.editor.html';
  10. /** @ngInject */
  11. constructor($scope, $injector) {
  12. super($scope, $injector);
  13. react2AngularDirective('stackdriverPicker', StackdriverPicker, [
  14. 'options',
  15. 'onChange',
  16. 'selected',
  17. 'searchable',
  18. 'className',
  19. 'placeholder',
  20. 'groupName',
  21. ['templateVariables', { watchDepth: 'reference' }],
  22. ]);
  23. registerAngularDirectives();
  24. this.handleQueryChange = this.handleQueryChange.bind(this);
  25. this.handleExecuteQuery = this.handleExecuteQuery.bind(this);
  26. }
  27. handleQueryChange(target: Target) {
  28. Object.assign(this.target, target);
  29. }
  30. handleExecuteQuery() {
  31. this.$scope.ctrl.refresh();
  32. }
  33. }