Revision 783342e0
Von Sven Schöling vor etwa 11 Jahren hinzugefügt
SL/Controller/BackgroundJob.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use SL::BackgroundJob::Base; |
8 | 8 |
use SL::Controller::Helper::GetModels; |
9 |
use SL::Controller::Helper::Paginated; |
|
10 |
use SL::Controller::Helper::Sorted; |
|
11 | 9 |
use SL::DB::BackgroundJob; |
12 | 10 |
use SL::Helper::Flash; |
13 | 11 |
use SL::Locale::String; |
... | ... | |
16 | 14 |
use Rose::Object::MakeMethods::Generic |
17 | 15 |
( |
18 | 16 |
scalar => [ qw(background_job) ], |
19 |
'scalar --get_set_init' => [ qw(task_server back_to) ], |
|
17 |
'scalar --get_set_init' => [ qw(task_server back_to models) ],
|
|
20 | 18 |
); |
21 | 19 |
|
22 | 20 |
__PACKAGE__->run_before('check_auth'); |
23 | 21 |
__PACKAGE__->run_before('check_task_server'); |
24 | 22 |
__PACKAGE__->run_before('load_background_job', only => [ qw(edit update destroy execute) ]); |
25 | 23 |
|
26 |
__PACKAGE__->make_paginated(ONLY => [ qw(list) ]); |
|
27 |
|
|
28 |
__PACKAGE__->make_sorted( |
|
29 |
ONLY => [ qw(list) ], |
|
30 |
|
|
31 |
package_name => t8('Package name'), |
|
32 |
type => t8('Execution type'), |
|
33 |
active => t8('Active'), |
|
34 |
cron_spec => t8('Execution schedule'), |
|
35 |
last_run_at => t8('Last run at'), |
|
36 |
next_run_at => t8('Next run at'), |
|
37 |
); |
|
38 |
|
|
39 | 24 |
# |
40 | 25 |
# actions |
41 | 26 |
# |
... | ... | |
45 | 30 |
|
46 | 31 |
$self->render('background_job/list', |
47 | 32 |
title => $::locale->text('Background jobs'), |
48 |
BACKGROUND_JOBS => $self->get_models); |
|
33 |
BACKGROUND_JOBS => $self->models->get, |
|
34 |
MODELS => $self->models); |
|
49 | 35 |
} |
50 | 36 |
|
51 | 37 |
sub action_new { |
... | ... | |
169 | 155 |
return $::form->{back_to} || $self->url_for(action => 'list'); |
170 | 156 |
} |
171 | 157 |
|
158 |
sub init_models { |
|
159 |
SL::Controller::Helper::GetModels->new( |
|
160 |
controller => $_[0], |
|
161 |
model => 'BackgroundJob', |
|
162 |
filtered => 0, |
|
163 |
sorted => { |
|
164 |
package_name => t8('Package name'), |
|
165 |
type => t8('Execution type'), |
|
166 |
active => t8('Active'), |
|
167 |
cron_spec => t8('Execution schedule'), |
|
168 |
last_run_at => t8('Last run at'), |
|
169 |
next_run_at => t8('Next run at'), |
|
170 |
}, |
|
171 |
); |
|
172 |
} |
|
173 |
|
|
172 | 174 |
1; |
Auch abrufbar als: Unified diff
BackgroundJob models