Bug 38385: Improve DB update output on error (UI)

When an error occurred during the DB update the UI is not correct.

1. say_success, say_info, etc. show the span tags and are not colored
2. "Everything went okay" shown even if atomic updates failed
3. The same error can be displayed several time (see https://snipboard.io/IGiKgM.jpg)

Test plan:
Create a new db rev and/or atomic update
Have some say_* statement to render messages, and raise an error

For instance:
    say_info( $out, "Use blue for further information" );

    try {
        say_warning( $out, "Use yellow for warning/a call to action" );
        $dbh->do(q{});
    } catch {
        say_failure( $out, "Use red for danger/failure" );
        $_->rethrow;
    };

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0ab32306ee)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2024-11-07 11:33:03 +01:00 committed by Lucas Gass
parent fabcb433d7
commit 650ef902d4
1 changed files with 17 additions and 19 deletions

View File

@ -419,16 +419,15 @@
<ul>
[% FOR e IN error %]
[% FOR o IN e.output %]
<li class="update_error">
[% o | html %]
<br/>
ERROR: [% e.error | $raw %]
[% IF e.output.size > 1 %]
[% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %]
[% END %]
</li>
[% o | $raw %]
<br/>
[% IF e.output.size > 1 %]
[% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %]
[% END %]
[% END %]
<li class="update_error">
ERROR: [% e.error | $raw %]
</li>
[% END %]
</ul>
[% END %]
@ -439,21 +438,20 @@
<ul>
[% FOR e IN atomic_updates.error %]
[% FOR o IN e.output %]
<li class="update_error">
[% o | html %]
<br/>
ERROR: [% e.error | $raw %]
[% IF e.output.size > 1 %]
[% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %]
[% END %]
</li>
[% o | $raw %]
<br/>
[% IF e.output.size > 1 %]
[% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %]
[% END %]
[% END %]
<li class="update_error">
ERROR: [% e.error | $raw %]
</li>
[% END %]
</ul>
[% END %]
[% UNLESS error OR has_update_errors %]
[% UNLESS error OR atomic_updates.error OR has_update_errors %]
<p>Everything went okay. Update done.</p>
<p><a href="install.pl?step=3&amp;op=finished" class="btn btn-primary">Continue to log in to Koha</a></p>
[% ELSE %]