mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
prometheus: minor update to focus editor PR, #9201
This commit is contained in:
parent
4b851de648
commit
2953d64429
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user