mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 23:53:25 -06:00
Merge pull request #5383 from alexanderzobnin/issue-4747
issue #4747 - add date and time units to singlestat panel.
This commit is contained in:
commit
b94527f661
@ -1,8 +1,9 @@
|
||||
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() {
|
||||
@ -618,6 +633,13 @@ function($, _) {
|
||||
{text: 'days (d)', value: 'd' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'date and time',
|
||||
submenu: [
|
||||
{text: 'date (ms)', value: 'datems'},
|
||||
{text: 'date (s)', value: 'dates' }
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'data',
|
||||
submenu: [
|
||||
|
Loading…
Reference in New Issue
Block a user