use parent qw(SL::Controller::Base);
+use SL::Controller::Helper::GetModels;
+use SL::Controller::Helper::Sorted;
use SL::DB::BackgroundJobHistory;
use SL::Helper::Flash;
use SL::System::TaskServer;
__PACKAGE__->run_before('add_stylesheet');
__PACKAGE__->run_before('check_task_server');
+__PACKAGE__->make_sorted(
+ DEFAULT_BY => 'run_at',
+ DEFAULT_DIR => 1,
+ MODEL => 'BackgroundJobHistory',
+ FORM_PARAMS => [ qw(sort_by sort_dir) ],
+ ONLY => [ qw(list) ],
+
+ package_name => $::locale->text('Package name'),
+ run_at => $::locale->text('Run at'),
+ status => $::locale->text('Execution status'),
+ result => $::locale->text('Result'),
+ error => $::locale->text('Error'),
+);
+
#
# actions
#
$self->render('background_job_history/list',
title => $::locale->text('Background job history'),
- ENTRIES => SL::DB::Manager::BackgroundJobHistory->get_all_sorted);
+ ENTRIES => $self->get_models);
}
sub action_show {
<table id="background_job_history_list" class="background_job_list" width="100%">
<thead>
<tr class="listheading">
- <th>[%- LxERP.t8('Package name') %]</th>
- <th>[%- LxERP.t8('Run at') %]</th>
- <th>[%- LxERP.t8('Execution status') %]</th>
- <th>[%- LxERP.t8('Result') %]</th>
- <th>[%- LxERP.t8('Error') %]</th>
+ <th>[% L.sortable_table_header('package_name') %]</th>
+ <th>[% L.sortable_table_header('run_at') %]</th>
+ <th>[% L.sortable_table_header('status') %]</th>
+ <th>[% L.sortable_table_header('result') %]</th>
+ <th>[% L.sortable_table_header('error') %]</th>
</tr>
</thead>
[%- FOREACH entry = ENTRIES %]
<tr class="listrow[% loop.count % 2 %]" id="background_job_history_id_[% entry.id %]">
<td>
- <a href="[% SELF.url_for(action => 'show', id => entry.id) %]">
+ <a href="[% SELF.url_for(action => 'show', id => entry.id, back_to => SELF.get_callback) %]">
[%- HTML.escape(entry.package_name) %]
</a>
</td>