mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-29 20:43:29 +00:00
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 <t.lamprecht@proxmox.com>
This commit is contained in:
parent
9aa3d15708
commit
8812650c8b
@ -130,7 +130,16 @@ Ext.define("Proxmox.window.FileBrowser", {
|
|||||||
|
|
||||||
let downloadBtn = view.lookup('downloadBtn');
|
let downloadBtn = view.lookup('downloadBtn');
|
||||||
downloadBtn.setDisabled(!canDownload || enableMenu);
|
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');
|
let menuBtn = view.lookup('menuBtn');
|
||||||
menuBtn.setDisabled(!canDownload || !enableMenu);
|
menuBtn.setDisabled(!canDownload || !enableMenu);
|
||||||
|
Loading…
Reference in New Issue
Block a user