mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
parent
ea84b0b446
commit
a0cc06320f
@ -294,6 +294,33 @@ define(function(require) {
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
|
||||
"date-euro-pre": function ( a ) {
|
||||
var x;
|
||||
|
||||
if ( $.trim(a) !== '' ) {
|
||||
var frDatea = $.trim(a).split(' ');
|
||||
var frTimea = (undefined != frDatea[1]) ? frDatea[1].split(':') : [00,00,00];
|
||||
var frDatea2 = frDatea[0].split('/');
|
||||
x = (frDatea2[2] + frDatea2[1] + frDatea2[0] + frTimea[0] + frTimea[1] + ((undefined != frTimea[2]) ? frTimea[2] : 0)) * 1;
|
||||
}
|
||||
else {
|
||||
x = Infinity;
|
||||
}
|
||||
|
||||
return x;
|
||||
},
|
||||
|
||||
"date-euro-asc": function ( a, b ) {
|
||||
return a - b;
|
||||
},
|
||||
|
||||
"date-euro-desc": function ( a, b ) {
|
||||
return b - a;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//source https://cdn.datatables.net/plug-ins/1.10.12/type-detection/ip-address.js (modified)
|
||||
jQuery.fn.dataTableExt.aTypes.unshift(
|
||||
function ( sData )
|
||||
|
@ -75,7 +75,8 @@ define(function(require) {
|
||||
{"sWidth": "35px", "aTargets": [0]},
|
||||
{"bVisible": true, "aTargets": SunstoneConfig.tabTableColumns(TAB_NAME)},
|
||||
{"bVisible": false, "aTargets": ['_all']},
|
||||
{"sType": "file-size", "aTargets": [ 6 ] }
|
||||
{"sType": "file-size", "aTargets": [ 6 ]},
|
||||
{"sType": "date-euro", "aTargets": [ 9 ]}
|
||||
]
|
||||
}
|
||||
|
||||
@ -150,7 +151,7 @@ define(function(require) {
|
||||
Humanize.sizeFromMB(element.SIZE),
|
||||
state,
|
||||
OpenNebulaMarketPlaceApp.typeStr(element.TYPE),
|
||||
Humanize.prettyTime(element.REGTIME),
|
||||
Humanize.prettyTimeDatatable(element.REGTIME),
|
||||
element.MARKETPLACE,
|
||||
zone,
|
||||
(LabelsUtils.labelsStr(element[TEMPLATE_ATTR])||''),
|
||||
|
@ -58,7 +58,8 @@ define(function(require) {
|
||||
{"bSortable": false, "aTargets": ["check"]},
|
||||
{"sWidth": "35px", "aTargets": [0]},
|
||||
{"bVisible": true, "aTargets": SunstoneConfig.tabTableColumns(tabId)},
|
||||
{"bVisible": false, "aTargets": ['_all']}
|
||||
{"bVisible": false, "aTargets": ['_all']},
|
||||
{"sType": "date-euro", "aTargets": [ 5 ]}
|
||||
]
|
||||
}
|
||||
|
||||
@ -118,7 +119,7 @@ define(function(require) {
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
element.GNAME,
|
||||
Humanize.prettyTime(element.REGTIME),
|
||||
Humanize.prettyTimeDatatable(element.REGTIME),
|
||||
(LabelsUtils.labelsStr(element[TEMPLATE_ATTR])||''),
|
||||
btoa(unescape(encodeURIComponent(JSON.stringify(search))))
|
||||
];
|
||||
|
@ -32,7 +32,8 @@ define(function(require) {
|
||||
'prettyTime': _prettyTime,
|
||||
'prettyTimeAxis': _prettyTimeAxis,
|
||||
'prettyPrintJSON': _prettyPrintJSON,
|
||||
'prettyTimeAgo': _format_date
|
||||
'prettyTimeAgo': _format_date,
|
||||
'prettyTimeDatatable': _prettyTimeDatatable
|
||||
}
|
||||
|
||||
/*
|
||||
@ -240,6 +241,20 @@ define(function(require) {
|
||||
return str;
|
||||
}
|
||||
|
||||
function _prettyTimeDatatable(seconds) {
|
||||
var d = new Date();
|
||||
d.setTime(seconds * 1000);
|
||||
|
||||
var secs = _pad(d.getSeconds(), 2);
|
||||
var hour = _pad(d.getHours(), 2);
|
||||
var mins = _pad(d.getMinutes(), 2);
|
||||
var day = _pad(d.getDate(), 2);
|
||||
var month = _pad(d.getMonth() + 1, 2); //getMonths returns 0-11
|
||||
var year = d.getFullYear();
|
||||
|
||||
return day + "/" + month + "/" + year + " " + hour + ":" + mins + ":" + secs;
|
||||
}
|
||||
|
||||
function _format_date(unix_timestamp) {
|
||||
var difference_in_seconds = (Math.round((new Date()).getTime() / 1000)) - unix_timestamp,
|
||||
current_date = new Date(unix_timestamp * 1000), minutes, hours;
|
||||
|
Loading…
x
Reference in New Issue
Block a user