[Rt-commit] rt branch 5.0/modify-query-builder-default-results2 created. rt-5.0.3-181-gf1e732e0a6
BPS Git Server
git at git.bestpractical.com
Thu Mar 9 14:10:44 UTC 2023
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-results2 has been created
at f1e732e0a6ae1d505cf970497bea85fb79ec1f64 (commit)
- Log -----------------------------------------------------------------
commit f1e732e0a6ae1d505cf970497bea85fb79ec1f64
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Dec 9 14:16:06 2022 -0500
Remove extra space from div around titlebox
diff --git a/share/html/Search/Elements/DisplayOptions b/share/html/Search/Elements/DisplayOptions
index 63bc2f997a..404f28f6a9 100644
--- a/share/html/Search/Elements/DisplayOptions
+++ b/share/html/Search/Elements/DisplayOptions
@@ -46,13 +46,13 @@
%#
%# END BPS TAGGED BLOCK }}}
<div class="col-xl-5">
-<&| /Widgets/TitleBox, title => loc("Sorting"), id => 'sorting', class => 'h-100' &>
+<&| /Widgets/TitleBox, title => loc("Sorting"), id => 'sorting', class => 'titlebox-outer-div h-100' &>
<& EditSort, %ARGS &>
</&>
</div>
<div class="col-xl-7">
-<&| /Widgets/TitleBox, title => loc("Display Columns"), id => 'columns', class => 'h-100' &>
+<&| /Widgets/TitleBox, title => loc("Display Columns"), id => 'columns', class => 'titlebox-outer-div h-100' &>
<& EditFormat, %ARGS &>
</&>
</div>
diff --git a/share/static/css/elevator-light/boxes.css b/share/static/css/elevator-light/boxes.css
index d2d4f029f7..71bd6b2182 100644
--- a/share/static/css/elevator-light/boxes.css
+++ b/share/static/css/elevator-light/boxes.css
@@ -203,3 +203,8 @@ div.results .titlebox .titlebox-content {
.width-sm {
width: 576px;
}
+
+.titlebox-outer-div {
+ display: flex;
+ flex-direction: column;
+}
commit 7ea73a21be129c0e588940716236874494b7bc75
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Dec 9 13:54:04 2022 -0500
Add information about search preferences
Also align the two boxes with search preferences.
diff --git a/share/html/Prefs/SearchOptions.html b/share/html/Prefs/SearchOptions.html
index 8e74f4850b..ce1582aff8 100644
--- a/share/html/Prefs/SearchOptions.html
+++ b/share/html/Prefs/SearchOptions.html
@@ -48,9 +48,21 @@
<& /Elements/Header, Title => loc("Search Preferences") &>
<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@actions &>
-
+<div class="help" id="rt-help-text">
+<&| /Widgets/TitleBox, title => loc('RT Configuration') &>
+ <p class="mt-3 mb-1 ml-3">
+ <&|/l&>This page allows you to set personal configuration for searches. Settings saved here are loaded by default in the Query Builder for new searches.</&>
+ </p>
+% if ($session{'CurrentUser'}->UserObj->Preferences("SearchDisplay")) {
+ <p class="mt-3 mb-1 ml-3">
+ <&|/l&>Personal settings are current saved for this account. Click below to remove these and restore system defaults.</&>
+ </p>
+% }
+</&>
+</div>
<form method="post" action="SearchOptions.html">
<input type="hidden" class="hidden" name="Format" value="<%$Format%>" />
+<div id="display-options" class="form-row">
<& /Search/Elements/DisplayOptions, %ARGS,
Format=> $Format,
AvailableColumns => $AvailableColumns,
@@ -58,6 +70,7 @@
RowsPerPage => $RowsPerPage,
OrderBy => $OrderBy,
Order => $Order &>
+</div>
<div class="form-row">
<div class="col-12">
<& /Elements/Submit, Name => 'SavePreferences', Label => loc('Save Changes') &>
diff --git a/share/html/Search/Elements/DisplayOptions b/share/html/Search/Elements/DisplayOptions
index 17cbfdda9e..63bc2f997a 100644
--- a/share/html/Search/Elements/DisplayOptions
+++ b/share/html/Search/Elements/DisplayOptions
@@ -46,13 +46,13 @@
%#
%# END BPS TAGGED BLOCK }}}
<div class="col-xl-5">
-<&| /Widgets/TitleBox, title => loc("Sorting"), id => 'sorting' &>
+<&| /Widgets/TitleBox, title => loc("Sorting"), id => 'sorting', class => 'h-100' &>
<& EditSort, %ARGS &>
</&>
</div>
<div class="col-xl-7">
-<&| /Widgets/TitleBox, title => loc("Display Columns"), id => 'columns' &>
+<&| /Widgets/TitleBox, title => loc("Display Columns"), id => 'columns', class => 'h-100' &>
<& EditFormat, %ARGS &>
</&>
</div>
commit 4226277b4510a55e7e65900f20fe48f3a572a164
Author: Jason Crome <jcrome at bestpractical.com>
Date: Mon Sep 26 13:30:44 2022 -0400
Make # of search results per-page configurable
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..041b09bce2 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2241,7 +2241,7 @@ Set($SearchResultsRefreshInterval, 0);
=item C<$DefaultSearchResultFormat>
C<$DefaultSearchResultFormat> is the default format for RT search
-results
+results.
=cut
@@ -2260,6 +2260,24 @@ Set ($DefaultSearchResultFormat, qq{
'<small>__LastUpdatedRelative__</small>',
'<small>__TimeLeft__</small>'});
+=item C<$DefaultSearchResultRowsPerPage>
+
+C<$DefaultSearchResultRowsPerPage> is the default rows per page for
+the dropdown on the Query Builder. The system default is 50, but
+setting to a smaller value can make search results render faster.
+
+=cut
+
+Set( $DefaultSearchResultRowsPerPage, 50 );
+
+=item C<@SearchResultsPerPage>
+
+Defines the options in the Rows per page dropdown on the query builder.
+The "Unlimited" option, which is 0, is included automatically.
+
+=cut
+
+Set(@SearchResultsPerPage, qw(10 25 50 100));
=item C<$UserTicketDataResultFormat>
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index b659fbc291..2740264ca1 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1999,6 +1999,22 @@ our %META;
Widget => '/Widgets/Form/Select',
WidgetArguments => { Values => [qw(ASC DESC)] },
},
+ DefaultSearchResultRowsPerPage => {
+ Widget => '/Widgets/Form/Select',
+ WidgetArguments => {
+ Callback => sub {
+ my @values = RT->Config->Get('SearchResultsPerPage');
+ my %labels = (
+ 0 => "Unlimited", # loc
+ map { $_ => $_ } @values,
+ );
+
+ unshift @values, 0;
+
+ return { Values => \@values, ValuesLabel => \%labels };
+ },
+ },
+ },
LogToSyslog => {
Immutable => 1,
Widget => '/Widgets/Form/Select',
diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
index 187cfd0b80..8c5b7d6b1a 100644
--- a/share/html/Dashboards/Render.html
+++ b/share/html/Dashboards/Render.html
@@ -152,11 +152,11 @@ for my $sub ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')
}
$session{ContextUser} ||= $session{CurrentUser};
-# otherwise honor their search preferences.. otherwise 50 rows
+# otherwise honor their search preferences.. otherwise default search result rows and fall back to 50
# $rows == 0 means unlimited, which we don't want to ignore from above
unless (defined($rows)) {
my $prefs = $session{'ContextUser'}->UserObj->Preferences("SearchDisplay") || {};
- $rows = defined($prefs->{'RowsPerPage'}) ? $prefs->{'RowsPerPage'} : 50;
+ $rows = $prefs->{'RowsPerPage'} // RT->Config->Get('DefaultSearchResultRowsPerPage') // 50;
}
my $title;
diff --git a/share/html/Elements/SelectResultsPerPage b/share/html/Elements/SelectResultsPerPage
index a1757df003..0c0cc0b728 100644
--- a/share/html/Elements/SelectResultsPerPage
+++ b/share/html/Elements/SelectResultsPerPage
@@ -56,13 +56,16 @@
</select>
<%INIT>
-my @values = qw(0 10 25 50 100);
-my @labels = (loc('Unlimited'), qw(10 25 50 100));
-$Default = 50 unless defined $Default && $Default =~ /^\d+$/;
+my @values = RT->Config->Get('SearchResultsPerPage');
+my @labels = (loc('Unlimited'), @values);
+unshift @values, 0;
+
+$Default //= RT->Config->Get('DefaultSearchResultRowsPerPage') // 50;
+unless ( $Default =~ /^\d+$/ ) {
+ RT->Logger->error("RowsPerPage value not a valid number, setting to default");
+}
</%INIT>
<%ARGS>
-
$Name => undef
-$Default => 50
-
+$Default => RT->Config->Get('DefaultSearchResultRowsPerPage') // 50
</%ARGS>
diff --git a/share/html/Prefs/SearchOptions.html b/share/html/Prefs/SearchOptions.html
index 74a39e471e..8e74f4850b 100644
--- a/share/html/Prefs/SearchOptions.html
+++ b/share/html/Prefs/SearchOptions.html
@@ -102,7 +102,7 @@ my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {}
$Format ||= $prefs->{'Format'};
$Order ||= ($prefs->{'Order'} || RT->Config->Get('DefaultSearchResultOrder'));
$OrderBy ||= ($prefs->{'OrderBy'} || RT->Config->Get('DefaultSearchResultOrderBy'));
-($RowsPerPage = defined( $prefs->{'RowsPerPage'} ) ? $prefs->{'RowsPerPage'} : 50) unless defined ($RowsPerPage);
+$RowsPerPage //= $prefs->{'RowsPerPage'} // RT->Config->Get('DefaultSearchResultRowsPerPage') // 50;
my ( $AvailableColumns, $CurrentFormat );
( $Format, $AvailableColumns, $CurrentFormat ) = $m->comp(
diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index 2f3be5f914..a70c189998 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..f87b54cc33 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/Results.html b/share/html/Search/Results.html
index 768b2d5ef6..a1048bae58 100644
--- a/share/html/Search/Results.html
+++ b/share/html/Search/Results.html
@@ -150,15 +150,7 @@ else {
# Some forms pass in "RowsPerPage" rather than "Rows"
# We call it RowsPerPage everywhere else.
-if ( !defined($Rows) ) {
- if (defined $ARGS{'RowsPerPage'} ) {
- $Rows = $ARGS{'RowsPerPage'};
- } elsif ( defined $prefs->{'RowsPerPage'} ) {
- $Rows = $prefs->{'RowsPerPage'};
- } else {
- $Rows = 50;
- }
-}
+$Rows //= $ARGS{'RowsPerPage'} // $prefs->{'RowsPerPage'} // RT->Config->Get('DefaultSearchResultRowsPerPage') // 50;
$Page = 1 unless $Page && $Page > 0;
my $hash_name = join '-', 'CurrentSearchHash', $Class, $ObjectType || ();
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list