Add export as csv in tasks and workflow runs (#1361)

This commit is contained in:
Shuchang Zheng
2024-12-09 07:49:42 -08:00
committed by GitHub
parent 3e480ddc62
commit 83481126db
4 changed files with 351 additions and 250 deletions

View File

@@ -0,0 +1,21 @@
/**
* Download contents as a file
* Source: https://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side
*/
function downloadBlob(content: string, filename: string, contentType: string) {
// Create a blob
const blob = new Blob([content], { type: contentType });
const url = URL.createObjectURL(blob);
// Create a link to download it
const element = document.createElement("a");
element.href = url;
element.setAttribute("download", filename);
element.style.display = "none";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
URL.revokeObjectURL(url);
}
export { downloadBlob };