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
bb6d8ec9
Commit
bb6d8ec9
authored
Feb 27, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #150 from jippi/better-ms-formatting
allow hour, day, week and year time rounding
parents
c4219ba0
ddb81de5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
src/app/components/kbn.js
+20
-3
No files found.
src/app/components/kbn.js
View file @
bb6d8ec9
...
@@ -534,12 +534,30 @@ function($, _, moment) {
...
@@ -534,12 +534,30 @@ function($, _, moment) {
if
(
size
<
1000
)
{
if
(
size
<
1000
)
{
return
size
.
toFixed
(
0
)
+
" ms"
;
return
size
.
toFixed
(
0
)
+
" ms"
;
}
}
// Less than 1 min
else
if
(
size
<
60000
)
{
else
if
(
size
<
60000
)
{
return
(
size
/
1000
).
toFixed
(
decimals
)
+
" s"
;
return
(
size
/
1000
).
toFixed
(
decimals
)
+
" s"
;
}
}
else
{
// Less than 1 hour, devide in minutes
else
if
(
size
<
3600000
)
{
return
(
size
/
60000
).
toFixed
(
decimals
)
+
" min"
;
return
(
size
/
60000
).
toFixed
(
decimals
)
+
" min"
;
}
}
// Less than one day, devide in hours
else
if
(
size
<
86400000
)
{
return
(
size
/
3600000
).
toFixed
(
decimals
)
+
" hour"
;
}
// Less than one week, devide in days
else
if
(
size
<
604800000
)
{
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"
;
}
};
};
kbn
.
microsFormat
=
function
(
size
,
decimals
)
{
kbn
.
microsFormat
=
function
(
size
,
decimals
)
{
...
@@ -555,4 +573,4 @@ function($, _, moment) {
...
@@ -555,4 +573,4 @@ function($, _, moment) {
};
};
return
kbn
;
return
kbn
;
});
});
\ No newline at end of file
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