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
732c84c2
Commit
732c84c2
authored
Jul 27, 2016
by
Thib17
Committed by
Torkel Ödegaard
Jul 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable scaling down seconds unit s > ms > µs > ns (#5642)
parent
39be7cf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
public/app/core/utils/kbn.js
+13
-0
public/test/core/utils/kbn_specs.js
+5
-0
No files found.
public/app/core/utils/kbn.js
View file @
732c84c2
...
...
@@ -500,6 +500,19 @@ function($, _, moment) {
kbn
.
valueFormats
.
s
=
function
(
size
,
decimals
,
scaledDecimals
)
{
if
(
size
===
null
)
{
return
""
;
}
// Less than 1 µs, devide in ns
if
(
Math
.
abs
(
size
)
<
0.000001
)
{
return
kbn
.
toFixedScaled
(
size
*
1
.
e9
,
decimals
,
scaledDecimals
-
decimals
,
-
9
,
" ns"
);
}
// Less than 1 ms, devide in µs
if
(
Math
.
abs
(
size
)
<
0.001
)
{
return
kbn
.
toFixedScaled
(
size
*
1
.
e6
,
decimals
,
scaledDecimals
-
decimals
,
-
6
,
" µs"
);
}
// Less than 1 second, devide in ms
if
(
Math
.
abs
(
size
)
<
1
)
{
return
kbn
.
toFixedScaled
(
size
*
1
.
e3
,
decimals
,
scaledDecimals
-
decimals
,
-
3
,
" ms"
);
}
if
(
Math
.
abs
(
size
)
<
60
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
" s"
;
}
...
...
public/test/core/utils/kbn_specs.js
View file @
732c84c2
...
...
@@ -68,6 +68,11 @@ define([
describeValueFormat
(
'wps'
,
789000000
,
1000000
,
-
1
,
'789M wps'
);
describeValueFormat
(
'iops'
,
11000000000
,
1000000000
,
-
1
,
'11B iops'
);
describeValueFormat
(
's'
,
1.23456789
e
-
7
,
1
e
-
10
,
8
,
'123.5 ns'
);
describeValueFormat
(
's'
,
1.23456789
e
-
4
,
1
e
-
7
,
5
,
'123.5 µs'
);
describeValueFormat
(
's'
,
1.23456789
e
-
3
,
1
e
-
6
,
4
,
'1.235 ms'
);
describeValueFormat
(
's'
,
1.23456789
e
-
2
,
1
e
-
5
,
3
,
'12.35 ms'
);
describeValueFormat
(
's'
,
1.23456789
e
-
1
,
1
e
-
4
,
2
,
'123.5 ms'
);
describeValueFormat
(
's'
,
24
,
1
,
0
,
'24 s'
);
describeValueFormat
(
's'
,
246
,
1
,
0
,
'4.1 min'
);
describeValueFormat
(
's'
,
24567
,
100
,
0
,
'6.82 hour'
);
...
...
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