annotations_query_ctrl.ts 997 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import _ from 'lodash';
  2. import './query_filter_ctrl';
  3. import { registerAngularDirectives } from './angular_wrappers';
  4. export class StackdriverAnnotationsQueryCtrl {
  5. static templateUrl = 'partials/annotations.editor.html';
  6. annotation: any;
  7. datasource: any;
  8. defaultDropdownValue = 'Select Metric';
  9. defaultServiceValue = 'All Services';
  10. defaults = {
  11. project: {
  12. id: 'default',
  13. name: 'loading project...',
  14. },
  15. metricType: this.defaultDropdownValue,
  16. service: this.defaultServiceValue,
  17. metric: '',
  18. filters: [],
  19. metricKind: '',
  20. valueType: '',
  21. };
  22. /** @ngInject */
  23. constructor() {
  24. this.annotation.target = this.annotation.target || {};
  25. this.annotation.target.refId = 'annotationQuery';
  26. _.defaultsDeep(this.annotation.target, this.defaults);
  27. registerAngularDirectives();
  28. this.handleQueryChange = this.handleQueryChange.bind(this);
  29. }
  30. handleQueryChange(target) {
  31. Object.assign(this.annotation.target, target);
  32. }
  33. }