mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
Loki: Fix lookup for label key token (#19579)
This commit is contained in:
parent
dde059abaa
commit
5238faf6da
@ -225,14 +225,16 @@ const handleTypeahead = debounce(
|
|||||||
)
|
)
|
||||||
.toArray();
|
.toArray();
|
||||||
|
|
||||||
|
// Find the first label key to the left of the cursor
|
||||||
const labelKeyDec = decorations
|
const labelKeyDec = decorations
|
||||||
.filter(
|
.filter(decoration => {
|
||||||
decoration =>
|
return (
|
||||||
decoration.end.offset === myOffset &&
|
decoration.end.offset <= myOffset &&
|
||||||
decoration.type === TOKEN_MARK &&
|
decoration.type === TOKEN_MARK &&
|
||||||
decoration.data.get('className').includes('label-key')
|
decoration.data.get('className').includes('label-key')
|
||||||
)
|
);
|
||||||
.first();
|
})
|
||||||
|
.last();
|
||||||
|
|
||||||
const labelKey = labelKeyDec && value.focusText.text.slice(labelKeyDec.start.offset, labelKeyDec.end.offset);
|
const labelKey = labelKeyDec && value.focusText.text.slice(labelKeyDec.start.offset, labelKeyDec.end.offset);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user