Skip to content

Commit 05cad49

Browse files
committed
Add pagination to the configuration history page
The configuration history can grow large over time.
1 parent 0a69109 commit 05cad49

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

share/html/Admin/Tools/ConfigHistory.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@
5454
my $Transactions = RT::Transactions->new($session{CurrentUser});
5555
$Transactions->Limit(FIELD => 'ObjectType', VALUE => 'RT::Configuration');
5656
$Transactions->OrderBy(FIELD => 'Created', ORDER => 'DESC');
57+
$Transactions->RowsPerPage($PerPage);
58+
59+
my $TotalFound = $Transactions->CountAll();
60+
my $Pages;
61+
if ( $TotalFound && $TotalFound > $PerPage ) {
62+
$Pages = int( $TotalFound / $PerPage ) + ( $TotalFound % $PerPage ? 1 : 0 );
63+
$Page = $Pages if $Page > $Pages;
64+
}
65+
else {
66+
$Page = 1;
67+
}
68+
$Transactions->GotoPage($Page - 1);
69+
5770
</%INIT>
5871
<& /Admin/Elements/Header, Title => $title &>
5972
<& /Elements/Tabs &>
@@ -73,7 +86,23 @@
7386
RowNum => $i
7487
&>
7588
% $i++;
89+
% }
90+
91+
% if ( $TotalFound > $PerPage ) {
92+
<& /Elements/CollectionListPaging,
93+
BaseURL => '?',
94+
Rows => $PerPage,
95+
TotalFound => $TotalFound,
96+
CurrentPage => $Page,
97+
Pages => $Pages,
98+
URLParams => { map { $_ => $ARGS{$_} } qw/PerPage Page/ },
99+
&>
76100
% }
77101
</div>
78102
</&>
79103
</div>
104+
105+
<%ARGS>
106+
$PerPage => 50
107+
$Page => 1
108+
</%ARGS>

0 commit comments

Comments
 (0)