diff --git a/public/app/features/templating/DefaultTemplateQueryComponent.tsx b/public/app/features/templating/DefaultTemplateQueryComponent.tsx index 6d470e8d538..26c5db54d7c 100644 --- a/public/app/features/templating/DefaultTemplateQueryComponent.tsx +++ b/public/app/features/templating/DefaultTemplateQueryComponent.tsx @@ -14,7 +14,7 @@ export default class DefaultTemplateQueryComponent extends PureComponent { - $scope.current.query = value; + $scope.onQueryChange = (query, definition) => { + $scope.current.query = query; + $scope.current.definition = definition; $scope.runQuery(); }; diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index d6aabd37225..58a12ba872e 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -53,7 +53,7 @@ - {{variable.query}} + {{variable.definition ? variable.definition : variable.query}} diff --git a/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx b/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx index 8c8c89f9197..7b59d50a0fb 100644 --- a/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx +++ b/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx @@ -96,7 +96,8 @@ export class StackdriverTemplateQueryComponent extends PureComponent q.value === this.state.selectedQueryType); + this.props.onChange(queryModel, `Stackdriver - ${queryName.name}`); } isLabelQuery(queryType) { diff --git a/public/app/types/plugins.ts b/public/app/types/plugins.ts index eb8ff5dcaf2..f365e254736 100644 --- a/public/app/types/plugins.ts +++ b/public/app/types/plugins.ts @@ -102,7 +102,7 @@ export interface PluginsState { export interface TemplateQueryProps { query: any; - onChange: (c: any) => void; + onChange: (c: any, definition: string) => void; datasource: any; - // datasource: StackdriverDatasource; + definition: string; }