]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - src/window/FileBrowser.js
file browser: only disable button if not downloadable and add hint in tooltip
[proxmox-widget-toolkit.git] / src / window / FileBrowser.js
index e21e2005d935907dcfe080752b71615cac1f2add..495538b6834dc0034602352920731e7fc6c7f35a 100644 (file)
@@ -130,7 +130,16 @@ Ext.define("Proxmox.window.FileBrowser", {
 
            let downloadBtn = view.lookup('downloadBtn');
            downloadBtn.setDisabled(!canDownload || enableMenu);
-           downloadBtn.setHidden(!canDownload || enableMenu);
+           downloadBtn.setHidden(canDownload && enableMenu);
+           let typeLabel = Proxmox.Schema.pxarFileTypes[data.type]?.label ?? Proxmox.Utils.unknownText;
+           let ttip = Ext.String.format(
+               gettext('File of type {0} cannot be downloaded directly, download a parent directory instead.'),
+               typeLabel,
+           );
+           if (!canDownload) { // ensure tooltip gets shown
+               downloadBtn.setStyle({ pointerEvents: 'all' });
+           }
+           downloadBtn.setTooltip(canDownload ? null : ttip);
 
            let menuBtn = view.lookup('menuBtn');
            menuBtn.setDisabled(!canDownload || !enableMenu);