FileBrowser: allow downloading root folder and simplify code

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
Stefan Reiter 2021-04-12 17:32:51 +02:00 committed by Thomas Lamprecht
parent 68b29adede
commit 2a778ef98c

View File

@ -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);
},