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
c30c12d3
Commit
c30c12d3
authored
Feb 29, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(single_stat): rounding bug in value => text
parent
ae604b62
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
public/app/plugins/panel/singlestat/editor.html
+2
-2
public/app/plugins/panel/singlestat/module.ts
+1
-1
public/app/plugins/panel/singlestat/specs/singlestat-specs.ts
+9
-3
No files found.
public/app/plugins/panel/singlestat/editor.html
View file @
c30c12d3
...
@@ -167,13 +167,13 @@
...
@@ -167,13 +167,13 @@
<i
class=
"fa fa-remove pointer"
ng-click=
"ctrl.removeValueMap(map)"
></i>
<i
class=
"fa fa-remove pointer"
ng-click=
"ctrl.removeValueMap(map)"
></i>
</li>
</li>
<li>
<li>
<input
type=
"text"
ng-model=
"
ctrl.
map.value"
placeholder=
"value"
class=
"input-mini tight-form-input"
ng-blur=
"ctrl.render()"
>
<input
type=
"text"
ng-model=
"map.value"
placeholder=
"value"
class=
"input-mini tight-form-input"
ng-blur=
"ctrl.render()"
>
</li>
</li>
<li
class=
"tight-form-item"
>
<li
class=
"tight-form-item"
>
<i
class=
"fa fa-arrow-right"
></i>
<i
class=
"fa fa-arrow-right"
></i>
</li>
</li>
<li
ng-repeat-end
>
<li
ng-repeat-end
>
<input
type=
"text"
placeholder=
"text"
ng-model=
"
ctrl.
map.text"
class=
"input-mini tight-form-input"
ng-blur=
"ctrl.render()"
>
<input
type=
"text"
placeholder=
"text"
ng-model=
"map.text"
class=
"input-mini tight-form-input"
ng-blur=
"ctrl.render()"
>
</li>
</li>
<li>
<li>
...
...
public/app/plugins/panel/singlestat/module.ts
View file @
c30c12d3
...
@@ -213,7 +213,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
...
@@ -213,7 +213,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// value/number to text mapping
// value/number to text mapping
var
value
=
parseFloat
(
map
.
value
);
var
value
=
parseFloat
(
map
.
value
);
if
(
value
===
data
.
value
)
{
if
(
value
===
data
.
value
Rounded
)
{
data
.
valueFormated
=
map
.
text
;
data
.
valueFormated
=
map
.
text
;
return
;
return
;
}
}
...
...
public/app/plugins/panel/singlestat/specs/singlestat-specs.ts
View file @
c30c12d3
...
@@ -69,14 +69,20 @@ describe('SingleStatCtrl', function() {
...
@@ -69,14 +69,20 @@ describe('SingleStatCtrl', function() {
singleStatScenario
(
'When value to text mapping is specified'
,
function
(
ctx
)
{
singleStatScenario
(
'When value to text mapping is specified'
,
function
(
ctx
)
{
ctx
.
setup
(
function
()
{
ctx
.
setup
(
function
()
{
ctx
.
datapoints
=
[[
10
,
1
]];
ctx
.
datapoints
=
[[
9.9
,
1
]];
ctx
.
ctrl
.
panel
.
valueMaps
=
[{
value
:
'10'
,
text
:
'OK'
}];
ctx
.
ctrl
.
panel
.
valueMaps
=
[{
value
:
'10'
,
text
:
'OK'
}];
});
});
it
(
'value should remain'
,
function
()
{
expect
(
ctx
.
data
.
value
).
to
.
be
(
9.9
);
});
it
(
'round should be rounded up'
,
function
()
{
expect
(
ctx
.
data
.
valueRounded
).
to
.
be
(
10
);
});
it
(
'Should replace value with text'
,
function
()
{
it
(
'Should replace value with text'
,
function
()
{
expect
(
ctx
.
data
.
value
).
to
.
be
(
10
);
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'OK'
);
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'OK'
);
});
});
});
});
});
});
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