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
849ac944
Commit
849ac944
authored
Nov 03, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed multi-value nested templating for opentsdb
parent
c138b04c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletions
+20
-1
public/app/features/templating/specs/template_srv_specs.ts
+5
-0
public/app/features/templating/templateSrv.js
+14
-0
public/app/plugins/datasource/opentsdb/datasource.js
+1
-1
No files found.
public/app/features/templating/specs/template_srv_specs.ts
View file @
849ac944
...
...
@@ -145,6 +145,11 @@ describe('templateSrv', function() {
expect
(
result
).
to
.
be
(
'test|test2'
);
});
it
(
'multi value and distributed should render distributed string'
,
function
()
{
var
result
=
_templateSrv
.
formatValue
([
'test'
,
'test2'
],
'distributed'
,
{
name
:
'build'
});
expect
(
result
).
to
.
be
(
'test,build=test2'
);
});
it
(
'slash should be properly escaped in regex format'
,
function
()
{
var
result
=
_templateSrv
.
formatValue
(
'Gi3/14'
,
'regex'
);
expect
(
result
).
to
.
be
(
'Gi3
\\
/14'
);
...
...
public/app/features/templating/templateSrv.js
View file @
849ac944
...
...
@@ -95,6 +95,9 @@ function (angular, _, kbn) {
}
return
value
.
join
(
'|'
);
}
case
"distributed"
:
{
return
this
.
distributeVariable
(
value
,
variable
.
name
);
}
default
:
{
if
(
typeof
value
===
'string'
)
{
return
value
;
...
...
@@ -210,6 +213,17 @@ function (angular, _, kbn) {
});
};
this
.
distributeVariable
=
function
(
value
,
variable
)
{
value
=
_
.
map
(
value
,
function
(
val
,
index
)
{
if
(
index
!==
0
)
{
return
variable
+
"="
+
val
;
}
else
{
return
val
;
}
});
return
value
.
join
(
','
);
};
});
});
public/app/plugins/datasource/opentsdb/datasource.js
View file @
849ac944
...
...
@@ -244,7 +244,7 @@ function (angular, _, dateMath) {
var
interpolated
;
try
{
interpolated
=
templateSrv
.
replace
(
query
);
interpolated
=
templateSrv
.
replace
(
query
,
{},
"distributed"
);
}
catch
(
err
)
{
return
$q
.
reject
(
err
);
...
...
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