Fix Rspamd logs date

master
andryyy 2017-07-03 08:10:11 +02:00
parent 2cf9f71613
commit d4311a806b
1 changed files with 16 additions and 25 deletions

View File

@ -15,10 +15,6 @@ jQuery(function($){
return entityMap[s]; return entityMap[s];
}); });
} }
function unix_time_format(tm) {
var date = new Date(tm ? tm * 1000 : 0);
return date.toLocaleString();
}
function humanFileSize(bytes) { function humanFileSize(bytes) {
if(Math.abs(bytes) < 1024) { if(Math.abs(bytes) < 1024) {
return bytes + ' B'; return bytes + ' B';
@ -331,16 +327,12 @@ jQuery(function($){
function draw_rspamd_history() { function draw_rspamd_history() {
ft_postfix_logs = FooTable.init('#rspamd_history', { ft_postfix_logs = FooTable.init('#rspamd_history', {
"columns": [{ "columns": [{
"name": "message-id", "name":"unix_time",
"title": "ID", "formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},
"breakpoints": "all", "title":lang.time,
"style": { "style":{
"minWidth": 130, "width":"170px"
"overflow": "hidden", }
"textOverflow": "ellipsis",
"wordBreak": "break-all",
"whiteSpace": "normal"
}
}, { }, {
"name": "ip", "name": "ip",
"title": "IP address", "title": "IP address",
@ -402,11 +394,16 @@ jQuery(function($){
"maxWidth": 72 "maxWidth": 72
}, },
}, { }, {
"sorted": true, "name": "message-id",
"breakpoints": "all", "title": "ID",
"direction": "DESC", "breakpoints": "all",
"name": "time", "style": {
"title": "Time", "minWidth": 130,
"overflow": "hidden",
"textOverflow": "ellipsis",
"wordBreak": "break-all",
"whiteSpace": "normal"
}
}, { }, {
"name": "user", "name": "user",
"title": "Authenticated user", "title": "Authenticated user",
@ -447,12 +444,6 @@ jQuery(function($){
}).map(function(e) { }).map(function(e) {
return e.str; return e.str;
}).join("<br>\n"); }).join("<br>\n");
item.time = {
"value": unix_time_format(item.unix_time),
"options": {
"sortValue": item.unix_time
}
};
var scan_time = item.time_real.toFixed(3) + ' / ' + item.time_virtual.toFixed(3); var scan_time = item.time_real.toFixed(3) + ' / ' + item.time_virtual.toFixed(3);
item.scan_time = { item.scan_time = {
"options": { "options": {