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
a747d333
Commit
a747d333
authored
Feb 16, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
templating: allow whitespace values
closes #7382
parent
d7201158
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
public/app/features/templating/query_variable.ts
+8
-3
public/app/features/templating/specs/query_variable_specs.ts
+8
-5
No files found.
public/app/features/templating/query_variable.ts
View file @
a747d333
...
...
@@ -140,8 +140,13 @@ export class QueryVariable implements Variable {
}
for
(
i
=
0
;
i
<
metricNames
.
length
;
i
++
)
{
var
item
=
metricNames
[
i
];
var
value
=
item
.
value
||
item
.
text
;
var
text
=
item
.
text
||
item
.
value
;
var
text
=
item
.
text
===
undefined
||
item
.
text
===
null
?
item
.
value
:
item
.
text
;
var
value
=
item
.
value
===
undefined
||
item
.
value
===
null
?
item
.
text
:
item
.
value
;
if
(
_
.
isNumber
(
value
))
{
value
=
value
.
toString
();
...
...
@@ -178,7 +183,7 @@ export class QueryVariable implements Variable {
if
(
sortType
===
1
)
{
options
=
_
.
sortBy
(
options
,
'text'
);
}
else
if
(
sortType
===
2
)
{
options
=
_
.
sortBy
(
options
,
function
(
opt
)
{
options
=
_
.
sortBy
(
options
,
(
opt
)
=>
{
var
matches
=
opt
.
text
.
match
(
/.*
?(\d
+
)
.*/
);
if
(
!
matches
||
matches
.
length
<
2
)
{
return
-
1
;
...
...
public/app/features/templating/specs/query_variable_specs.ts
View file @
a747d333
...
...
@@ -51,20 +51,23 @@ describe('QueryVariable', () => {
var
input
=
[
{
text
:
'0'
,
value
:
'0'
},
{
text
:
'1'
,
value
:
'1'
},
{
text
:
''
,
value
:
''
},
{
text
:
null
,
value
:
3
},
{
text
:
undefined
,
value
:
4
},
{
text
:
'5'
,
value
:
null
},
{
text
:
'6'
,
value
:
undefined
},
{
text
:
null
,
value
:
'3'
},
{
text
:
undefined
,
value
:
'4'
},
{
text
:
5
,
value
:
null
},
{
text
:
6
,
value
:
undefined
},
{
text
:
null
,
value
:
'7'
},
{
text
:
undefined
,
value
:
'8'
},
{
text
:
9
,
value
:
null
},
{
text
:
10
,
value
:
undefined
},
{
text
:
''
,
value
:
undefined
},
{
text
:
undefined
,
value
:
''
},
];
var
result
=
variable
.
metricNamesToVariableValues
(
input
);
it
(
'should return in same order'
,
()
=>
{
var
i
=
0
;
expect
(
result
.
length
).
to
.
be
(
11
);
expect
(
result
[
i
++
].
text
).
to
.
be
(
''
);
expect
(
result
[
i
++
].
text
).
to
.
be
(
'0'
);
expect
(
result
[
i
++
].
text
).
to
.
be
(
'1'
);
...
...
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