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
bbb75961
Commit
bbb75961
authored
Jan 21, 2019
by
Hugo Häggmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed null logic for range value mappings after PR comments
parent
38ea11d1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
16 deletions
+4
-16
packages/grafana-ui/src/components/Gauge/Gauge.test.tsx
+2
-15
packages/grafana-ui/src/components/Gauge/Gauge.tsx
+2
-1
No files found.
packages/grafana-ui/src/components/Gauge/Gauge.test.tsx
View file @
bbb75961
...
@@ -148,22 +148,9 @@ describe('Format value with value mappings', () => {
...
@@ -148,22 +148,9 @@ describe('Format value with value mappings', () => {
expect
(
result
.
text
).
toEqual
(
'<NULL>'
);
expect
(
result
.
text
).
toEqual
(
'<NULL>'
);
});
});
it
(
'should return if value is null and range to text mapping from is null'
,
()
=>
{
it
(
'should return if value is null and range to text mapping from
and to
is null'
,
()
=>
{
const
valueMappings
:
ValueMapping
[]
=
[
const
valueMappings
:
ValueMapping
[]
=
[
{
id
:
0
,
operator
:
''
,
text
:
'<NULL>'
,
type
:
MappingType
.
RangeToText
,
from
:
'null'
,
to
:
'10'
},
{
id
:
0
,
operator
:
''
,
text
:
'<NULL>'
,
type
:
MappingType
.
RangeToText
,
from
:
'null'
,
to
:
'null'
},
{
id
:
1
,
operator
:
''
,
text
:
'elva'
,
type
:
MappingType
.
ValueToText
,
value
:
'11'
},
];
const
value
=
null
;
const
{
instance
}
=
setup
({
valueMappings
});
const
result
=
instance
.
getFirstFormattedValueMapping
(
valueMappings
,
value
);
expect
(
result
.
text
).
toEqual
(
'<NULL>'
);
});
it
(
'should return if value is null and range to text mapping to is null'
,
()
=>
{
const
valueMappings
:
ValueMapping
[]
=
[
{
id
:
0
,
operator
:
''
,
text
:
'<NULL>'
,
type
:
MappingType
.
RangeToText
,
from
:
'1'
,
to
:
'null'
},
{
id
:
1
,
operator
:
''
,
text
:
'elva'
,
type
:
MappingType
.
ValueToText
,
value
:
'11'
},
{
id
:
1
,
operator
:
''
,
text
:
'elva'
,
type
:
MappingType
.
ValueToText
,
value
:
'11'
},
];
];
const
value
=
null
;
const
value
=
null
;
...
...
packages/grafana-ui/src/components/Gauge/Gauge.tsx
View file @
bbb75961
...
@@ -91,7 +91,8 @@ export class Gauge extends PureComponent<Props> {
...
@@ -91,7 +91,8 @@ export class Gauge extends PureComponent<Props> {
value
===
null
&&
value
===
null
&&
rangeToTextMapping
.
from
&&
rangeToTextMapping
.
from
&&
rangeToTextMapping
.
to
&&
rangeToTextMapping
.
to
&&
(
rangeToTextMapping
.
from
.
toLowerCase
()
===
'null'
||
rangeToTextMapping
.
to
.
toLowerCase
()
===
'null'
)
rangeToTextMapping
.
from
.
toLowerCase
()
===
'null'
&&
rangeToTextMapping
.
to
.
toLowerCase
()
===
'null'
)
{
)
{
return
allValueMappings
.
concat
(
rangeToTextMapping
);
return
allValueMappings
.
concat
(
rangeToTextMapping
);
}
}
...
...
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