From c40145588e7fe09d67a598e427c84b894d0f7e3a Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 5 Feb 2020 16:12:08 -0800 Subject: [PATCH] Improved saving events in CSV format. --- package.json | 2 +- translate/translate.json | 11 +++++++---- views/default.handlebars | 9 ++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f02f4840..4dc651b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.8-p", + "version": "0.4.8-q", "keywords": [ "Remote Management", "Intel AMT", diff --git a/translate/translate.json b/translate/translate.json index d31d1bc6..3a1dd3fc 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -20250,10 +20250,7 @@ "ja": "時間、タイプ、アクション、ユーザー、メッセージ", "nl": "tijd, type, actie, gebruiker, bericht", "pt": "hora, tipo, ação, usuário, mensagem", - "ru": "time, type, action, user, message", - "xloc": [ - "default.handlebars->25->1200" - ] + "ru": "time, type, action, user, message" }, { "cs": "celkem", @@ -20317,6 +20314,12 @@ "default.handlebars->25->1241" ] }, + { + "en": "utc, time, type, action, user, device, message", + "xloc": [ + "default.handlebars->25->1200" + ] + }, { "en": "{0} - Agent Installation", "xloc": [ diff --git a/views/default.handlebars b/views/default.handlebars index 5059f3d7..0ae5ebd5 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -8786,7 +8786,6 @@ function p3showDownloadEventsDialog(mode) { if (xxdialogMode) return; - console.log('p3showDownloadEventsDialog'); var x = "Download the list of events with one of the file formats below." + '

'; x += addHtmlValue("CSV Format", '' + "eventslist.csv" + ''); x += addHtmlValue("JSON Format", '' + "eventslist.json" + ''); @@ -8798,8 +8797,12 @@ if (mode == 1) { eventList = currentDeviceEvents; } if (mode == 2) { eventList = events; } if (mode == 3) { eventList = currentUserEvents; } - csv = "time, type, action, user, message" + '\r\n'; - for (var i in eventList) { csv += '\"' + eventList[i].time + '\",\"' + eventList[i].etype + '\",\"' + ((eventList[i].action != null) ? eventList[i].action : '') + '\",\"' + ((eventList[i].username != null) ? eventList[i].username : '') + '\",\"' + ((eventList[i].msg != null) ? eventList[i].msg : '') + '\"\r\n'; } + csv = "utc, time, type, action, user, device, message" + '\r\n'; + for (var i in eventList) { + var nodename = ''; + if (eventList[i].nodeid) { var node = getNodeFromId(eventList[i].nodeid); if (node && node.name) { nodename = node.name; } } + csv += '\"' + eventList[i].time + '\",\"' + printDateTime(new Date(eventList[i].time)) + '\",\"' + eventList[i].etype + '\",\"' + ((eventList[i].action != null) ? eventList[i].action : '') + '\",\"' + ((eventList[i].username != null) ? eventList[i].username : '') + '\",\"' + EscapeHtml(nodename) + '\",\"' + ((eventList[i].msg != null) ? eventList[i].msg : '').split(',').join(' -') + '\"\r\n'; + } saveAs(new Blob([csv], { type: 'application/octet-stream' }), "eventslist.csv"); return false; }