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
22fbaa7a
Unverified
Commit
22fbaa7a
authored
Oct 09, 2019
by
Torkel Ödegaard
Committed by
GitHub
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Singlestat: Fixed issue with mapping null to text (#19689)
parent
b858a5f4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
packages/grafana-data/src/transformations/fieldReducer.test.ts
+2
-2
packages/grafana-data/src/transformations/fieldReducer.ts
+8
-8
No files found.
packages/grafana-data/src/transformations/fieldReducer.test.ts
View file @
22fbaa7a
...
@@ -116,11 +116,11 @@ describe('Stats Calculators', () => {
...
@@ -116,11 +116,11 @@ describe('Stats Calculators', () => {
},
},
{
{
data
:
[
null
,
null
,
null
],
// All null
data
:
[
null
,
null
,
null
],
// All null
result
:
undefined
,
result
:
null
,
},
},
{
{
data
:
[
undefined
,
undefined
,
undefined
],
// Empty row
data
:
[
undefined
,
undefined
,
undefined
],
// Empty row
result
:
undefined
,
result
:
null
,
},
},
];
];
...
...
packages/grafana-data/src/transformations/fieldReducer.ts
View file @
22fbaa7a
...
@@ -236,8 +236,8 @@ function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero: boolean
...
@@ -236,8 +236,8 @@ function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero: boolean
mean
:
null
,
mean
:
null
,
last
:
null
,
last
:
null
,
first
:
null
,
first
:
null
,
lastNotNull
:
undefined
,
lastNotNull
:
null
,
firstNotNull
:
undefined
,
firstNotNull
:
null
,
count
:
0
,
count
:
0
,
nonNullCount
:
0
,
nonNullCount
:
0
,
allIsNull
:
true
,
allIsNull
:
true
,
...
@@ -272,8 +272,8 @@ function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero: boolean
...
@@ -272,8 +272,8 @@ function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero: boolean
}
}
}
}
if
(
currentValue
!==
null
)
{
if
(
currentValue
!==
null
&&
currentValue
!==
undefined
)
{
const
isFirst
=
calcs
.
firstNotNull
===
undefined
;
const
isFirst
=
calcs
.
firstNotNull
===
null
;
if
(
isFirst
)
{
if
(
isFirst
)
{
calcs
.
firstNotNull
=
currentValue
;
calcs
.
firstNotNull
=
currentValue
;
}
}
...
@@ -366,11 +366,11 @@ function calculateFirstNotNull(field: Field, ignoreNulls: boolean, nullAsZero: b
...
@@ -366,11 +366,11 @@ function calculateFirstNotNull(field: Field, ignoreNulls: boolean, nullAsZero: b
const
data
=
field
.
values
;
const
data
=
field
.
values
;
for
(
let
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
for
(
let
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
const
v
=
data
.
get
(
idx
);
const
v
=
data
.
get
(
idx
);
if
(
v
!=
null
)
{
if
(
v
!=
null
&&
v
!==
undefined
)
{
return
{
firstNotNull
:
v
};
return
{
firstNotNull
:
v
};
}
}
}
}
return
{
firstNotNull
:
undefined
};
return
{
firstNotNull
:
null
};
}
}
function
calculateLast
(
field
:
Field
,
ignoreNulls
:
boolean
,
nullAsZero
:
boolean
):
FieldCalcs
{
function
calculateLast
(
field
:
Field
,
ignoreNulls
:
boolean
,
nullAsZero
:
boolean
):
FieldCalcs
{
...
@@ -383,11 +383,11 @@ function calculateLastNotNull(field: Field, ignoreNulls: boolean, nullAsZero: bo
...
@@ -383,11 +383,11 @@ function calculateLastNotNull(field: Field, ignoreNulls: boolean, nullAsZero: bo
let
idx
=
data
.
length
-
1
;
let
idx
=
data
.
length
-
1
;
while
(
idx
>=
0
)
{
while
(
idx
>=
0
)
{
const
v
=
data
.
get
(
idx
--
);
const
v
=
data
.
get
(
idx
--
);
if
(
v
!=
null
)
{
if
(
v
!=
null
&&
v
!==
undefined
)
{
return
{
lastNotNull
:
v
};
return
{
lastNotNull
:
v
};
}
}
}
}
return
{
lastNotNull
:
undefined
};
return
{
lastNotNull
:
null
};
}
}
function
calculateChangeCount
(
field
:
Field
,
ignoreNulls
:
boolean
,
nullAsZero
:
boolean
):
FieldCalcs
{
function
calculateChangeCount
(
field
:
Field
,
ignoreNulls
:
boolean
,
nullAsZero
:
boolean
):
FieldCalcs
{
...
...
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