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
56136a53
Unverified
Commit
56136a53
authored
Feb 18, 2019
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix native annotation filtered by template variable with pipe
parent
3d994b16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
public/app/plugins/datasource/grafana/datasource.ts
+9
-2
public/app/plugins/datasource/grafana/specs/datasource.test.ts
+1
-1
No files found.
public/app/plugins/datasource/grafana/datasource.ts
View file @
56136a53
...
...
@@ -57,10 +57,17 @@ class GrafanaDatasource {
if
(
!
_
.
isArray
(
options
.
annotation
.
tags
)
||
options
.
annotation
.
tags
.
length
===
0
)
{
return
this
.
$q
.
when
([]);
}
const
delimiter
=
'__delimiter__'
;
const
tags
=
[];
for
(
const
t
of
params
.
tags
)
{
const
renderedValues
=
this
.
templateSrv
.
replace
(
t
,
{},
'pipe'
);
for
(
const
tt
of
renderedValues
.
split
(
'|'
))
{
const
renderedValues
=
this
.
templateSrv
.
replace
(
t
,
{},
value
=>
{
if
(
typeof
value
===
'string'
)
{
return
value
;
}
return
value
.
join
(
delimiter
);
});
for
(
const
tt
of
renderedValues
.
split
(
delimiter
))
{
tags
.
push
(
tt
);
}
}
...
...
public/app/plugins/datasource/grafana/specs/datasource.test.ts
View file @
56136a53
...
...
@@ -14,7 +14,7 @@ describe('grafana data source', () => {
const
templateSrvStub
=
{
replace
:
val
=>
{
return
val
.
replace
(
'$var2'
,
'replaced
|
replaced2'
).
replace
(
'$var'
,
'replaced'
);
return
val
.
replace
(
'$var2'
,
'replaced
__delimiter__
replaced2'
).
replace
(
'$var'
,
'replaced'
);
},
};
...
...
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