2016-01-14 07:37:04 -06:00
|
|
|
///<reference path="../../headers/common.d.ts" />
|
|
|
|
|
|
|
|
import angular from 'angular';
|
2016-02-01 05:42:10 -06:00
|
|
|
import _ from 'lodash';
|
|
|
|
|
|
|
|
var directivesModule = angular.module('grafana.directives');
|
|
|
|
|
2016-01-14 07:37:04 -06:00
|
|
|
/** @ngInject */
|
|
|
|
function metricsQueryOptions(dynamicDirectiveSrv, datasourceSrv) {
|
|
|
|
return dynamicDirectiveSrv.create({
|
2016-01-25 14:09:37 -06:00
|
|
|
watchPath: "ctrl.panel.datasource",
|
2016-01-14 07:37:04 -06:00
|
|
|
directive: scope => {
|
2016-01-25 14:09:37 -06:00
|
|
|
return datasourceSrv.get(scope.ctrl.panel.datasource).then(ds => {
|
2016-01-14 07:37:04 -06:00
|
|
|
return System.import(ds.meta.module).then(dsModule => {
|
|
|
|
return {
|
|
|
|
name: 'metrics-query-options-' + ds.meta.id,
|
|
|
|
fn: dsModule.metricsQueryOptions
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-02-01 05:42:10 -06:00
|
|
|
directivesModule.directive('metricsQueryOptions', metricsQueryOptions);
|