grafana/public/app/features/panel/query_ctrl.ts
kay delaney bad048b7ba
Performance: Standardize lodash imports to use destructured members (#33040)
* Performance: Standardize lodash imports to use destructured members
Changes lodash imports of the form `import x from 'lodash/x'` to
`import { x } from 'lodash'` to reduce bundle size.

* Remove unnecessary _ import from Graph component

* Enforce lodash import style

* Fix remaining lodash imports
2021-04-21 09:38:00 +02:00

25 lines
717 B
TypeScript

import { indexOf } from 'lodash';
import { auto } from 'angular';
export class QueryCtrl {
target!: any;
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();
}
}