diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index 0ceb21d0335..7c41eb3b3a2 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -110,7 +110,8 @@ function link(scope, elem, attrs) { elem.addClass("gf-code-editor"); let textarea = elem.find("textarea"); textarea.addClass('gf-form-input'); - if (scope.focus) { + + if (scope.codeEditorFocus) { setTimeout(function () { textarea.focus(); var domEl = textarea[0]; @@ -118,7 +119,7 @@ function link(scope, elem, attrs) { var pos = textarea.val().length * 2; domEl.setSelectionRange(pos, pos); } - }, 200); + }, 100); } // Event handlers @@ -209,7 +210,7 @@ export function codeEditorDirective() { template: editorTemplate, scope: { content: "=", - focus: "=", + codeEditorFocus: "<", onChange: "&", getCompleter: "&" }, diff --git a/public/app/features/panel/query_ctrl.ts b/public/app/features/panel/query_ctrl.ts index 67f4f93d16c..148322360bc 100644 --- a/public/app/features/panel/query_ctrl.ts +++ b/public/app/features/panel/query_ctrl.ts @@ -10,9 +10,11 @@ export class QueryCtrl { panel: any; hasRawMode: boolean; error: string; + isLastQuery: boolean; constructor(public $scope, private $injector) { this.panel = this.panelCtrl.panel; + this.isLastQuery = _.indexOf(this.panel.targets, this.target) === (this.panel.targets.length - 1); } refresh() { diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index d35f9f9c14c..a34a752bd95 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -2,7 +2,7 @@