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
305d5c5a
Commit
305d5c5a
authored
Apr 06, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #189, correction to ms axis formater, now formats days correctly
parent
49492e7b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
10 deletions
+28
-10
src/app/components/kbn.js
+4
-10
src/test/specs/kbn-format-specs.js
+23
-0
src/test/test-main.js
+1
-0
No files found.
src/app/components/kbn.js
View file @
305d5c5a
...
...
@@ -597,18 +597,12 @@ function($, _, moment) {
else
if
(
size
<
86400000
)
{
return
(
size
/
3600000
).
toFixed
(
decimals
)
+
" hour"
;
}
// Less than one
week
, devide in days
else
if
(
size
<
6048
00000
)
{
// Less than one
year
, devide in days
else
if
(
size
<
315360
00000
)
{
return
(
size
/
86400000
).
toFixed
(
decimals
)
+
" day"
;
}
// Less than one month, devide in weeks
else
if
(
size
<
2.62974e9
)
{
return
(
size
/
604800000
).
toFixed
(
decimals
)
+
" week"
;
}
// Less than one year, devide in weeks
else
if
(
size
<
3.15569e10
)
{
return
(
size
/
2.62974e9
).
toFixed
(
decimals
)
+
" year"
;
}
return
(
size
/
31536000000
).
toFixed
(
decimals
)
+
" year"
;
};
kbn
.
microsFormat
=
function
(
size
,
decimals
)
{
...
...
src/test/specs/kbn-format-specs.js
0 → 100644
View file @
305d5c5a
define
([
'kbn'
],
function
(
kbn
)
{
describe
(
'millisecond formating'
,
function
()
{
it
(
'should translate 4378634603 as 1.67 years'
,
function
()
{
var
str
=
kbn
.
msFormat
(
4378634603
,
2
);
expect
(
str
).
to
.
be
(
'50.68 day'
);
});
it
(
'should translate 3654454 as 1.02 hour'
,
function
()
{
var
str
=
kbn
.
msFormat
(
3654454
,
2
);
expect
(
str
).
to
.
be
(
'1.02 hour'
);
});
it
(
'should translate 365445 as 6.09 min'
,
function
()
{
var
str
=
kbn
.
msFormat
(
365445
,
2
);
expect
(
str
).
to
.
be
(
'6.09 min'
);
});
});
});
src/test/test-main.js
View file @
305d5c5a
...
...
@@ -115,6 +115,7 @@ require([
'specs/parser-specs'
,
'specs/gfunc-specs'
,
'specs/filterSrv-specs'
,
'specs/kbn-format-specs'
,
],
function
()
{
window
.
__karma__
.
start
();
});
...
...
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