[Rt-commit] rt branch, 4.4/searching-retain-row-limit, created. rt-4.4.4-1-g2ca905bed6
Craig Kaiser
craig at bestpractical.com
Wed Jun 17 08:12:56 EDT 2020
The branch, 4.4/searching-retain-row-limit has been created
at 2ca905bed602448e4eacd33283997c957c36a003 (commit)
- Log -----------------------------------------------------------------
commit 2ca905bed602448e4eacd33283997c957c36a003
Author: craig kaiser <craig at bestpractical.com>
Date: Mon Jun 15 12:25:05 2020 -0400
Add default rows per page for search results from saved chart
The saved chart attribute does not save a rows per page value, resulting
in no value being provided on saved chart load. That means the search
results page will show unlimited rows which can end lead to timeouts if
the query returns a large dataset.
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 755c8d219e..8d16f6c42c 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -933,13 +933,12 @@ my $build_main_nav = sub {
),
);
+ my %final_query_args = ();
+ # key => callback to avoid unnecessary work
if ($QueryString) {
$args = '?' . $QueryString;
}
else {
- my %final_query_args = ();
- # key => callback to avoid unnecessary work
-
for my $param (keys %fallback_query_args) {
$final_query_args{$param} = defined($QueryArgs->{$param})
? $QueryArgs->{$param}
@@ -973,6 +972,16 @@ my $build_main_nav = sub {
$current_search_menu->child( advanced =>
title => loc('Advanced'), path => "/Search/Edit.html$args" );
if ($has_query) {
+ # If we load a saved chart we need to set a default RowsPerPage value
+ # or else when going to the results page from the saved chart the results
+ # set will have no pagination and be unlimited.
+ # We use 50 as the default value as it is the default value on the query builder page.
+ if ( $request_path =~ m{^/Search/Chart.html} && $final_query_args{'SavedChartSearchId'} ) {
+ unless ( defined $final_query_args{'RowsPerPage'} ) {
+ $args =~ s/RowsPerPage=/RowsPerPage=50/;
+ }
+ }
+
$current_search_menu->child( results => title => loc('Show Results'), path => "/Search/Results.html$args" );
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list