From c526c8b66b185876bb28d71f4a74381491aedf67 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 15 May 2019 14:26:58 -0700 Subject: [PATCH] Added event log save feature. --- package.json | 2 +- views/default.handlebars | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 45df3298..4655fb9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.3.4-j", + "version": "0.3.4-k", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default.handlebars b/views/default.handlebars index 6177068c..49255500 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -286,7 +286,8 @@ - +   +   @@ -6696,6 +6697,26 @@ meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) }); } + function p3showDownloadEventsDialog() { + if (xxdialogMode) return; + 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'); + setDialogMode(2, "Event List Export", 1, null, x); + } + + function p3downloadEventsDialogCSV() { + var csv = "time, type, action, user, message\r\n"; + for (var i in events) { csv += '\"' + events[i].time + '\",\"' + events[i].etype + '\",\"' + ((events[i].action != null)?events[i].action:'') + '\",\"' + ((events[i].username != null)?events[i].username:'') + '\",\"' + ((events[i].msg != null)?events[i].msg:'') + '\"\r\n'; } + saveAs(new Blob([csv], { type: "application/octet-stream" }), "eventslist.csv"); + } + + function p3downloadEventsDialogJSON() { + var r = [] + for (var i in events) { r.push(events[i]); } + saveAs(new Blob([JSON.stringify(r)], { type: "application/octet-stream" }), "eventslist.json"); + } + // // MY USERS //