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
ab0155c8
Commit
ab0155c8
authored
Jun 21, 2016
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #2971 - add time units for use in singlestat panel.
parent
3b1ae3f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
1 deletions
+52
-1
public/app/core/utils/kbn.js
+52
-1
No files found.
public/app/core/utils/kbn.js
View file @
ab0155c8
define
([
'jquery'
,
'lodash'
,
'moment'
],
function
(
$
,
_
)
{
function
(
$
,
_
,
moment
)
{
'use strict'
;
var
kbn
=
{};
...
...
@@ -580,6 +581,45 @@ function($, _) {
}
};
// Date and time
kbn
.
toDateTime
=
function
(
size
,
timeScale
)
{
var
datetime
;
if
(
timeScale
===
's'
)
{
datetime
=
moment
.
unix
(
size
);
}
else
{
datetime
=
moment
(
size
);
}
return
datetime
;
};
kbn
.
toDuration
=
function
(
size
,
timeScale
)
{
return
moment
.
duration
(
size
,
timeScale
);
};
kbn
.
valueFormats
.
dtms
=
function
(
size
)
{
return
kbn
.
toDateTime
(
size
,
'ms'
).
format
(
'YYYY-MM-DD hh:mm:ss'
);
};
kbn
.
valueFormats
.
dts
=
function
(
size
)
{
return
kbn
.
toDateTime
(
size
,
's'
).
format
(
'YYYY-MM-DD hh:mm:ss'
);
};
kbn
.
valueFormats
.
dtfromnowms
=
function
(
size
)
{
return
kbn
.
toDateTime
(
size
,
'ms'
).
fromNow
(
true
);
};
kbn
.
valueFormats
.
dtfromnows
=
function
(
size
)
{
return
kbn
.
toDateTime
(
size
,
's'
).
fromNow
(
true
);
};
kbn
.
valueFormats
.
dtdurationms
=
function
(
size
)
{
return
kbn
.
toDuration
(
size
,
'ms'
).
humanize
();
};
kbn
.
valueFormats
.
dtdurations
=
function
(
size
)
{
return
kbn
.
toDuration
(
size
,
's'
).
humanize
();
};
///// FORMAT MENU /////
kbn
.
getUnitFormats
=
function
()
{
...
...
@@ -619,6 +659,17 @@ function($, _) {
]
},
{
text
:
'date and time'
,
submenu
:
[
{
text
:
'date and time (ms)'
,
value
:
'dtms'
},
{
text
:
'date and time (s)'
,
value
:
'dts'
},
{
text
:
'from now (ms)'
,
value
:
'dtfromnowms'
},
{
text
:
'from now (s)'
,
value
:
'dtfromnows'
},
{
text
:
'duration (ms)'
,
value
:
'dtdurationms'
},
{
text
:
'duration (s)'
,
value
:
'dtdurations'
}
]
},
{
text
:
'data'
,
submenu
:
[
{
text
:
'bits'
,
value
:
'bits'
},
...
...
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