WebUI: Clear properties panel when torrent no longer selected

PR #21654.
This commit is contained in:
Thomas Piccirello 2024-10-27 22:53:24 -07:00 committed by GitHub
commit c3c91be578
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 61 additions and 10 deletions

View file

@ -229,32 +229,63 @@ window.addEventListener("DOMContentLoaded", () => {
buildLogTab();
MochaUI.initializeTabs("mainWindowTabsList");
const handleFilterSelectionChange = function(prevSelectedTorrent, currSelectedTorrent) {
// clear properties panels when filter changes (e.g. selected torrent is no longer visible)
if (prevSelectedTorrent !== currSelectedTorrent) {
window.qBittorrent.PropGeneral.clear();
window.qBittorrent.PropTrackers.clear();
window.qBittorrent.PropPeers.clear();
window.qBittorrent.PropWebseeds.clear();
window.qBittorrent.PropFiles.clear();
}
};
setStatusFilter = function(name) {
const currentHash = torrentsTable.getCurrentTorrentID();
LocalPreferences.set("selected_filter", name);
selectedStatus = name;
highlightSelectedStatus();
updateMainData();
const newHash = torrentsTable.getCurrentTorrentID();
handleFilterSelectionChange(currentHash, newHash);
};
setCategoryFilter = function(hash) {
const currentHash = torrentsTable.getCurrentTorrentID();
LocalPreferences.set("selected_category", hash);
selectedCategory = Number(hash);
highlightSelectedCategory();
updateMainData();
const newHash = torrentsTable.getCurrentTorrentID();
handleFilterSelectionChange(currentHash, newHash);
};
setTagFilter = function(hash) {
const currentHash = torrentsTable.getCurrentTorrentID();
LocalPreferences.set("selected_tag", hash);
selectedTag = Number(hash);
highlightSelectedTag();
updateMainData();
const newHash = torrentsTable.getCurrentTorrentID();
handleFilterSelectionChange(currentHash, newHash);
};
setTrackerFilter = function(hash) {
const currentHash = torrentsTable.getCurrentTorrentID();
LocalPreferences.set("selected_tracker", hash);
selectedTracker = Number(hash);
highlightSelectedTracker();
updateMainData();
const newHash = torrentsTable.getCurrentTorrentID();
handleFilterSelectionChange(currentHash, newHash);
};
toggleFilterDisplay = function(filterListID) {