From eb9e98a4b3bcd75a62b81b96f5bc6bd5c80090f2 Mon Sep 17 00:00:00 2001 From: Thomas Piccirello <8296030+Piccirello@users.noreply.github.com> Date: Fri, 29 Mar 2024 00:05:43 -0700 Subject: [PATCH] WebUI: Add support for running concurrent searches This PR adds support for running multiple concurrent searches in the Web UI. This is already supported in the GUI as well as by the Web API. Behavior mimics the GUI as closely as possible. All filters and sorting are preserved per-tab, allowing you to apply unique filters and sorts to each of your searches. Row selection is also preserved across tab navigation. Closes #12840. PR #20593. --- .pre-commit-config.yaml | 2 +- src/webui/www/private/css/style.css | 6 +- src/webui/www/private/scripts/dynamicTable.js | 10 +- src/webui/www/private/views/search.html | 468 ++++++++++++++---- 4 files changed, 387 insertions(+), 99 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a910f1c77..816654ef8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,7 +67,7 @@ repos: hooks: - id: codespell name: Check spelling (codespell) - args: ["--ignore-words-list", "additionals,curren,fo,ist,ket,superseeding,te,ths"] + args: ["--ignore-words-list", "additionals,curren,fo,ist,ket,searchin,superseeding,te,ths"] exclude: | (?x)^( .*\.desktop | diff --git a/src/webui/www/private/css/style.css b/src/webui/www/private/css/style.css index 0805fef60..244d527a6 100644 --- a/src/webui/www/private/css/style.css +++ b/src/webui/www/private/css/style.css @@ -667,9 +667,9 @@ td.statusBarSeparator { } #searchResultsTableContainer { - -moz-height: calc(100% - 140px); - -webkit-height: calc(100% - 140px); - height: calc(100% - 140px); + -moz-height: calc(100% - 177px); + -webkit-height: calc(100% - 177px); + height: calc(100% - 177px); overflow: auto; } diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index d1743f131..9e880b45b 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -516,16 +516,20 @@ window.qBittorrent.DynamicTable = (function() { return LocalPreferences.get('sorted_column_' + this.dynamicTableDivId); }, - setSortedColumn: function(column) { + /** + * @param {string} column name to sort by + * @param {string|null} reverse defaults to implementation-specific behavior when not specified. Should only be passed when restoring previous state. + */ + setSortedColumn: function(column, reverse = null) { if (column != this.sortedColumn) { const oldColumn = this.sortedColumn; this.sortedColumn = column; - this.reverseSort = '0'; + this.reverseSort = reverse ?? '0'; this.setSortedColumnIcon(column, oldColumn, false); } else { // Toggle sort order - this.reverseSort = this.reverseSort === '0' ? '1' : '0'; + this.reverseSort = reverse ?? (this.reverseSort === '0' ? '1' : '0'); this.setSortedColumnIcon(column, null, (this.reverseSort === '1')); } LocalPreferences.set('sorted_column_' + this.dynamicTableDivId, column); diff --git a/src/webui/www/private/views/search.html b/src/webui/www/private/views/search.html index 338274e39..558f96b72 100644 --- a/src/webui/www/private/views/search.html +++ b/src/webui/www/private/views/search.html @@ -18,14 +18,15 @@ width: 150px; } - #searchResultsNoPlugins { + #searchResultsNoPlugins, + #searchResultsNoSearches { height: calc(100% - 110px); - } - #searchResultsNoPlugins table { - height: 100%; - width: 100%; - text-align: center; + table { + height: 100%; + width: 100%; + text-align: center; + } } #searchResultsFilters { @@ -75,9 +76,9 @@
-
-
- +
+
+ @@ -99,7 +100,25 @@
-
+ + + + +