Commit ecaee88e by David Kaltschmidt

Sort Prometheus range suggestions by length

- add sortText property to range completion items
parent 56d95e79
......@@ -9,8 +9,8 @@ import {
TypeaheadOutput,
} from 'app/types/explore';
import { parseSelector, processLabels, RATE_RANGES } from './language_utils';
import PromqlSyntax, { FUNCTIONS } from './promql';
import { parseSelector, processLabels } from './language_utils';
import PromqlSyntax, { FUNCTIONS, RATE_RANGES } from './promql';
const DEFAULT_KEYS = ['job', 'instance'];
const EMPTY_SELECTOR = '{}';
......@@ -171,7 +171,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
suggestions: [
{
label: 'Range vector',
items: [...RATE_RANGES].map(wrapLabel),
items: [...RATE_RANGES],
},
],
};
......
/* tslint:disable max-line-length */
import { CompletionItem } from 'app/types/explore';
export const RATE_RANGES: CompletionItem[] = [
{ label: '1m', sortText: '00:01:00' },
{ label: '5m', sortText: '00:05:00' },
{ label: '10m', sortText: '00:10:00' },
{ label: '30m', sortText: '00:30:00' },
{ label: '1h', sortText: '01:00:00' },
{ label: '1d', sortText: '24:00:00' },
];
export const OPERATORS = ['by', 'group_left', 'group_right', 'ignoring', 'on', 'offset', 'without'];
const AGGREGATION_OPERATORS = [
const AGGREGATION_OPERATORS: CompletionItem[] = [
{
label: 'sum',
insertText: 'sum',
......
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