2018-09-07 23:18:15 +08:00
|
|
|
import _ from 'lodash';
|
2018-09-04 19:21:02 +08:00
|
|
|
import { QueryCtrl } from 'app/plugins/sdk';
|
2018-09-27 20:22:20 +08:00
|
|
|
import './query_filter_ctrl';
|
2018-12-18 18:25:13 +08:00
|
|
|
import { StackdriverPicker } from './components/StackdriverPicker';
|
2018-12-11 20:14:55 +08:00
|
|
|
import { react2AngularDirective } from 'app/core/utils/react2angular';
|
2018-12-13 23:40:14 +08:00
|
|
|
import { registerAngularDirectives } from './angular_wrappers';
|
2018-12-22 06:07:46 +08:00
|
|
|
import { Target } from './types';
|
2018-09-14 07:49:39 +08:00
|
|
|
|
2018-09-04 19:21:02 +08:00
|
|
|
export class StackdriverQueryCtrl extends QueryCtrl {
|
|
|
|
|
static templateUrl = 'partials/query.editor.html';
|
2018-12-13 23:40:14 +08:00
|
|
|
uiSegmentSrv: any;
|
2018-09-12 04:41:24 +08:00
|
|
|
|
2018-09-04 19:21:02 +08:00
|
|
|
/** @ngInject */
|
2018-12-22 06:21:55 +08:00
|
|
|
constructor($scope, $injector, uiSegmentSrv) {
|
2018-09-04 19:21:02 +08:00
|
|
|
super($scope, $injector);
|
2018-12-13 23:40:14 +08:00
|
|
|
this.uiSegmentSrv = uiSegmentSrv;
|
2018-12-18 18:31:11 +08:00
|
|
|
react2AngularDirective('stackdriverPicker', StackdriverPicker, [
|
2018-12-11 20:14:55 +08:00
|
|
|
'options',
|
|
|
|
|
'onChange',
|
|
|
|
|
'selected',
|
2018-12-12 03:12:33 +08:00
|
|
|
'searchable',
|
|
|
|
|
'className',
|
|
|
|
|
'placeholder',
|
2018-12-18 23:01:12 +08:00
|
|
|
'groupName',
|
|
|
|
|
['templateVariables', { watchDepth: 'reference' }],
|
2018-12-12 03:12:33 +08:00
|
|
|
]);
|
2018-12-13 23:40:14 +08:00
|
|
|
registerAngularDirectives();
|
2018-12-22 06:07:46 +08:00
|
|
|
this.handleQueryChange = this.handleQueryChange.bind(this);
|
|
|
|
|
this.handleExecuteQuery = this.handleExecuteQuery.bind(this);
|
2018-12-13 07:16:48 +08:00
|
|
|
}
|
|
|
|
|
|
2018-12-19 21:19:27 +08:00
|
|
|
handleQueryChange(target: Target) {
|
|
|
|
|
Object.assign(this.target, target);
|
2018-12-13 07:16:48 +08:00
|
|
|
}
|
|
|
|
|
|
2018-12-19 21:19:27 +08:00
|
|
|
handleExecuteQuery() {
|
|
|
|
|
this.$scope.ctrl.refresh();
|
2018-09-13 17:02:31 +08:00
|
|
|
}
|
2018-09-04 19:21:02 +08:00
|
|
|
}
|