2018-09-07 23:18:15 +08:00
|
|
|
import _ from 'lodash';
|
2019-01-02 22:35:36 +08:00
|
|
|
|
2018-09-04 19:21:02 +08:00
|
|
|
import { QueryCtrl } from 'app/plugins/sdk';
|
2019-01-02 22:35:36 +08:00
|
|
|
import { react2AngularDirective } from 'app/core/utils/react2angular';
|
|
|
|
|
|
|
|
|
|
import { QueryEditor } from './components/QueryEditor';
|
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-09-12 04:41:24 +08:00
|
|
|
|
2018-09-04 19:21:02 +08:00
|
|
|
/** @ngInject */
|
2018-12-22 06:28:21 +08:00
|
|
|
constructor($scope, $injector) {
|
2018-09-04 19:21:02 +08:00
|
|
|
super($scope, $injector);
|
2018-12-22 06:07:46 +08:00
|
|
|
this.handleQueryChange = this.handleQueryChange.bind(this);
|
|
|
|
|
this.handleExecuteQuery = this.handleExecuteQuery.bind(this);
|
2019-01-02 22:35:36 +08:00
|
|
|
react2AngularDirective('queryEditor', QueryEditor, [
|
|
|
|
|
'target',
|
|
|
|
|
'onQueryChange',
|
|
|
|
|
'onExecuteQuery',
|
|
|
|
|
['events', { watchDepth: 'reference' }],
|
|
|
|
|
['datasource', { watchDepth: 'reference' }],
|
|
|
|
|
]);
|
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
|
|
|
}
|