[pve-devel] [PATCH pmg-gui 1/1] Replaced the system-report file download implementation

Daniel Tschlatscher d.tschlatscher at proxmox.com
Tue Apr 26 14:35:42 CEST 2022


with the newly added downloadStringAsFile() function in the proxmox-
widget-toolkit repository in the Utils class (Proxmox.Utils).

Signed-off-by: Daniel Tschlatscher <d.tschlatscher at proxmox.com>
---
 js/Subscription.js | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/js/Subscription.js b/js/Subscription.js
index 8d3bc80..16c4c82 100644
--- a/js/Subscription.js
+++ b/js/Subscription.js
@@ -62,19 +62,7 @@ Ext.define('PMG.Subscription', {
 			let fileContent = Ext.String.htmlDecode(reportWindow.getComponent('system-report-view').html);
 			let fileName = getReportFileName();
 
-			// Internet Explorer
-			if (window.navigator.msSaveOrOpenBlob) {
-			    navigator.msSaveOrOpenBlob(new Blob([fileContent]), fileName);
-			} else {
-			    let element = document.createElement('a');
-			    element.setAttribute('href', 'data:text/plain;charset=utf-8,'
-			      + encodeURIComponent(fileContent));
-			    element.setAttribute('download', fileName);
-			    element.style.display = 'none';
-			    document.body.appendChild(element);
-			    element.click();
-			    document.body.removeChild(element);
-			}
+			Proxmox.Utils.downloadStringAsFile(fileContent, fileName);
 		    },
 		},
 	    ],
-- 
2.30.2






More information about the pve-devel mailing list