Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ecaee88e
Commit
ecaee88e
authored
Nov 23, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort Prometheus range suggestions by length
- add sortText property to range completion items
parent
56d95e79
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
public/app/plugins/datasource/prometheus/language_provider.ts
+3
-3
public/app/plugins/datasource/prometheus/promql.ts
+12
-1
No files found.
public/app/plugins/datasource/prometheus/language_provider.ts
View file @
ecaee88e
...
@@ -9,8 +9,8 @@ import {
...
@@ -9,8 +9,8 @@ import {
TypeaheadOutput
,
TypeaheadOutput
,
}
from
'app/types/explore'
;
}
from
'app/types/explore'
;
import
{
parseSelector
,
processLabels
,
RATE_RANGES
}
from
'./language_utils'
;
import
{
parseSelector
,
processLabels
}
from
'./language_utils'
;
import
PromqlSyntax
,
{
FUNCTIONS
}
from
'./promql'
;
import
PromqlSyntax
,
{
FUNCTIONS
,
RATE_RANGES
}
from
'./promql'
;
const
DEFAULT_KEYS
=
[
'job'
,
'instance'
];
const
DEFAULT_KEYS
=
[
'job'
,
'instance'
];
const
EMPTY_SELECTOR
=
'{}'
;
const
EMPTY_SELECTOR
=
'{}'
;
...
@@ -171,7 +171,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
...
@@ -171,7 +171,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
suggestions
:
[
suggestions
:
[
{
{
label
:
'Range vector'
,
label
:
'Range vector'
,
items
:
[...
RATE_RANGES
]
.
map
(
wrapLabel
)
,
items
:
[...
RATE_RANGES
],
},
},
],
],
};
};
...
...
public/app/plugins/datasource/prometheus/promql.ts
View file @
ecaee88e
/* tslint:disable max-line-length */
/* 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'
];
export
const
OPERATORS
=
[
'by'
,
'group_left'
,
'group_right'
,
'ignoring'
,
'on'
,
'offset'
,
'without'
];
const
AGGREGATION_OPERATORS
=
[
const
AGGREGATION_OPERATORS
:
CompletionItem
[]
=
[
{
{
label
:
'sum'
,
label
:
'sum'
,
insertText
:
'sum'
,
insertText
:
'sum'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment