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
883d7cb5
Unverified
Commit
883d7cb5
authored
Sep 09, 2020
by
Hugo Häggmark
Committed by
GitHub
Sep 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OuterJoin: Fixes transformation when data is missing field to join by (#27453)
parent
023054bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletions
+59
-1
packages/grafana-data/src/transformations/transformers/seriesToColumns.test.ts
+58
-0
packages/grafana-data/src/transformations/transformers/seriesToColumns.ts
+1
-1
No files found.
packages/grafana-data/src/transformations/transformers/seriesToColumns.test.ts
View file @
883d7cb5
...
...
@@ -288,4 +288,62 @@ describe('SeriesToColumns Transformer', () => {
expect
(
filtered
.
fields
).
toEqual
(
expected
);
});
});
it
(
'joins if fields are missing'
,
()
=>
{
const
cfg
:
DataTransformerConfig
<
SeriesToColumnsOptions
>
=
{
id
:
DataTransformerID
.
seriesToColumns
,
options
:
{
byField
:
'time'
,
},
};
const
frame1
=
toDataFrame
({
name
:
'A'
,
fields
:
[
{
name
:
'time'
,
type
:
FieldType
.
time
,
values
:
[
1
,
2
,
3
]
},
{
name
:
'temperature'
,
type
:
FieldType
.
number
,
values
:
[
10
,
11
,
12
]
},
],
});
const
frame2
=
toDataFrame
({
name
:
'B'
,
fields
:
[],
});
const
frame3
=
toDataFrame
({
name
:
'C'
,
fields
:
[
{
name
:
'time'
,
type
:
FieldType
.
time
,
values
:
[
1
,
2
,
3
]
},
{
name
:
'temperature'
,
type
:
FieldType
.
number
,
values
:
[
20
,
22
,
24
]
},
],
});
const
filtered
=
transformDataFrame
([
cfg
],
[
frame1
,
frame2
,
frame3
])[
0
];
expect
(
filtered
.
fields
).
toEqual
([
{
name
:
'time'
,
state
:
{
displayName
:
'time'
},
type
:
FieldType
.
time
,
values
:
new
ArrayVector
([
1
,
2
,
3
]),
config
:
{},
},
{
name
:
'temperature'
,
state
:
{
displayName
:
'temperature A'
},
type
:
FieldType
.
number
,
values
:
new
ArrayVector
([
10
,
11
,
12
]),
config
:
{},
labels
:
{
name
:
'A'
},
},
{
name
:
'temperature'
,
state
:
{
displayName
:
'temperature C'
},
type
:
FieldType
.
number
,
values
:
new
ArrayVector
([
20
,
22
,
24
]),
config
:
{},
labels
:
{
name
:
'C'
},
},
]);
});
});
packages/grafana-data/src/transformations/transformers/seriesToColumns.ts
View file @
883d7cb5
...
...
@@ -26,7 +26,7 @@ export const seriesToColumnsTransformer: DataTransformerInfo<SeriesToColumnsOpti
const
keyField
=
findKeyField
(
frame
,
keyFieldMatch
);
if
(
!
keyField
)
{
return
data
;
continue
;
}
for
(
let
fieldIndex
=
0
;
fieldIndex
<
frame
.
fields
.
length
;
fieldIndex
++
)
{
...
...
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