[pbs-devel] [PATCH proxmox-widget-toolkit 1/2] FileBrowser: allow downloading root folder and simplify code

Stefan Reiter s.reiter at proxmox.com
Mon Apr 12 17:32:51 CEST 2021


Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

Smoke tested by downloading an entire container archive as zip, extracting and
checking the files. If there was a reason for this to be disabled let me know.

Based on my previous series to move the FileBrowser to the widget toolkit:
https://lists.proxmox.com/pipermail/pbs-devel/2021-April/002590.html

Depends on the proxmox-backup patch to work correctly.

 src/window/FileBrowser.js | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/src/window/FileBrowser.js b/src/window/FileBrowser.js
index d8e75f4..7d82b01 100644
--- a/src/window/FileBrowser.js
+++ b/src/window/FileBrowser.js
@@ -98,23 +98,7 @@ Ext.define("Proxmox.window.FileBrowser", {
 	    if (!selection || selection.length < 1) return;
 
 	    let data = selection[0].data;
-
-	    let canDownload = false;
-	    if (view.downloadUrl) {
-		switch (data.type) {
-		    case 'h':
-		    case 'f':
-			canDownload = true;
-			break;
-		    case 'd':
-			if (data.depth > 1) {
-			    canDownload = true;
-			}
-			break;
-		    default: break;
-		}
-	    }
-
+	    let canDownload = view.downloadUrl && ['h', 'f', 'd'].indexOf(data.type) !== -1;
 	    me.lookup('downloadBtn').setDisabled(!canDownload);
 	},
 
-- 
2.20.1






More information about the pbs-devel mailing list