From 332f4cb0934ae66c52dbd068a6920dc035a7dee5 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 25 Aug 2025 11:34:03 +0000 Subject: [PATCH] Bug 41135: Convert About page Perl module table to DataTable This patch updates the display of Perl modules on the About page, showing them in a regular DataTable instead of a multi-column one. This allows for sorting, filtering by required or missing, and searching. To test, apply the patch and restart services. - Go to the About page and click the "Perl modules" tab. - The Perl modules should be displayed in a DataTable. - Required modules are still shown in bold but now there is a column of with check marks for required modules so that you can sort or filter by required. - Test the "Show required" link at the top of the table and confirm that only required modules are shown. - To test the display of Missing modules, uninstall at least one required module and at least one optional one, e.g.: > sudo dpkg --remove --force-depends libtest-mockmodule-perl libtest-mocktime-perl - Restart services and return to the About page Perl modules list. Use the table filter form to search for "mock." - You should see the required module, Test::MockModule, with the status in red, "Required module missing." - The optional module, Test::MockTime, should have a yellow warning "Optional module missing." - Clear the search form and click the "Show missing" link. The table should be filtered down to only those modules you removed. Sponsored-by: Athens County Public Libraries --- about.pl | 24 +--- .../intranet-tmpl/prog/en/modules/about.tt | 134 +++++++++++++----- 2 files changed, 97 insertions(+), 61 deletions(-) diff --git a/about.pl b/about.pl index 45a435894f6..86080fa6d5a 100755 --- a/about.pl +++ b/about.pl @@ -654,29 +654,7 @@ if ( $tab eq 'perl' ) { @components = sort { $a->{'name'} cmp $b->{'name'} } @components; - my $counter = 0; - my $row = []; - my $table = []; - foreach (@components) { - push( @$row, $_ ); - unless ( ++$counter % 4 ) { - push( @$table, { row => $row } ); - $row = []; - } - } - - # Processing the last line (if there are any modules left) - if ( scalar(@$row) > 0 ) { - - # Extending $row to the table size - $$row[3] = ''; - - # Pushing the last line - push( @$table, { row => $row } ); - } - ## ## $table - - $template->param( table => $table ); + $template->param( table => \@components ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 7d8e3d4bdad..956a6e07a7d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -17,6 +17,12 @@ .version-ellipsis { text-decoration: underline; } + #dt-info { + display: flex; + } + .filter_controls { + margin-top: 0.25em; + } @@ -85,6 +91,39 @@ +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] [% BLOCK about_panel %] @@ -275,51 +314,70 @@ [% BLOCK perl_panel %] [% WRAPPER tab_panel tabname= "perl" bt_active = 1 %] - - - [% FOREACH line IN table %] +

Perl modules

+
Perl modules
+ + - [% FOREACH ro IN line.row %] - [% IF ( ro.require ) %] - [% SET th_font_weight = "bold" %] + + + + + + + + + [% FOREACH line IN table %] + + + [% IF ( line.require ) %] + [% ELSE %] - [% SET th_font_weight = "normal" %] + [% END %] - [% IF ( ro.current ) %] - [% SET th_background_color = "" %] - [% SET th_title = t("Module current") %] - [% ELSIF ( ro.upgrade ) %] - [% SET th_background_color = "#FFCB2F" %] - [% SET th_title = t("Module upgrade needed") %] - [% ELSE %] - [% IF ( ro.require ) %] - [% SET th_background_color = "#FF8A8A" %] - [% SET th_title = t("Required module missing") %] - [% ELSIF ( ro.name != '' ) %] - [% SET th_background_color = "#FF8A8A" %] - [% SET th_title = t("Optional module missing") %] - [% END %] - [% END # /IF ro.current %] - - [% IF ( ro.name == '' ) %] + + [% IF ( line.name == '' ) %] - [% ELSIF ( ro.version ) %] - + [% ELSIF ( line.version ) %] + [% ELSE %] [% END %] - [% END # /FOREACH ro %] - - [% END # /FOREACH line %] + + + + [% END %] +
Perl modules
ModuleRequiredCurrent versionMinimum versionStatus
+ [% IF ( line.require ) %] + [% line.name | html %] + [% ELSE %] + [% line.name | html %] + [% END %] + + + - [% IF ( ro.name ) %] - [% ro.name | html %] - - ([% ro.reqversion | html %] - [% IF ro.maxversion %]- [% ro.maxversion | html %][% END %] - [% IF ro.excversion %][% FOR v IN ro.excversion %], ![% v | html %][% END %][% END %]) - - [% END %] - [% ro.version | html %][% line.version | html %]Not Installed
+ + [% line.reqversion | html %] + [% IF line.maxversion %]- [% line.maxversion | html %][% END %] + [% IF line.excversion %] + [% FOR v IN line.excversion %] + , ![% v | html %] + [% END %] + [% END %] + + + [% IF ( line.current ) %] + Module current + [% ELSIF ( line.upgrade ) %] + Module upgrade needed + [% ELSE %] + [% IF ( line.require ) %] + Required module missing + [% ELSIF ( line.name != '' ) %] + Optional module missing + [% END %] + [% END # /IF line.current %] +
[% END # tab=perl %] [% END %] -- 2.39.5