grafana/public/app/angular/panel/query_ctrl.ts
Josh Hunt 3c6e0e8ef8
Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01:00

25 lines
724 B
TypeScript

import { auto } from 'angular';
import { indexOf } from 'lodash';
export class QueryCtrl<T = any> {
target!: T;
datasource!: any;
panelCtrl!: any;
panel: any;
hasRawMode!: boolean;
error?: string | null;
isLastQuery: boolean;
constructor(public $scope: any, public $injector: auto.IInjectorService) {
this.panelCtrl = this.panelCtrl ?? $scope.ctrl.panelCtrl;
this.target = this.target ?? $scope.ctrl.target;
this.datasource = this.datasource ?? $scope.ctrl.datasource;
this.panel = this.panelCtrl?.panel ?? $scope.ctrl.panelCtrl.panel;
this.isLastQuery = indexOf(this.panel.targets, this.target) === this.panel.targets.length - 1;
}
refresh() {
this.panelCtrl.refresh();
}
}