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
d46f33c3
Unverified
Commit
d46f33c3
authored
Sep 22, 2020
by
Ryan McKinley
Committed by
GitHub
Sep 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotations: check for null or undefined fields before conversion (#27712)
parent
f6c91d13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
public/app/features/annotations/standardAnnotationSupport.test.ts
+9
-3
public/app/features/annotations/standardAnnotationSupport.ts
+2
-2
No files found.
public/app/features/annotations/standardAnnotationSupport.test.ts
View file @
d46f33c3
...
@@ -5,9 +5,9 @@ describe('DataFrame to annotations', () => {
...
@@ -5,9 +5,9 @@ describe('DataFrame to annotations', () => {
test
(
'simple conversion'
,
()
=>
{
test
(
'simple conversion'
,
()
=>
{
const
frame
=
toDataFrame
({
const
frame
=
toDataFrame
({
fields
:
[
fields
:
[
{
type
:
FieldType
.
time
,
values
:
[
1
,
2
,
3
]
},
{
type
:
FieldType
.
time
,
values
:
[
1
,
2
,
3
,
4
,
5
]
},
{
name
:
'first string field'
,
values
:
[
't1'
,
't2'
,
't3'
]
},
{
name
:
'first string field'
,
values
:
[
't1'
,
't2'
,
't3'
,
null
,
undefined
]
},
{
name
:
'tags'
,
values
:
[
'aaa,bbb'
,
'bbb,ccc'
,
'zyz'
]
},
{
name
:
'tags'
,
values
:
[
'aaa,bbb'
,
'bbb,ccc'
,
'zyz'
,
null
,
undefined
]
},
],
],
});
});
...
@@ -37,6 +37,12 @@ describe('DataFrame to annotations', () => {
...
@@ -37,6 +37,12 @@ describe('DataFrame to annotations', () => {
"text": "t3",
"text": "t3",
"time": 3,
"time": 3,
},
},
Object {
"time": 4,
},
Object {
"time": 5,
},
]
]
`
);
`
);
});
});
...
...
public/app/features/annotations/standardAnnotationSupport.ts
View file @
d46f33c3
...
@@ -175,8 +175,8 @@ export function getAnnotationsFromData(data: DataFrame[], options?: AnnotationEv
...
@@ -175,8 +175,8 @@ export function getAnnotationsFromData(data: DataFrame[], options?: AnnotationEv
}
}
}
}
if
(
v
!==
undefined
)
{
if
(
!
(
v
===
null
||
v
===
undefined
)
)
{
if
(
f
.
split
)
{
if
(
v
&&
f
.
split
)
{
v
=
(
v
as
string
).
split
(
','
);
v
=
(
v
as
string
).
split
(
','
);
}
}
(
anno
as
any
)[
f
.
key
]
=
v
;
(
anno
as
any
)[
f
.
key
]
=
v
;
...
...
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