grafana/public/app/angular/panel/query_editor_row.ts
Jack Westbrook 3a7623753b
Build: Replace babel-loader with esbuild-loader (#57837)
* build(webpack): replace babel-loader with esbuild-loader

* build(webpack): add esbuild minifier to production builds

* Wip

* Removed ngInject and replaced with manual inject params

* chore: bump esbuild to 0.15.13

* Fixed angular issues

* build(frontend): update esbuild to 0.16.16

* chore(webpack): support browserslist for esbuild

* build(esbuild): unify versions of esbuild to 0.16.17 and esbuild-loader to 2.21.0

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2023-01-23 12:15:05 +01:00

44 lines
1.1 KiB
TypeScript

import { coreModule } from 'app/angular/core_module';
export class QueryRowCtrl {
target: any;
queryCtrl: any;
panelCtrl: any;
panel: any;
hasTextEditMode = false;
$onInit() {
this.panelCtrl = this.queryCtrl.panelCtrl;
this.target = this.queryCtrl.target;
this.panel = this.panelCtrl.panel;
if (this.hasTextEditMode && this.queryCtrl.toggleEditorMode) {
// expose this function to react parent component
this.panelCtrl.toggleEditorMode = this.queryCtrl.toggleEditorMode.bind(this.queryCtrl);
}
if (this.queryCtrl.getCollapsedText) {
// expose this function to react parent component
this.panelCtrl.getCollapsedText = this.queryCtrl.getCollapsedText.bind(this.queryCtrl);
}
}
}
coreModule.directive('queryEditorRow', queryEditorRowDirective);
function queryEditorRowDirective() {
return {
restrict: 'E',
controller: QueryRowCtrl,
bindToController: true,
controllerAs: 'ctrl',
templateUrl: 'public/app/angular/panel/partials/query_editor_row.html',
transclude: true,
scope: {
queryCtrl: '=',
canCollapse: '=',
hasTextEditMode: '=',
},
};
}