WebUI: Show 'Rename...' context menu item only when one torrent is selected

'Rename...' item in torrents table menu is displayed only when exactly one torrent is selected.

PR #21843.
This commit is contained in:
skomerko 2024-11-17 08:31:30 +01:00 committed by GitHub
parent f4eec75488
commit e51fcc6ea0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -392,6 +392,7 @@ window.qBittorrent.ContextMenu ??= (() => {
const data = torrentsTable.getRow(selectedRows[0]).full_data; const data = torrentsTable.getRow(selectedRows[0]).full_data;
const metadata_downloaded = !((data["state"] === "metaDL") || (data["state"] === "forcedMetaDL") || (data["total_size"] === -1)); const metadata_downloaded = !((data["state"] === "metaDL") || (data["state"] === "forcedMetaDL") || (data["total_size"] === -1));
this.showItem("rename");
// hide renameFiles when metadata hasn't been downloaded yet // hide renameFiles when metadata hasn't been downloaded yet
metadata_downloaded metadata_downloaded
? this.showItem("renameFiles") ? this.showItem("renameFiles")
@ -399,6 +400,7 @@ window.qBittorrent.ContextMenu ??= (() => {
} }
else { else {
this.hideItem("renameFiles"); this.hideItem("renameFiles");
this.hideItem("rename");
} }
if (all_are_downloaded) { if (all_are_downloaded) {