mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
Tempo: Map the status tag to status.code for autocomplete (#54593)
This commit is contained in:
parent
3cf8e9c72e
commit
21dd60ba60
@ -72,6 +72,15 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
|
|||||||
tags.forEach((t) => (this.tags[t] = new Set<string>()));
|
tags.forEach((t) => (this.tags[t] = new Set<string>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private overrideTagName(tagName: string): string {
|
||||||
|
switch (tagName) {
|
||||||
|
case 'status':
|
||||||
|
return 'status.code';
|
||||||
|
default:
|
||||||
|
return tagName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get suggestion based on the situation we are in like whether we should suggest tag names or values.
|
* Get suggestion based on the situation we are in like whether we should suggest tag names or values.
|
||||||
* @param situation
|
* @param situation
|
||||||
@ -104,7 +113,8 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
|
|||||||
type: 'OPERATOR' as CompletionType,
|
type: 'OPERATOR' as CompletionType,
|
||||||
}));
|
}));
|
||||||
case 'SPANSET_IN_VALUE':
|
case 'SPANSET_IN_VALUE':
|
||||||
return await this.languageProvider.getOptions(situation.tagName).then((res) => {
|
const tagName = this.overrideTagName(situation.tagName);
|
||||||
|
return await this.languageProvider.getOptions(tagName).then((res) => {
|
||||||
const items: Completion[] = [];
|
const items: Completion[] = [];
|
||||||
res.forEach((val) => {
|
res.forEach((val) => {
|
||||||
if (val?.label) {
|
if (val?.label) {
|
||||||
|
Loading…
Reference in New Issue
Block a user