mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Basic PoC of the upcoming TraceQL editor in Explore (#54028)
* First working version of the TraceQL editor with syntax highlighting and autocomplete * Add feature flag around the new editor option * Fix tests and cleanup * Fix misspelling
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Value } from 'slate';
|
||||
|
||||
import { HistoryItem, LanguageProvider, SelectableValue } from '@grafana/data';
|
||||
import { LanguageProvider, SelectableValue } from '@grafana/data';
|
||||
import { CompletionItemGroup, TypeaheadInput, TypeaheadOutput } from '@grafana/ui';
|
||||
|
||||
import { TempoDatasource } from './datasource';
|
||||
@@ -21,8 +21,13 @@ export default class TempoLanguageProvider extends LanguageProvider {
|
||||
};
|
||||
|
||||
start = async () => {
|
||||
await this.fetchTags();
|
||||
return [];
|
||||
if (!this.startTask) {
|
||||
this.startTask = this.fetchTags().then(() => {
|
||||
return [];
|
||||
});
|
||||
}
|
||||
|
||||
return this.startTask;
|
||||
};
|
||||
|
||||
async fetchTags() {
|
||||
@@ -30,10 +35,11 @@ export default class TempoLanguageProvider extends LanguageProvider {
|
||||
this.tags = response.tagNames;
|
||||
}
|
||||
|
||||
provideCompletionItems = async (
|
||||
{ prefix, text, value, labelKey, wrapperClasses }: TypeaheadInput,
|
||||
context: { history: Array<HistoryItem<any>> } = { history: [] }
|
||||
): Promise<TypeaheadOutput> => {
|
||||
getTags = () => {
|
||||
return this.tags;
|
||||
};
|
||||
|
||||
provideCompletionItems = async ({ text, value }: TypeaheadInput): Promise<TypeaheadOutput> => {
|
||||
const emptyResult: TypeaheadOutput = { suggestions: [] };
|
||||
|
||||
if (!value) {
|
||||
|
||||
Reference in New Issue
Block a user