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
4260cd54
Commit
4260cd54
authored
Nov 13, 2019
by
Šimon Podlipský
Committed by
Dominik Prokop
Nov 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataFrame processing: Require table rows to be array (#20357)
parent
17fe704a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
packages/grafana-data/src/dataframe/processDataFrame.test.ts
+9
-0
packages/grafana-data/src/dataframe/processDataFrame.ts
+5
-3
No files found.
packages/grafana-data/src/dataframe/processDataFrame.test.ts
View file @
4260cd54
...
...
@@ -59,6 +59,15 @@ describe('toDataFrame', () => {
expect
(
again
).
toBe
(
input
);
});
it
(
'throws when table rows is not array'
,
()
=>
{
expect
(()
=>
toDataFrame
({
columns
:
[],
rows
:
{},
})
).
toThrowError
(
'Expected table rows to be array, got object.'
);
});
it
(
'migrate from 6.3 style rows'
,
()
=>
{
const
oldDataFrame
=
{
fields
:
[{
name
:
'A'
},
{
name
:
'B'
},
{
name
:
'C'
}],
...
...
packages/grafana-data/src/dataframe/processDataFrame.ts
View file @
4260cd54
// Libraries
import
isNumber
from
'lodash/isNumber'
;
import
isString
from
'lodash/isString'
;
import
isBoolean
from
'lodash/isBoolean'
;
import
{
isArray
,
isBoolean
,
isNumber
,
isString
}
from
'lodash'
;
// Types
import
{
...
...
@@ -34,6 +32,10 @@ function convertTableToDataFrame(table: TableData): DataFrame {
};
});
if
(
!
isArray
(
table
.
rows
))
{
throw
new
Error
(
`Expected table rows to be array, got
${
typeof
table
.
rows
}
.`
);
}
for
(
const
row
of
table
.
rows
)
{
for
(
let
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
fields
[
i
].
values
.
buffer
.
push
(
row
[
i
]);
...
...
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