query_ctrl.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. 'use strict';
  2. System.register(['app/plugins/sdk', './css/query-editor.css!'], function (_export, _context) {
  3. "use strict";
  4. var QueryCtrl, _createClass, GenericDatasourceQueryCtrl;
  5. function _classCallCheck(instance, Constructor) {
  6. if (!(instance instanceof Constructor)) {
  7. throw new TypeError("Cannot call a class as a function");
  8. }
  9. }
  10. function _possibleConstructorReturn(self, call) {
  11. if (!self) {
  12. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  13. }
  14. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  15. }
  16. function _inherits(subClass, superClass) {
  17. if (typeof superClass !== "function" && superClass !== null) {
  18. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  19. }
  20. subClass.prototype = Object.create(superClass && superClass.prototype, {
  21. constructor: {
  22. value: subClass,
  23. enumerable: false,
  24. writable: true,
  25. configurable: true
  26. }
  27. });
  28. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  29. }
  30. return {
  31. setters: [function (_appPluginsSdk) {
  32. QueryCtrl = _appPluginsSdk.QueryCtrl;
  33. }, function (_cssQueryEditorCss) {}],
  34. execute: function () {
  35. _createClass = function () {
  36. function defineProperties(target, props) {
  37. for (var i = 0; i < props.length; i++) {
  38. var descriptor = props[i];
  39. descriptor.enumerable = descriptor.enumerable || false;
  40. descriptor.configurable = true;
  41. if ("value" in descriptor) descriptor.writable = true;
  42. Object.defineProperty(target, descriptor.key, descriptor);
  43. }
  44. }
  45. return function (Constructor, protoProps, staticProps) {
  46. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  47. if (staticProps) defineProperties(Constructor, staticProps);
  48. return Constructor;
  49. };
  50. }();
  51. _export('GenericDatasourceQueryCtrl', GenericDatasourceQueryCtrl = function (_QueryCtrl) {
  52. _inherits(GenericDatasourceQueryCtrl, _QueryCtrl);
  53. function GenericDatasourceQueryCtrl($scope, $injector) {
  54. _classCallCheck(this, GenericDatasourceQueryCtrl);
  55. var _this = _possibleConstructorReturn(this, (GenericDatasourceQueryCtrl.__proto__ || Object.getPrototypeOf(GenericDatasourceQueryCtrl)).call(this, $scope, $injector));
  56. _this.scope = $scope;
  57. _this.target.target = _this.target.target || 'select metric';
  58. _this.target.type = _this.target.type || 'timeserie';
  59. return _this;
  60. }
  61. _createClass(GenericDatasourceQueryCtrl, [{
  62. key: 'getOptions',
  63. value: function getOptions(query) {
  64. return this.datasource.metricFindQuery(query || '');
  65. }
  66. }, {
  67. key: 'toggleEditorMode',
  68. value: function toggleEditorMode() {
  69. this.target.rawQuery = !this.target.rawQuery;
  70. }
  71. }, {
  72. key: 'onChangeInternal',
  73. value: function onChangeInternal() {
  74. this.panelCtrl.refresh(); // Asks the panel to refresh data.
  75. }
  76. }]);
  77. return GenericDatasourceQueryCtrl;
  78. }(QueryCtrl));
  79. _export('GenericDatasourceQueryCtrl', GenericDatasourceQueryCtrl);
  80. GenericDatasourceQueryCtrl.templateUrl = 'partials/query.editor.html';
  81. }
  82. };
  83. });
  84. //# sourceMappingURL=query_ctrl.js.map