From 8812650c8b87c89a9227f8eb89c58b73c9723896 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sun, 15 May 2022 10:37:43 +0200 Subject: [PATCH] file browser: only disable button if not downloadable and add hint in tooltip To avoid to much layout jumping if the whole button disappears (changes height of footer bar too), rather explain to the user the why and what they can do instead. Signed-off-by: Thomas Lamprecht --- src/window/FileBrowser.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/window/FileBrowser.js b/src/window/FileBrowser.js index e21e200..495538b 100644 --- a/src/window/FileBrowser.js +++ b/src/window/FileBrowser.js @@ -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); -- 2.39.2