-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (19 loc) · 740 Bytes
/
script.js
File metadata and controls
23 lines (19 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.getElementById('export-btn').addEventListener('click', () => {
if (logs.length === 0) {
alert("No logs available to export.");
return;
}
// Prepare CSV content
let csvContent = "data:text/csv;charset=utf-8,Event ID,Timestamp,Status\n";
logs.forEach((log, index) => {
csvContent += `${index + 1},${log.time},REACTIVE_SUCCESS\n`;
});
// Create a virtual download link
const encodedUri = encodeURI(csvContent);
const link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "system_logs.csv");
document.body.appendChild(link);
link.click(); // Trigger the download
document.body.removeChild(link);
});