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
12570bb9
Commit
12570bb9
authored
Jun 25, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(singlestat): add serie name as an value option
closes #4740
parent
8b8bfa8a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
+29
-2
CHANGELOG.md
+1
-0
public/app/plugins/panel/singlestat/editor.html
+4
-1
public/app/plugins/panel/singlestat/module.ts
+8
-1
public/app/plugins/panel/singlestat/specs/singlestat-specs.ts
+16
-0
No files found.
CHANGELOG.md
View file @
12570bb9
...
...
@@ -2,6 +2,7 @@
### Enhancements
*
**Login**
: Adds option to disable username/password logins, closes
[
#4674
](
https://github.com/grafana/grafana/issues/4674
)
*
**SingleStat**
: Add seriename as option in singlestat panel, closes
[
#4740
](
https://github.com/grafana/grafana/issues/4740
)
# 3.1.0 stable (unreleased)
...
...
public/app/plugins/panel/singlestat/editor.html
View file @
12570bb9
...
...
@@ -16,7 +16,10 @@
Value
</li>
<li>
<select
class=
"input-small tight-form-input"
ng-model=
"ctrl.panel.valueName"
ng-options=
"f for f in ['min','max','avg', 'current', 'total']"
ng-change=
"ctrl.render()"
></select>
<select
class=
"input-small tight-form-input"
ng-model=
"ctrl.panel.valueName"
ng-options=
"f for f in ctrl.valueNameOptions"
ng-change=
"ctrl.render()"
></select>
</li>
<li
class=
"tight-form-item"
>
Postfix
...
...
public/app/plugins/panel/singlestat/module.ts
View file @
12570bb9
...
...
@@ -19,6 +19,9 @@ class SingleStatCtrl extends MetricsPanelCtrl {
fontSizes
:
any
[];
unitFormats
:
any
[];
invalidGaugeRange
:
boolean
;
panel
:
any
;
events
:
any
;
valueNameOptions
:
any
[]
=
[
'min'
,
'max'
,
'avg'
,
'current'
,
'total'
,
'name'
];
// Set and populate defaults
panelDefaults
=
{
...
...
@@ -186,7 +189,11 @@ class SingleStatCtrl extends MetricsPanelCtrl {
var
lastPoint
=
_
.
last
(
this
.
series
[
0
].
datapoints
);
var
lastValue
=
_
.
isArray
(
lastPoint
)
?
lastPoint
[
0
]
:
null
;
if
(
_
.
isString
(
lastValue
))
{
if
(
this
.
panel
.
valueName
===
'name'
)
{
data
.
value
=
0
;
data
.
valueRounded
=
0
;
data
.
valueFormated
=
this
.
series
[
0
].
alias
;
}
else
if
(
_
.
isString
(
lastValue
))
{
data
.
value
=
0
;
data
.
valueFormated
=
lastValue
;
data
.
valueRounded
=
0
;
...
...
public/app/plugins/panel/singlestat/specs/singlestat-specs.ts
View file @
12570bb9
...
...
@@ -51,6 +51,22 @@ describe('SingleStatCtrl', function() {
});
});
singleStatScenario
(
'showing serie name instead of value'
,
function
(
ctx
)
{
ctx
.
setup
(
function
()
{
ctx
.
datapoints
=
[[
10
,
1
],
[
20
,
2
]];
ctx
.
ctrl
.
panel
.
valueName
=
'name'
;
});
it
(
'Should use series avg as default main value'
,
function
()
{
expect
(
ctx
.
data
.
value
).
to
.
be
(
0
);
expect
(
ctx
.
data
.
valueRounded
).
to
.
be
(
0
);
});
it
(
'should set formated falue'
,
function
()
{
expect
(
ctx
.
data
.
valueFormated
).
to
.
be
(
'test.cpu1'
);
});
});
singleStatScenario
(
'MainValue should use same number for decimals as displayed when checking thresholds'
,
function
(
ctx
)
{
ctx
.
setup
(
function
()
{
ctx
.
datapoints
=
[[
99.999
,
1
],
[
99.99999
,
2
]];
...
...
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