Started work on report generation.
Ylian Saint-Hilaire committed
Jul 14, 2020 at 17:50 UTC
a8ff81eca55fc11bf478a3de345af069a877f0f3
3 files changed
+32
-1
public/images/report.png
Binary files /dev/null and b/public/images/report.png differ
public/images/report60.png
Binary files /dev/null and b/public/images/report60.png differ
views/default.handlebars
+32
-1
@@ -353,6 +353,9 @@
353
<table class="pTable">
354
<tr>
355
<td class="h1"></td>
356
+ <td>
357
+ <input type="button" style="display:none" value="Download Report" onclick=p3showReportDialog() />
358
+ </td>
359
<td class="auto-style1">
360
Show
361
<select id=p3limitdropdown onchange=refreshEvents()>
@@ -10337,6 +10340,34 @@
10340
meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) });
10341
}
10342
10343
+ function p3showReportDialog() {
10344
+ if (xxdialogMode) return;
10345
+ var x = '<div style=float:right><img src=\'images/report60.png\' height=74 width=60 style=padding-top:2px /></div><div>';
10346
+ x += addHtmlValue("Report Type", '<select id=d2reportType style=width:160px onchange=p3showReportValidation()><option value=1>' + "All Events" + '</option>');
10347
+ x += addHtmlValue("Time Span", '<select id=d2reportSpan style=width:160px onchange=p3showReportValidation()><option value=1>' + "All Available" + '</option><option value=2>' + "One Day" + '</option></select>');
10348
+ x += '<div id=d2daySelector>' + addHtmlValue("Report Day", '<input type=date id=d2reportDay style=width:160px onchange=p3showReportValidation()></input>') + '</div>';
10349
+ x += addHtmlValue("Group By", '<select id=d2reportGroupBy style=width:160px onchange=p3showReportValidation()><option value=1>' + "None" + '</option><option value=2>' + "Device Group" + '</option><option value=3>' + "User" + '</option>');
10350
+ x += addHtmlValue("Format", '<select id=d2reportFormat style=width:160px onchange=p3showReportValidation()><option value=1>' + "CSV" + '</option><option value=2>' + "JSON" + '</option>');
10351
+ x += '</div>';
10352
+ setDialogMode(2, "Download Report", 3, null, x);
10353
+ p3showReportValidation();
10354
+ Q('d2reportType').focus();
10355
+ }
10356
+
10357
+ function p3showReportValidation() {
10358
+ var reportType = Q('d2reportType').value;
10359
+ var reportSpan = Q('d2reportSpan').value;
10360
+ var reportDay = Q('d2reportDay').value;
10361
+ var reportGroupBy = Q('d2reportGroupBy').value;
10362
+ var reportFormat = Q('d2reportFormat').value;
10363
+ QV('d2daySelector', reportSpan == 2);
10364
+ //console.log(reportType, reportSpan, reportDay, reportGroupBy, reportFormat);
10365
+
10366
+ var ok = true;
10367
+ if ((reportSpan == 2) && (reportDay == '')) ok = false;
10368
+ QE('idx_dlgOkButton', ok);
10369
+ }
10370
+
10371
function p3showDownloadEventsDialog(mode) {
10372
if (xxdialogMode) return;
10373
var x = "Download the list of events with one of the file formats below." + '<br /><br />';
@@ -10729,7 +10760,7 @@
10760
}
10761
10762
if ((features & 0x200000) == 0) { x += addHtmlValue('<span id=p4hname>' + "Username" + '</span>', '<input id=p4name maxlength=64 autocomplete=username onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />'); }
10732
- x += addHtmlValue('<span id=p4hemail>' + "Email" + '</span>', '<input id=p4email maxlength=256 autocomplete="email" inputmode="email" onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
10763
+ x += addHtmlValue('<span id=p4hemail>' + "Email" + '</span>', '<input id=p4email type=email maxlength=256 autocomplete="email" inputmode="email" onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
10764
x += addHtmlValue('<span id=p4hp1>' + "Password" + '</span>', '<input id=p4pass1 type=password maxlength=256 autocomplete="new-password" onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
10765
x += addHtmlValue('<span id=p4hp2>' + "Password" + '</span>', '<input id=p4pass2 type=password maxlength=256 autocomplete="new-password" onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
10766
x += '<div><label><input id=p4randomPassword onchange=showCreateNewAccountDialogValidate() type=checkbox />' + "Randomize the password." + '</label></div>';