Commit 2953d644 by Torkel Ödegaard

prometheus: minor update to focus editor PR, #9201

parent 4b851de6
......@@ -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: "&"
},
......
......@@ -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() {
......
......@@ -2,7 +2,7 @@
<div class="gf-form-inline">
<div class="gf-form gf-form--grow">
<code-editor content="ctrl.target.expr" on-change="ctrl.refreshMetricData()"
get-completer="ctrl.getCompleter()" data-mode="prometheus" focus="ctrl.target.refId == 'A'">
get-completer="ctrl.getCompleter()" data-mode="prometheus" code-editor-focus="ctrl.isLastQuery">
</code-editor>
</div>
</div>
......
......@@ -77,3 +77,7 @@ $doc-font-size: $font-size-sm;
.ace_tooltip {
border-radius: 3px;
}
.ace_hidden-cursors .ace_cursor {
opacity: 0 !important;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment