Commit 398e9f51 by Alexander Zobnin

issue #4747 - add date and time units to singlestat panel.

parent 90c06306
define([
'jquery',
'lodash',
'moment'
],
function($, _) {
function($, _, moment) {
'use strict';
var kbn = {};
......@@ -580,6 +581,20 @@ function($, _) {
}
};
// Date and time
kbn.toDateTime = function(size, timeScale) {
var datetime = moment(size * timeScale);
return datetime.format('YYYY-MM-DD hh:mm:ss');
};
kbn.valueFormats.datems = function(size) {
return kbn.toDateTime(size, 1000);
};
kbn.valueFormats.dates = function(size) {
return kbn.toDateTime(size, 1);
};
///// FORMAT MENU /////
kbn.getUnitFormats = function() {
......@@ -619,6 +634,13 @@ function($, _) {
]
},
{
text: 'date and time',
submenu: [
{text: 'date (ms)', value: 'datems'},
{text: 'date (s)', value: 'dates' }
]
},
{
text: 'data',
submenu: [
{text: 'bits', value: 'bits' },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment