From eb8a79542ea68777b50b160c0bbf770573b8304a Mon Sep 17 00:00:00 2001 From: TRIGUBF Date: Fri, 25 Aug 2023 11:35:23 +0200 Subject: [PATCH] use download helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../DryRunResults/DryRunResultsList.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/plugins/scaffolder/src/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx b/plugins/scaffolder/src/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx index 384d48e871..0d9fcbc350 100644 --- a/plugins/scaffolder/src/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx +++ b/plugins/scaffolder/src/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx @@ -28,6 +28,7 @@ import DeleteIcon from '@material-ui/icons/Delete'; import DownloadIcon from '@material-ui/icons/GetApp'; import React from 'react'; import { DryRunResult, useDryRun } from '../DryRunContext'; +import { downloadBlob } from '../../../lib/download'; const useStyles = makeStyles((theme: BackstageTheme) => ({ root: { @@ -117,14 +118,3 @@ async function createZipDownload(directoryContents: { path: string; base64Conten throw new Error(err); }); } - - - -function downloadBlob(blob: Blob, name: string) { - const a = document.createElement('a'); - a.href = URL.createObjectURL(blob); - a.download = name; - a.click(); - URL.revokeObjectURL(a.href); - a.remove(); -}