27 lines
758 B
JavaScript
27 lines
758 B
JavaScript
import {QueryCtrl} from 'app/plugins/sdk';
|
|
import './css/query-editor.css!'
|
|
|
|
export class GenericDatasourceQueryCtrl extends QueryCtrl {
|
|
|
|
constructor($scope, $injector, uiSegmentSrv) {
|
|
super($scope, $injector);
|
|
|
|
this.scope = $scope;
|
|
this.uiSegmentSrv = uiSegmentSrv;
|
|
this.target.target = this.target.target || 'select metric';
|
|
}
|
|
|
|
getOptions() {
|
|
return this.datasource.metricFindQuery(this.target)
|
|
.then(this.uiSegmentSrv.transformToSegments(false));
|
|
// Options have to be transformed by uiSegmentSrv to be usable by metric-segment-model directive
|
|
}
|
|
|
|
onChangeInternal() {
|
|
this.panelCtrl.refresh(); // Asks the panel to refresh data.
|
|
}
|
|
}
|
|
|
|
GenericDatasourceQueryCtrl.templateUrl = 'partials/query.editor.html';
|
|
|