diff --git a/Koha/BackgroundJob/TestTransport.pm b/Koha/BackgroundJob/TestTransport.pm index 72e67314e7..54b5b720bb 100644 --- a/Koha/BackgroundJob/TestTransport.pm +++ b/Koha/BackgroundJob/TestTransport.pm @@ -53,7 +53,10 @@ sub process { my $transport = Koha::File::Transports->find( $args->{transport_id} ); $transport->test_connection; - my $status = { status => 'ok' }; + my $status = { + status => 'ok', transport_id => $transport->id, transport_name => $transport->name, + background_job_id => $self->id + }; my $messages = $transport->object_messages; for my $message (@$messages) { $status->{status} = 'errors' if $message->{type} eq 'error'; diff --git a/Koha/File/Transport/FTP.pm b/Koha/File/Transport/FTP.pm index 6a5e775f63..b045977954 100644 --- a/Koha/File/Transport/FTP.pm +++ b/Koha/File/Transport/FTP.pm @@ -157,7 +157,7 @@ sub _change_directory { my ( $self, $remote_directory ) = @_; my $operation = "change_directory"; - $self->{connection}->cwd($remote_directory) or return $self->_abort_operation($operation); + $self->{connection}->cwd($remote_directory) or return $self->_abort_operation( $operation, $remote_directory ); $self->add_message( { @@ -396,15 +396,16 @@ C_abort_operation($operation)> on failure. =cut sub _abort_operation { - my ( $self, $operation ) = @_; + my ( $self, $operation, $operation_params ) = @_; $self->add_message( { message => $operation || 'operation', type => 'error', payload => { - detail => $self->{connection} ? $self->{connection}->status : '', - error => $self->{connection} ? $self->{connection}->message : $@ + detail => $self->{connection} ? $self->{connection}->status : '', + error => $self->{connection} ? $self->{connection}->message : $@, + operation_params => $operation_params } } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/file_transport_test.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/file_transport_test.inc index 02940554f0..4ed7f7beaa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/file_transport_test.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/file_transport_test.inc @@ -3,29 +3,30 @@ [%- BLOCK operation_description -%] [%- SWITCH operation.code -%] + [%- IF operation.error %][% SET status = " failed. " %][% ELSE %][% SET status = " passed. " %][% END -%] [%- CASE 'connection' -%] - Connection + Connection[% status | html %] [%- CASE 'upload' -%] - Upload + Upload[% status | html %] [%- CASE 'download' -%] - Download + Download[% status | html %] [%- CASE 'list' -%] - List files + List files[% status | html %] [%- CASE 'change_directory' -%] - Change directory + Change directory ([% operation.detail.directory | html %][% operation.detail.operation_params | html %])[% status | html %] [%- CASE -%] - [% operation.code | html %] + [% operation.code | html %][% status | html %] [%- END -%] [%- END -%] [% SET report = job.decoded_data %] [% BLOCK report %] [% IF job.status == 'finished' %] - [% IF report.status == 'errors' %] -
Connection test completed with errors
- [% ELSE %] -
Connection test completed without errors
- [% END %] + [%- IF report.status == 'errors' -%] +
Connection test for [% report.transport_name | html %]([% report.transport_id | html %]) completed with errors
+ [%- ELSE -%] +
Connection test for [% report.transport_name | html %]([% report.transport_id | html %]) completed without errors
+ [%- END -%] [% ELSIF job.status == 'cancelled' %] The connection test was cancelled before it finished. [% END %] @@ -34,9 +35,12 @@ [% BLOCK detail %] [% FOREACH operation IN report.operations %] [% IF operation.status == 'error' %] -
[% PROCESS operation_description %] failed.
+
+ [% PROCESS operation_description %] + [%- IF operation.detail.error %]- error:[% operation.detail.error | html %][% END -%]
[% ELSE %] -
[% PROCESS operation_description %] passed.
+
[% PROCESS operation_description %]
[% END %] [% END %] [% IF job.status == 'cancelled' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt index 6dab8dbcb3..f7e914709b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/file_transports.tt @@ -567,10 +567,10 @@ let render = ""; if (data) { if (data.status == "ok") { - render += ' '; + render += '
'; render += ''; render += _("Tests passing"); - render += ""; + render += "
"; } else if (data.status == "errors") { data.operations.forEach(operation => { render += "
"; @@ -590,10 +590,14 @@ render += "
"; }); } else { - render += "" + _("Never used") + ""; + render += "" + _("No test results stored") + ""; + } + if (data.background_job_id) { + render += ' '; + render += '' + _("Test job details") + ""; } } else { - render += "" + _("Never used") + ""; + render += "" + _("No test results stored") + ""; } return render; },