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
2c51f114
Commit
2c51f114
authored
Apr 21, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
singlestat: fix variable spelling
parent
97e2d75f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
public/app/plugins/panel/singlestat/module.ts
+10
-10
public/app/plugins/panel/singlestat/specs/singlestat-specs.ts
+9
-9
No files found.
public/app/plugins/panel/singlestat/module.ts
View file @
2c51f114
...
...
@@ -192,10 +192,10 @@ class SingleStatCtrl extends MetricsPanelCtrl {
if
(
this
.
panel
.
valueName
===
'name'
)
{
data
.
value
=
0
;
data
.
valueRounded
=
0
;
data
.
valueFormated
=
this
.
series
[
0
].
alias
;
data
.
valueFormat
t
ed
=
this
.
series
[
0
].
alias
;
}
else
if
(
_
.
isString
(
lastValue
))
{
data
.
value
=
0
;
data
.
valueFormated
=
_
.
escape
(
lastValue
);
data
.
valueFormat
t
ed
=
_
.
escape
(
lastValue
);
data
.
valueRounded
=
0
;
}
else
{
data
.
value
=
this
.
series
[
0
].
stats
[
this
.
panel
.
valueName
];
...
...
@@ -203,7 +203,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var
decimalInfo
=
this
.
getDecimalsForValue
(
data
.
value
);
var
formatFunc
=
kbn
.
valueFormats
[
this
.
panel
.
format
];
data
.
valueFormated
=
formatFunc
(
data
.
value
,
decimalInfo
.
decimals
,
decimalInfo
.
scaledDecimals
);
data
.
valueFormat
t
ed
=
formatFunc
(
data
.
value
,
decimalInfo
.
decimals
,
decimalInfo
.
scaledDecimals
);
data
.
valueRounded
=
kbn
.
roundValue
(
data
.
value
,
decimalInfo
.
decimals
);
}
...
...
@@ -219,7 +219,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// special null case
if
(
map
.
value
===
'null'
)
{
if
(
data
.
value
===
null
||
data
.
value
===
void
0
)
{
data
.
valueFormated
=
map
.
text
;
data
.
valueFormat
t
ed
=
map
.
text
;
return
;
}
continue
;
...
...
@@ -228,7 +228,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// value/number to text mapping
var
value
=
parseFloat
(
map
.
value
);
if
(
value
===
data
.
valueRounded
)
{
data
.
valueFormated
=
map
.
text
;
data
.
valueFormat
t
ed
=
map
.
text
;
return
;
}
}
...
...
@@ -238,7 +238,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
// special null case
if
(
map
.
from
===
'null'
&&
map
.
to
===
'null'
)
{
if
(
data
.
value
===
null
||
data
.
value
===
void
0
)
{
data
.
valueFormated
=
map
.
text
;
data
.
valueFormat
t
ed
=
map
.
text
;
return
;
}
continue
;
...
...
@@ -248,14 +248,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var
from
=
parseFloat
(
map
.
from
);
var
to
=
parseFloat
(
map
.
to
);
if
(
to
>=
data
.
valueRounded
&&
from
<=
data
.
valueRounded
)
{
data
.
valueFormated
=
map
.
text
;
data
.
valueFormat
t
ed
=
map
.
text
;
return
;
}
}
}
if
(
data
.
value
===
null
||
data
.
value
===
void
0
)
{
data
.
valueFormated
=
"no value"
;
data
.
valueFormat
t
ed
=
"no value"
;
}
}
...
...
@@ -317,7 +317,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
if
(
panel
.
prefix
)
{
body
+=
getSpan
(
'singlestat-panel-prefix'
,
panel
.
prefixFontSize
,
panel
.
prefix
);
}
var
value
=
applyColoringThresholds
(
data
.
value
,
data
.
valueFormated
);
var
value
=
applyColoringThresholds
(
data
.
value
,
data
.
valueFormat
t
ed
);
body
+=
getSpan
(
'singlestat-panel-value'
,
panel
.
valueFontSize
,
value
);
if
(
panel
.
postfix
)
{
body
+=
getSpan
(
'singlestat-panel-postfix'
,
panel
.
postfixFontSize
,
panel
.
postfix
);
}
...
...
@@ -329,7 +329,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
function
getValueText
()
{
var
result
=
panel
.
prefix
?
panel
.
prefix
:
''
;
result
+=
data
.
valueFormated
;
result
+=
data
.
valueFormat
t
ed
;
result
+=
panel
.
postfix
?
panel
.
postfix
:
''
;
return
result
;
...
...
public/app/plugins/panel/singlestat/specs/singlestat-specs.ts
View file @
2c51f114
...
...
@@ -49,8 +49,8 @@ describe('SingleStatCtrl', function() {
expect
(
ctx
.
data
.
valueRounded
).
to
.
be
(
15
);
});
it
(
'should set formated falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'15'
);
it
(
'should set format
t
ed falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormat
t
ed
).
to
.
be
(
'15'
);
});
});
...
...
@@ -65,8 +65,8 @@ describe('SingleStatCtrl', function() {
expect
(
ctx
.
data
.
valueRounded
).
to
.
be
(
0
);
});
it
(
'should set formated falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'test.cpu1'
);
it
(
'should set format
t
ed falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormat
t
ed
).
to
.
be
(
'test.cpu1'
);
});
});
...
...
@@ -80,8 +80,8 @@ describe('SingleStatCtrl', function() {
expect
(
ctx
.
data
.
valueRounded
).
to
.
be
(
100
);
});
it
(
'should set formated falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'100'
);
it
(
'should set format
t
ed falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormat
t
ed
).
to
.
be
(
'100'
);
});
});
...
...
@@ -100,7 +100,7 @@ describe('SingleStatCtrl', function() {
});
it
(
'Should replace value with text'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'OK'
);
expect
(
ctx
.
data
.
valueFormat
t
ed
).
to
.
be
(
'OK'
);
});
});
...
...
@@ -112,7 +112,7 @@ describe('SingleStatCtrl', function() {
});
it
(
'Should replace value with text OK'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'OK'
);
expect
(
ctx
.
data
.
valueFormat
t
ed
).
to
.
be
(
'OK'
);
});
});
...
...
@@ -124,7 +124,7 @@ describe('SingleStatCtrl', function() {
});
it
(
'Should replace value with text NOT OK'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'NOT OK'
);
expect
(
ctx
.
data
.
valueFormat
t
ed
).
to
.
be
(
'NOT 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