[Rt-commit] rt branch, 4.4/searching-retain-row-limit, created. rt-4.4.4-1-gb47b413913

Craig Kaiser craig at bestpractical.com
Mon Jun 15 13:23:53 EDT 2020


The branch, 4.4/searching-retain-row-limit has been created
        at  b47b4139137cf71ba6cb2de617538b1f630ade16 (commit)

- Log -----------------------------------------------------------------
commit b47b4139137cf71ba6cb2de617538b1f630ade16
Author: craig kaiser <craig at bestpractical.com>
Date:   Mon Jun 15 12:25:05 2020 -0400

    Add default rows per page for 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..e481d5fbc2 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,13 @@ 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 want to have a default sensible rows per page value
+            if ( $request_path =~ m{^/Search/Chart.html} && $final_query_args{'SavedChartSearchId'} ) {
+                unless ( defined $final_query_args{'RowsPerPage'} ) {
+                    $args =~ s/RowsPerPage=/RowsPerPage=10/;
+                }
+            }
+
             $current_search_menu->child( results => title => loc('Show Results'), path => "/Search/Results.html$args" );
         }
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list