query_editor.ts 737 B

12345678910111213141516171819202122232425
  1. ///<reference path="../../headers/common.d.ts" />
  2. import angular from 'angular';
  3. import _ from 'lodash';
  4. var directivesModule = angular.module('grafana.directives');
  5. /** @ngInject */
  6. function metricsQueryOptions(dynamicDirectiveSrv, datasourceSrv) {
  7. return dynamicDirectiveSrv.create({
  8. watchPath: "ctrl.panel.datasource",
  9. directive: scope => {
  10. return datasourceSrv.get(scope.ctrl.panel.datasource).then(ds => {
  11. return System.import(ds.meta.module).then(dsModule => {
  12. return {
  13. name: 'metrics-query-options-' + ds.meta.id,
  14. fn: dsModule.metricsQueryOptions
  15. };
  16. });
  17. });
  18. }
  19. });
  20. }
  21. directivesModule.directive('metricsQueryOptions', metricsQueryOptions);