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
95efd3e5
Unverified
Commit
95efd3e5
authored
Feb 04, 2021
by
Ryan McKinley
Committed by
GitHub
Feb 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chore: pad unknown values with undefined (#30808)
parent
11fa7c69
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
22 deletions
+32
-22
packages/grafana-data/src/dataframe/MutableDataFrame.test.ts
+4
-4
packages/grafana-data/src/dataframe/MutableDataFrame.ts
+1
-1
packages/grafana-data/src/transformations/transformers/merge.test.ts
+19
-9
packages/grafana-data/src/utils/__snapshots__/csv.test.ts.snap
+4
-4
packages/grafana-runtime/src/measurement/collector.test.ts
+4
-4
No files found.
packages/grafana-data/src/dataframe/MutableDataFrame.test.ts
View file @
95efd3e5
...
@@ -38,14 +38,14 @@ describe('Apending DataFrame', () => {
...
@@ -38,14 +38,14 @@ describe('Apending DataFrame', () => {
};
};
const
frame
=
new
MutableDataFrame
(
dto
);
const
frame
=
new
MutableDataFrame
(
dto
);
expect
(
frame
.
fields
[
0
].
values
.
toArray
()).
toEqual
([
100
,
null
,
null
]);
expect
(
frame
.
fields
[
0
].
values
.
toArray
()).
toEqual
([
100
,
undefined
,
undefined
]);
// Set a value on the second row
// Set a value on the second row
frame
.
set
(
1
,
{
time
:
200
,
name
:
'BB'
,
value
:
20
});
frame
.
set
(
1
,
{
time
:
200
,
name
:
'BB'
,
value
:
20
});
expect
(
frame
.
toArray
()).
toEqual
([
expect
(
frame
.
toArray
()).
toEqual
([
{
time
:
100
,
name
:
'a'
,
value
:
1
},
// 1
{
time
:
100
,
name
:
'a'
,
value
:
1
},
// 1
{
time
:
200
,
name
:
'BB'
,
value
:
20
},
// 2
{
time
:
200
,
name
:
'BB'
,
value
:
20
},
// 2
{
time
:
null
,
name
:
null
,
value
:
3
},
// 3
{
time
:
undefined
,
name
:
undefined
,
value
:
3
},
// 3
]);
]);
// Add a time value that has an array type
// Add a time value that has an array type
...
@@ -53,8 +53,8 @@ describe('Apending DataFrame', () => {
...
@@ -53,8 +53,8 @@ describe('Apending DataFrame', () => {
expect
(
frame
.
toArray
()).
toEqual
([
expect
(
frame
.
toArray
()).
toEqual
([
{
time
:
100
,
name
:
'a'
,
value
:
1
},
// 1
{
time
:
100
,
name
:
'a'
,
value
:
1
},
// 1
{
time
:
200
,
name
:
'BB'
,
value
:
20
},
// 2
{
time
:
200
,
name
:
'BB'
,
value
:
20
},
// 2
{
time
:
null
,
name
:
null
,
value
:
3
},
// 3
{
time
:
undefined
,
name
:
undefined
,
value
:
3
},
// 3
{
time
:
300
,
name
:
null
,
value
:
null
},
// 5
{
time
:
300
,
name
:
undefined
,
value
:
undefined
},
// 5
]);
]);
// Make sure length survives a spread operator
// Make sure length survives a spread operator
...
...
packages/grafana-data/src/dataframe/MutableDataFrame.ts
View file @
95efd3e5
...
@@ -11,7 +11,7 @@ export type MutableField<T = any> = Field<T, MutableVector<T>>;
...
@@ -11,7 +11,7 @@ export type MutableField<T = any> = Field<T, MutableVector<T>>;
type
MutableVectorCreator
=
(
buffer
?:
any
[])
=>
MutableVector
;
type
MutableVectorCreator
=
(
buffer
?:
any
[])
=>
MutableVector
;
export
const
MISSING_VALUE
:
any
=
null
;
export
const
MISSING_VALUE
:
any
=
undefined
;
// Treated as connected in new graph panel
export
class
MutableDataFrame
<
T
=
any
>
extends
FunctionalVector
<
T
>
implements
DataFrame
,
MutableVector
<
T
>
{
export
class
MutableDataFrame
<
T
=
any
>
extends
FunctionalVector
<
T
>
implements
DataFrame
,
MutableVector
<
T
>
{
name
?:
string
;
name
?:
string
;
...
...
packages/grafana-data/src/transformations/transformers/merge.test.ts
View file @
95efd3e5
...
@@ -140,7 +140,7 @@ describe('Merge multiple to single', () => {
...
@@ -140,7 +140,7 @@ describe('Merge multiple to single', () => {
const
expected
:
Field
[]
=
[
const
expected
:
Field
[]
=
[
createField
(
'Time'
,
FieldType
.
time
,
[
1000
,
1000
,
500
]),
createField
(
'Time'
,
FieldType
.
time
,
[
1000
,
1000
,
500
]),
createField
(
'Temp'
,
FieldType
.
number
,
[
1
,
-
1
,
2
]),
createField
(
'Temp'
,
FieldType
.
number
,
[
1
,
-
1
,
2
]),
createField
(
'Humidity'
,
FieldType
.
number
,
[
10
,
null
,
5
]),
createField
(
'Humidity'
,
FieldType
.
number
,
[
10
,
undefined
,
5
]),
];
];
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
...
@@ -179,7 +179,7 @@ describe('Merge multiple to single', () => {
...
@@ -179,7 +179,7 @@ describe('Merge multiple to single', () => {
const
expected
:
Field
[]
=
[
const
expected
:
Field
[]
=
[
createField
(
'Time'
,
FieldType
.
time
,
[
'2019-10-01T11:10:23Z'
,
'2019-09-01T11:10:23Z'
,
'2019-11-01T11:10:23Z'
]),
createField
(
'Time'
,
FieldType
.
time
,
[
'2019-10-01T11:10:23Z'
,
'2019-09-01T11:10:23Z'
,
'2019-11-01T11:10:23Z'
]),
createField
(
'Temp'
,
FieldType
.
number
,
[
1
,
-
1
,
2
]),
createField
(
'Temp'
,
FieldType
.
number
,
[
1
,
-
1
,
2
]),
createField
(
'Humidity'
,
FieldType
.
number
,
[
10
,
null
,
5
]),
createField
(
'Humidity'
,
FieldType
.
number
,
[
10
,
undefined
,
5
]),
];
];
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
...
@@ -222,7 +222,7 @@ describe('Merge multiple to single', () => {
...
@@ -222,7 +222,7 @@ describe('Merge multiple to single', () => {
'Germany'
,
'Germany'
,
'Canada'
,
'Canada'
,
'Canada'
,
'Canada'
,
null
,
undefined
,
]),
]),
createField
(
'AgeGroup'
,
FieldType
.
string
,
[
createField
(
'AgeGroup'
,
FieldType
.
string
,
[
'50 or over'
,
'50 or over'
,
...
@@ -233,7 +233,7 @@ describe('Merge multiple to single', () => {
...
@@ -233,7 +233,7 @@ describe('Merge multiple to single', () => {
'25 - 34'
,
'25 - 34'
,
'18 - 24'
,
'18 - 24'
,
]),
]),
createField
(
'Sum'
,
FieldType
.
number
,
[
998
,
1193
,
1675
,
146
,
166
,
219
,
null
]),
createField
(
'Sum'
,
FieldType
.
number
,
[
998
,
1193
,
1675
,
146
,
166
,
219
,
undefined
]),
createField
(
'Count'
,
FieldType
.
number
,
[
2
,
4
,
1
,
4
,
4
,
2
,
3
]),
createField
(
'Count'
,
FieldType
.
number
,
[
2
,
4
,
1
,
4
,
4
,
2
,
3
]),
];
];
...
@@ -284,17 +284,17 @@ describe('Merge multiple to single', () => {
...
@@ -284,17 +284,17 @@ describe('Merge multiple to single', () => {
'35 - 49'
,
'35 - 49'
,
'35 - 49'
,
'35 - 49'
,
]),
]),
createField
(
'Count'
,
FieldType
.
number
,
[
1
,
3
,
2
,
4
,
2
,
null
,
null
]),
createField
(
'Count'
,
FieldType
.
number
,
[
1
,
3
,
2
,
4
,
2
,
undefined
,
undefined
]),
createField
(
'Country'
,
FieldType
.
string
,
[
createField
(
'Country'
,
FieldType
.
string
,
[
'Mexico'
,
'Mexico'
,
null
,
undefined
,
'Canada'
,
'Canada'
,
'United States'
,
'United States'
,
'United States'
,
'United States'
,
'Germany'
,
'Germany'
,
'Canada'
,
'Canada'
,
]),
]),
createField
(
'Sum'
,
FieldType
.
number
,
[
1675
,
null
,
219
,
1193
,
998
,
146
,
166
]),
createField
(
'Sum'
,
FieldType
.
number
,
[
1675
,
undefined
,
219
,
1193
,
998
,
146
,
166
]),
];
];
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
...
@@ -334,8 +334,18 @@ describe('Merge multiple to single', () => {
...
@@ -334,8 +334,18 @@ describe('Merge multiple to single', () => {
const
expected
:
Field
[]
=
[
const
expected
:
Field
[]
=
[
createField
(
'Time'
,
FieldType
.
time
,
[
100
,
150
,
200
,
100
,
125
,
126
,
100
,
124
,
149
]),
createField
(
'Time'
,
FieldType
.
time
,
[
100
,
150
,
200
,
100
,
125
,
126
,
100
,
124
,
149
]),
createField
(
'Temp'
,
FieldType
.
number
,
[
1
,
4
,
5
,
-
1
,
2
,
3
,
1
,
4
,
5
]),
createField
(
'Temp'
,
FieldType
.
number
,
[
1
,
4
,
5
,
-
1
,
2
,
3
,
1
,
4
,
5
]),
createField
(
'Humidity'
,
FieldType
.
number
,
[
10
,
14
,
55
,
null
,
null
,
null
,
22
,
25
,
30
]),
createField
(
'Humidity'
,
FieldType
.
number
,
[
10
,
14
,
55
,
undefined
,
undefined
,
undefined
,
22
,
25
,
30
]),
createField
(
'Enabled'
,
FieldType
.
boolean
,
[
null
,
null
,
null
,
true
,
false
,
true
,
null
,
null
,
null
]),
createField
(
'Enabled'
,
FieldType
.
boolean
,
[
undefined
,
undefined
,
undefined
,
true
,
false
,
true
,
undefined
,
undefined
,
undefined
,
]),
];
];
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
expect
(
unwrap
(
result
[
0
].
fields
)).
toEqual
(
expected
);
...
...
packages/grafana-data/src/utils/__snapshots__/csv.test.ts.snap
View file @
95efd3e5
...
@@ -33,7 +33,7 @@ Object {
...
@@ -33,7 +33,7 @@ Object {
"name": "Field 3",
"name": "Field 3",
"type": "number",
"type": "number",
"values": Array [
"values": Array [
null
,
undefined
,
4,
4,
undefined,
undefined,
NaN,
NaN,
...
@@ -45,9 +45,9 @@ Object {
...
@@ -45,9 +45,9 @@ Object {
"name": "Field 4",
"name": "Field 4",
"type": "number",
"type": "number",
"values": Array [
"values": Array [
null
,
undefined
,
null
,
undefined
,
null
,
undefined
,
7,
7,
],
],
},
},
...
...
packages/grafana-runtime/src/measurement/collector.test.ts
View file @
95efd3e5
...
@@ -67,7 +67,7 @@ describe('MeasurementCollector', () => {
...
@@ -67,7 +67,7 @@ describe('MeasurementCollector', () => {
"type": "number",
"type": "number",
"values": Array [
"values": Array [
0,
0,
null
,
undefined
,
],
],
},
},
Object {
Object {
...
@@ -79,7 +79,7 @@ describe('MeasurementCollector', () => {
...
@@ -79,7 +79,7 @@ describe('MeasurementCollector', () => {
"type": "number",
"type": "number",
"values": Array [
"values": Array [
1,
1,
null
,
undefined
,
],
],
},
},
Object {
Object {
...
@@ -203,7 +203,7 @@ describe('MeasurementCollector', () => {
...
@@ -203,7 +203,7 @@ describe('MeasurementCollector', () => {
"name": "f0",
"name": "f0",
"type": "number",
"type": "number",
"values": Array [
"values": Array [
null
,
undefined
,
],
],
},
},
Object {
Object {
...
@@ -225,7 +225,7 @@ describe('MeasurementCollector', () => {
...
@@ -225,7 +225,7 @@ describe('MeasurementCollector', () => {
"name": "f2",
"name": "f2",
"type": "string",
"type": "string",
"values": Array [
"values": Array [
null
,
undefined
,
],
],
},
},
],
],
...
...
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