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
244cbe8c
Commit
244cbe8c
authored
Mar 07, 2018
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add csv templating format
parent
310d7406
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
public/app/features/templating/specs/template_srv.jest.ts
+5
-1
public/app/features/templating/template_srv.ts
+6
-0
No files found.
public/app/features/templating/specs/template_srv.jest.ts
View file @
244cbe8c
...
...
@@ -107,7 +107,6 @@ describe('templateSrv', function() {
]);
});
it
(
'should replace $test with globbed value'
,
function
()
{
var
target
=
_templateSrv
.
replace
(
'this.$test.filters'
,
{},
'glob'
);
expect
(
target
).
toBe
(
'this.{value1,value2}.filters'
);
...
...
@@ -261,6 +260,11 @@ describe('templateSrv', function() {
expect
(
result
).
toBe
(
'test'
);
});
it
(
'multi value and csv format should render csv string'
,
function
()
{
var
result
=
_templateSrv
.
formatValue
([
'test'
,
'test2'
],
'csv'
);
expect
(
result
).
toBe
(
'test,test2'
);
});
it
(
'slash should be properly escaped in regex format'
,
function
()
{
var
result
=
_templateSrv
.
formatValue
(
'Gi3/14'
,
'regex'
);
expect
(
result
).
toBe
(
'Gi3
\\
/14'
);
...
...
public/app/features/templating/template_srv.ts
View file @
244cbe8c
...
...
@@ -115,6 +115,12 @@ export class TemplateSrv {
}
return
this
.
distributeVariable
(
value
,
variable
.
name
);
}
case
'csv'
:
{
if
(
_
.
isArray
(
value
))
{
return
value
.
join
(
','
);
}
return
value
;
}
default
:
{
if
(
_
.
isArray
(
value
))
{
return
'{'
+
value
.
join
(
','
)
+
'}'
;
...
...
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