1 package SL::Controller::BackgroundJobHistory;
5 use parent qw(SL::Controller::Base);
7 use SL::Controller::Helper::GetModels;
8 use SL::Controller::Helper::Paginated;
9 use SL::Controller::Helper::Sorted;
10 use SL::DB::BackgroundJobHistory;
11 use SL::Helper::Flash;
12 use SL::Locale::String;
13 use SL::System::TaskServer;
15 use Rose::Object::MakeMethods::Generic
17 scalar => [ qw(history) ],
18 'scalar --get_set_init' => [ qw(task_server) ],
21 __PACKAGE__->run_before('check_auth');
22 __PACKAGE__->run_before('add_stylesheet');
23 __PACKAGE__->run_before('check_task_server');
25 __PACKAGE__->make_paginated(ONLY => [ qw(list) ]);
27 __PACKAGE__->make_sorted(
30 package_name => t8('Package name'),
31 run_at => t8('Run at'),
32 status => t8('Execution status'),
33 result => t8('Result'),
44 $self->render('background_job_history/list',
45 title => $::locale->text('Background job history'),
46 ENTRIES => $self->get_models);
52 my $back_to = $::form->{back_to} || $self->url_for(action => 'list');
54 $self->history(SL::DB::BackgroundJobHistory->new(id => $::form->{id})->load);
55 $self->render('background_job_history/show',
56 title => $::locale->text('View background job execution result'),
65 $::auth->assert('admin');
72 sub init_task_server {
73 return SL::System::TaskServer->new;
76 sub check_task_server {
78 flash('warning', $::locale->text('The task server does not appear to be running.')) if !$self->task_server->is_running;
82 $::request->{layout}->use_stylesheet('lx-office-erp/background_jobs.css');