[Rt-commit] rt branch 5.0/modify-query-builder-default-results created. rt-5.0.3-124-gb88a8611d7

BPS Git Server git at git.bestpractical.com
Fri Oct 7 14:52:25 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/modify-query-builder-default-results has been created
        at  b88a8611d7266e59da9c66700519da84938b5be2 (commit)

- Log -----------------------------------------------------------------
commit b88a8611d7266e59da9c66700519da84938b5be2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 7 22:46:39 2022 +0800

    Add ModifyDefaultArguments callback for query builder
    
    This is to ease the customization of default search arguments including
    RowsPerPage, Order, OrderBy, etc.

diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index aa021b5ad6..67cfe860e3 100644
--- a/share/html/Search/Build.html
+++ b/share/html/Search/Build.html
@@ -206,6 +206,8 @@ if ( $NewQuery ) {
         RowsPerPage => RT->Config->Get('DefaultSearchResultRowsPerPage') || 50,
     };
 
+    $m->callback(CallbackName => 'ModifyDefaultArguments', DefaultArguments => $default, ARGSRef => \%ARGS );
+
     for( qw(Query Format OrderBy Order RowsPerPage ObjectType) ) {
         $query{$_} = $current->{$_} unless defined $query{$_};
         if ( $prefs ) {

commit dde1e7371078f38626efdde0dc31b9f779d867bf
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Mon Sep 26 13:30:44 2022 -0400

    Add DefaultSearchResultRowsPerPage config to customize RowsPerPage for searches
    
    On larger databases with many tickets and lots of custom roles,
    displaying a page of 50 search results may become slow. Adjusting the
    number of rows of search results per page can result in better
    performance in these cases.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index bd9c001d28..ca1acad0c6 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2260,6 +2260,14 @@ Set ($DefaultSearchResultFormat, qq{
    '<small>__LastUpdatedRelative__</small>',
    '<small>__TimeLeft__</small>'});
 
+=item C<$DefaultSearchResultRowsPerPage>
+
+C<$DefaultSearchResultRowsPerPage> is the default rows per page for RT
+search results
+
+=cut
+
+Set( $DefaultSearchResultRowsPerPage, 50 );
 
 =item C<$UserTicketDataResultFormat>
 
diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index 2f3be5f914..aa021b5ad6 100644
--- a/share/html/Search/Build.html
+++ b/share/html/Search/Build.html
@@ -203,7 +203,7 @@ if ( $NewQuery ) {
         OrderBy => $orderby{$Class},
         Order => $order{$Class},
         ObjectType  => $ObjectType,
-        RowsPerPage => 50
+        RowsPerPage => RT->Config->Get('DefaultSearchResultRowsPerPage') || 50,
     };
 
     for( qw(Query Format OrderBy Order RowsPerPage ObjectType) ) {
diff --git a/share/html/Search/Edit.html b/share/html/Search/Edit.html
index a46bfb737e..fd8dc52499 100644
--- a/share/html/Search/Edit.html
+++ b/share/html/Search/Edit.html
@@ -109,7 +109,7 @@ $SavedSearchId => 'new'
 $SavedChartSearchId => 'new'
 $Query         => ''
 $Format        => ''
-$Rows          => '50'
+$Rows          => RT->Config->Get('DefaultSearchResultRowsPerPage') || 50
 $Order         => 'ASC'
 $Class         => 'RT::Tickets'
 $OrderBy       => $Class eq 'RT::Assets' ? 'Name' : 'id'
diff --git a/share/html/Search/Elements/EditSearches b/share/html/Search/Elements/EditSearches
index 6871e702bb..d676a6cbc5 100644
--- a/share/html/Search/Elements/EditSearches
+++ b/share/html/Search/Elements/EditSearches
@@ -431,8 +431,9 @@ return @results;
 
 <%METHOD GetDependedOnByList>
 
+% my $rows_per_page = RT->Config->Get('DefaultSearchResultRowsPerPage') || 50;
 % my $links = $Object->DependedOnBy;
-% $links->RowsPerPage(50);
+% $links->RowsPerPage( $rows_per_page );
 % my $total = $links->CountAll;
   <p>
     <&|/l, $total &>This search is used in the following [quant,_1,dashboard,dashboards]</&>:
@@ -448,7 +449,7 @@ return @results;
     </li>
 % }
 
-% if ( $total > 50 ) {
+% if ( $total > $rows_per_page ) {
     <li class="list-group-item">...</li>
 % }
   </ul>
diff --git a/share/html/Search/Results.html b/share/html/Search/Results.html
index e0de84d99f..ec68d57664 100644
--- a/share/html/Search/Results.html
+++ b/share/html/Search/Results.html
@@ -156,7 +156,7 @@ if ( !defined($Rows) ) {
     } elsif ( defined $prefs->{'RowsPerPage'} ) {
         $Rows = $prefs->{'RowsPerPage'};
     } else {
-        $Rows = 50;
+        $Rows = RT->Config->Get('DefaultSearchResultRowsPerPage') || 50;
     }
 }
 $Page = 1 unless $Page && $Page > 0;

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list