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::System::TaskServer;
14 use Rose::Object::MakeMethods::Generic
16 scalar => [ qw(history) ],
17 'scalar --get_set_init' => [ qw(task_server) ],
20 __PACKAGE__->run_before('check_auth');
21 __PACKAGE__->run_before('add_stylesheet');
22 __PACKAGE__->run_before('check_task_server');
24 __PACKAGE__->make_paginated(ONLY => [ qw(list) ]);
26 __PACKAGE__->make_sorted(
29 package_name => $::locale->text('Package name'),
30 run_at => $::locale->text('Run at'),
31 status => $::locale->text('Execution status'),
32 result => $::locale->text('Result'),
33 error => $::locale->text('Error'),
43 $self->render('background_job_history/list',
44 title => $::locale->text('Background job history'),
45 ENTRIES => $self->get_models);
51 my $back_to = $::form->{back_to} || $self->url_for(action => 'list');
53 $self->history(SL::DB::BackgroundJobHistory->new(id => $::form->{id})->load);
54 $self->render('background_job_history/show',
55 title => $::locale->text('View background job execution result'),
64 $::auth->assert('admin');
71 sub init_task_server {
72 return SL::System::TaskServer->new;
75 sub check_task_server {
77 flash('warning', $::locale->text('The task server does not appear to be running.')) if !$self->task_server->is_running;
81 $::form->use_stylesheet('lx-office-erp/background_jobs.css');