mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-24 18:26:11 +03:00
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:
parent
ea06eb9fe6
commit
04eb40376e
4 changed files with 15 additions and 6 deletions
|
@ -449,6 +449,10 @@ a.propButton img {
|
||||||
width: 26px;
|
width: 26px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#torrentsFilterSelect {
|
||||||
|
padding: 2px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
#torrentFilesFilterToolbar {
|
#torrentFilesFilterToolbar {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 30px;
|
margin-right: 30px;
|
||||||
|
|
|
@ -133,6 +133,11 @@
|
||||||
<input type="text" id="torrentsFilterInput" placeholder="QBT_TR(Filter torrent list...)QBT_TR[CONTEXT=MainWindow]" aria-label="QBT_TR(Filter torrent list...)QBT_TR[CONTEXT=MainWindow]" autocorrect="off" autocapitalize="none">
|
<input type="text" id="torrentsFilterInput" placeholder="QBT_TR(Filter torrent list...)QBT_TR[CONTEXT=MainWindow]" aria-label="QBT_TR(Filter torrent list...)QBT_TR[CONTEXT=MainWindow]" autocorrect="off" autocapitalize="none">
|
||||||
<input type="checkbox" id="torrentsFilterRegexBox">
|
<input type="checkbox" id="torrentsFilterRegexBox">
|
||||||
<label for="torrentsFilterRegexBox" aria-label="QBT_TR(Use regular expressions)QBT_TR[CONTEXT=MainWindow]"></label>
|
<label for="torrentsFilterRegexBox" aria-label="QBT_TR(Use regular expressions)QBT_TR[CONTEXT=MainWindow]"></label>
|
||||||
|
<label for="torrentsFilterSelect">QBT_TR(Filter by:)QBT_TR[CONTEXT=MainWindow]</label>
|
||||||
|
<select id="torrentsFilterSelect">
|
||||||
|
<option value="name" selected>QBT_TR(Name)QBT_TR[CONTEXT=MainWindow]</option>
|
||||||
|
<option value="save_path">QBT_TR(Save Path)QBT_TR[CONTEXT=MainWindow]</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1563,9 +1563,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
torrentsTable.updateTable();
|
torrentsTable.updateTable();
|
||||||
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
|
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
|
||||||
});
|
});
|
||||||
$("torrentsFilterRegexBox").addEventListener("change", () => {
|
|
||||||
torrentsTable.updateTable();
|
document.getElementById("torrentsFilterToolbar").addEventListener("change", (e) => { torrentsTable.updateTable(); });
|
||||||
});
|
|
||||||
|
|
||||||
$("transfersTabLink").addEventListener("click", showTransfersTab);
|
$("transfersTabLink").addEventListener("click", showTransfersTab);
|
||||||
$("searchTabLink").addEventListener("click", showSearchTab);
|
$("searchTabLink").addEventListener("click", showSearchTab);
|
||||||
|
|
|
@ -1357,7 +1357,6 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
|
|
||||||
applyFilter: function(row, filterName, categoryHash, tagHash, trackerHash, filterTerms) {
|
applyFilter: function(row, filterName, categoryHash, tagHash, trackerHash, filterTerms) {
|
||||||
const state = row["full_data"].state;
|
const state = row["full_data"].state;
|
||||||
const name = row["full_data"].name.toLowerCase();
|
|
||||||
let inactive = false;
|
let inactive = false;
|
||||||
|
|
||||||
switch (filterName) {
|
switch (filterName) {
|
||||||
|
@ -1487,12 +1486,14 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((filterTerms !== undefined) && (filterTerms !== null)) {
|
if ((filterTerms !== undefined) && (filterTerms !== null)) {
|
||||||
|
const filterBy = document.getElementById("torrentsFilterSelect").value;
|
||||||
|
const textToSearch = row["full_data"][filterBy].toLowerCase();
|
||||||
if (filterTerms instanceof RegExp) {
|
if (filterTerms instanceof RegExp) {
|
||||||
if (!filterTerms.test(name))
|
if (!filterTerms.test(textToSearch))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(name, filterTerms))
|
if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(textToSearch, filterTerms))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue