2021-04-21 08:38:00 +01:00
|
|
|
import { indexOf } from 'lodash';
|
2019-07-18 08:03:04 +02:00
|
|
|
import { auto } from 'angular';
|
2016-02-01 12:42:10 +01:00
|
|
|
|
2016-02-02 12:52:43 +01:00
|
|
|
export class QueryCtrl {
|
2021-02-22 10:06:07 +01:00
|
|
|
target!: any;
|
|
|
|
|
datasource!: any;
|
|
|
|
|
panelCtrl!: any;
|
2016-02-02 09:12:58 +01:00
|
|
|
panel: any;
|
2021-02-22 10:06:07 +01:00
|
|
|
hasRawMode!: boolean;
|
2020-07-08 11:05:20 +02:00
|
|
|
error?: string | null;
|
2017-09-08 11:43:29 +02:00
|
|
|
isLastQuery: boolean;
|
2016-02-02 09:12:58 +01:00
|
|
|
|
2019-07-18 08:03:04 +02:00
|
|
|
constructor(public $scope: any, public $injector: auto.IInjectorService) {
|
2021-03-31 17:03:07 +02:00
|
|
|
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;
|
2021-04-21 08:38:00 +01:00
|
|
|
this.isLastQuery = indexOf(this.panel.targets, this.target) === this.panel.targets.length - 1;
|
2016-02-02 09:12:58 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-02 12:52:43 +01:00
|
|
|
refresh() {
|
|
|
|
|
this.panelCtrl.refresh();
|
|
|
|
|
}
|
2016-01-14 14:37:04 +01:00
|
|
|
}
|