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
9c73b2fa
Commit
9c73b2fa
authored
Jul 06, 2016
by
herver
Committed by
Torkel Ödegaard
Jul 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support data units for both IEC (Binary) and Metric (Decimal) variants (#5473)
parent
53f110c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
public/app/core/utils/kbn.js
+22
-5
public/test/core/utils/kbn_specs.js
+7
-0
No files found.
public/app/core/utils/kbn.js
View file @
9c73b2fa
...
...
@@ -374,13 +374,20 @@ function($, _, moment) {
kbn
.
valueFormats
.
currencyEUR
=
kbn
.
formatBuilders
.
currency
(
'€'
);
kbn
.
valueFormats
.
currencyJPY
=
kbn
.
formatBuilders
.
currency
(
'¥'
);
// Data
// Data
(Binary)
kbn
.
valueFormats
.
bits
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'b'
);
kbn
.
valueFormats
.
bytes
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'B'
);
kbn
.
valueFormats
.
kbytes
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'B'
,
1
);
kbn
.
valueFormats
.
mbytes
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'B'
,
2
);
kbn
.
valueFormats
.
gbytes
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'B'
,
3
);
// Data (Decimal)
kbn
.
valueFormats
.
decbits
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'b'
);
kbn
.
valueFormats
.
decbytes
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'B'
);
kbn
.
valueFormats
.
deckbytes
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'B'
,
1
);
kbn
.
valueFormats
.
decmbytes
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'B'
,
2
);
kbn
.
valueFormats
.
decgbytes
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'B'
,
3
);
// Data Rate
kbn
.
valueFormats
.
pps
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'pps'
);
kbn
.
valueFormats
.
bps
=
kbn
.
formatBuilders
.
decimalSIPrefix
(
'bps'
);
...
...
@@ -637,13 +644,23 @@ function($, _, moment) {
]
},
{
text
:
'data'
,
text
:
'data
(IEC)
'
,
submenu
:
[
{
text
:
'bits'
,
value
:
'bits'
},
{
text
:
'bytes'
,
value
:
'bytes'
},
{
text
:
'kilobytes'
,
value
:
'kbytes'
},
{
text
:
'megabytes'
,
value
:
'mbytes'
},
{
text
:
'gigabytes'
,
value
:
'gbytes'
},
{
text
:
'kibibytes'
,
value
:
'kbytes'
},
{
text
:
'mebibytes'
,
value
:
'mbytes'
},
{
text
:
'gibibytes'
,
value
:
'gbytes'
},
]
},
{
text
:
'data (Metric)'
,
submenu
:
[
{
text
:
'bits'
,
value
:
'decbits'
},
{
text
:
'bytes'
,
value
:
'decbytes'
},
{
text
:
'kilobytes'
,
value
:
'deckbytes'
},
{
text
:
'megabytes'
,
value
:
'decmbytes'
},
{
text
:
'gigabytes'
,
value
:
'decgbytes'
},
]
},
{
...
...
public/test/core/utils/kbn_specs.js
View file @
9c73b2fa
...
...
@@ -110,6 +110,13 @@ define([
});
});
describe
(
'kbn deckbytes format when scaled decimals is null do not use it'
,
function
()
{
it
(
'should use specified decimals'
,
function
()
{
var
str
=
kbn
.
valueFormats
[
'deckbytes'
](
10000000
,
3
,
null
);
expect
(
str
).
to
.
be
(
'10.000 GB'
);
});
});
describe
(
'kbn roundValue'
,
function
()
{
it
(
'should should handle null value'
,
function
()
{
var
str
=
kbn
.
roundValue
(
null
,
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