From dc7f98de6af5330105c4dae37e88166aefd7a2cd Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 8 Jan 2019 13:37:08 +0100 Subject: [PATCH] use correct event handler name convention. register directive on startup --- public/app/core/angular_wrappers.ts | 8 ++++++++ .../stackdriver/annotations_query_ctrl.ts | 4 ++-- .../stackdriver/components/Aggregations.tsx | 4 ++-- .../stackdriver/components/AliasBy.tsx | 15 +++++++-------- .../components/AnnotationQueryEditor.tsx | 12 ++++++------ .../datasource/stackdriver/components/Help.tsx | 8 ++++---- .../stackdriver/components/Metrics.tsx | 10 +++++----- .../stackdriver/components/QueryEditor.tsx | 18 +++++++++--------- .../components/VariableQueryEditor.tsx | 4 ++-- .../partials/annotations.editor.html | 2 +- .../stackdriver/partials/query.editor.html | 6 +++--- .../datasource/stackdriver/query_ctrl.ts | 18 ++++-------------- 12 files changed, 53 insertions(+), 56 deletions(-) diff --git a/public/app/core/angular_wrappers.ts b/public/app/core/angular_wrappers.ts index 7a2703b76e7..92f5d663656 100644 --- a/public/app/core/angular_wrappers.ts +++ b/public/app/core/angular_wrappers.ts @@ -1,4 +1,5 @@ import { react2AngularDirective } from 'app/core/utils/react2angular'; +import { QueryEditor } from 'app/plugins/datasource/stackdriver/components/QueryEditor'; import { PasswordStrength } from './components/PasswordStrength'; import PageHeader from './components/PageHeader/PageHeader'; import EmptyListCTA from './components/EmptyListCTA/EmptyListCTA'; @@ -29,4 +30,11 @@ export function registerAngularDirectives() { 'placeholder', ['variables', { watchDepth: 'reference' }], ]); + react2AngularDirective('queryEditor', QueryEditor, [ + 'target', + 'onQueryChange', + 'onExecuteQuery', + ['events', { watchDepth: 'reference' }], + ['datasource', { watchDepth: 'reference' }], + ]); } diff --git a/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts b/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts index 4df035719a0..26a09e3d1fa 100644 --- a/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts +++ b/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts @@ -7,7 +7,7 @@ export class StackdriverAnnotationsQueryCtrl { constructor() { this.annotation.target = this.annotation.target || {}; - this.handleQueryChange = this.handleQueryChange.bind(this); + this.onQueryChange = this.onQueryChange.bind(this); react2AngularDirective('annotationQueryEditor', AnnotationQueryEditor, [ 'target', @@ -17,7 +17,7 @@ export class StackdriverAnnotationsQueryCtrl { ]); } - handleQueryChange(target) { + onQueryChange(target) { Object.assign(this.annotation.target, target); } } diff --git a/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx b/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx index 81da7aa128c..7ae0e506a0b 100644 --- a/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx +++ b/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx @@ -52,7 +52,7 @@ export class Aggregations extends React.Component { this.setState({ aggOptions }); } - handleToggleDisplayAdvanced() { + onToggleDisplayAdvanced() { this.setState(state => ({ displayAdvancedOptions: !state.displayAdvancedOptions, })); @@ -78,7 +78,7 @@ export class Aggregations extends React.Component {