WebUI: Allow to filter torrent list by save path

This PR adds ability to filter torrent list by save path. Everything should work exactly like in GUI.

Closes #19393.
PR #21175.
This commit is contained in:
skomerko 2024-08-11 10:08:13 +02:00 committed by GitHub
parent ea06eb9fe6
commit 04eb40376e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 6 deletions

View file

@ -1357,7 +1357,6 @@ window.qBittorrent.DynamicTable ??= (() => {
applyFilter: function(row, filterName, categoryHash, tagHash, trackerHash, filterTerms) {
const state = row["full_data"].state;
const name = row["full_data"].name.toLowerCase();
let inactive = false;
switch (filterName) {
@ -1487,12 +1486,14 @@ window.qBittorrent.DynamicTable ??= (() => {
}
if ((filterTerms !== undefined) && (filterTerms !== null)) {
const filterBy = document.getElementById("torrentsFilterSelect").value;
const textToSearch = row["full_data"][filterBy].toLowerCase();
if (filterTerms instanceof RegExp) {
if (!filterTerms.test(name))
if (!filterTerms.test(textToSearch))
return false;
}
else {
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(name, filterTerms))
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(textToSearch, filterTerms))
return false;
}
}