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
1210fca8
Commit
1210fca8
authored
Jan 28, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(singlestat): fix bug in threshold calculations
parent
6c4791b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
public/app/plugins/panel/singlestat/module.ts
+1
-1
public/app/plugins/panel/singlestat/specs/singlestat_panel_spec.ts
+4
-4
No files found.
public/app/plugins/panel/singlestat/module.ts
View file @
1210fca8
...
@@ -221,7 +221,7 @@ function singleStatPanel($location, linkSrv, $timeout, templateSrv) {
...
@@ -221,7 +221,7 @@ function singleStatPanel($location, linkSrv, $timeout, templateSrv) {
function
getColorForValue
(
data
,
value
)
{
function
getColorForValue
(
data
,
value
)
{
for
(
var
i
=
data
.
thresholds
.
length
;
i
>
0
;
i
--
)
{
for
(
var
i
=
data
.
thresholds
.
length
;
i
>
0
;
i
--
)
{
if
(
value
>=
data
.
thresholds
[
i
])
{
if
(
value
>=
data
.
thresholds
[
i
-
1
])
{
return
data
.
colorMap
[
i
];
return
data
.
colorMap
[
i
];
}
}
}
}
...
...
public/app/plugins/panel/singlestat/specs/singlestat_panel_spec.ts
View file @
1210fca8
...
@@ -2,12 +2,12 @@ import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
...
@@ -2,12 +2,12 @@ import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
import
{
getColorForValue
}
from
'../module'
;
import
{
getColorForValue
}
from
'../module'
;
describe
(
'grafanaSingleStat'
,
function
()
{
describe
.
only
(
'grafanaSingleStat'
,
function
()
{
describe
(
'legacy thresholds'
,
()
=>
{
describe
(
'legacy thresholds'
,
()
=>
{
describe
(
'positive thresholds'
,
()
=>
{
describe
(
'positive thresholds'
,
()
=>
{
var
data
:
any
=
{
var
data
:
any
=
{
colorMap
:
[
'green'
,
'yellow'
,
'red'
],
colorMap
:
[
'green'
,
'yellow'
,
'red'
],
thresholds
:
[
0
,
20
,
50
]
thresholds
:
[
20
,
50
]
};
};
it
(
'5 should return green'
,
()
=>
{
it
(
'5 should return green'
,
()
=>
{
...
@@ -29,7 +29,7 @@ describe('grafanaSingleStat', function() {
...
@@ -29,7 +29,7 @@ describe('grafanaSingleStat', function() {
describe
(
'negative thresholds'
,
()
=>
{
describe
(
'negative thresholds'
,
()
=>
{
var
data
:
any
=
{
var
data
:
any
=
{
colorMap
:
[
'green'
,
'yellow'
,
'red'
],
colorMap
:
[
'green'
,
'yellow'
,
'red'
],
thresholds
:
[
-
20
,
0
,
20
]
thresholds
:
[
0
,
20
]
};
};
it
(
'-30 should return green'
,
()
=>
{
it
(
'-30 should return green'
,
()
=>
{
...
@@ -48,7 +48,7 @@ describe('grafanaSingleStat', function() {
...
@@ -48,7 +48,7 @@ describe('grafanaSingleStat', function() {
describe
(
'negative thresholds'
,
()
=>
{
describe
(
'negative thresholds'
,
()
=>
{
var
data
:
any
=
{
var
data
:
any
=
{
colorMap
:
[
'green'
,
'yellow'
,
'red'
],
colorMap
:
[
'green'
,
'yellow'
,
'red'
],
thresholds
:
[
-
40
,
-
27
,
20
]
thresholds
:
[
-
27
,
20
]
};
};
it
(
'-30 should return green'
,
()
=>
{
it
(
'-30 should return green'
,
()
=>
{
...
...
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