Revision 5be585d1
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/Controller/BackgroundJob.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use parent qw(SL::Controller::Base); |
6 | 6 |
|
7 |
use SL::Controller::Helper::GetModels; |
|
8 |
use SL::Controller::Helper::Sorted; |
|
7 | 9 |
use SL::DB::BackgroundJob; |
8 | 10 |
use SL::Helper::Flash; |
9 | 11 |
use SL::System::TaskServer; |
... | ... | |
11 | 13 |
use Rose::Object::MakeMethods::Generic |
12 | 14 |
( |
13 | 15 |
scalar => [ qw(background_job) ], |
14 |
'scalar --get_set_init' => [ qw(task_server) ], |
|
16 |
'scalar --get_set_init' => [ qw(task_server back_to) ],
|
|
15 | 17 |
); |
16 | 18 |
|
17 | 19 |
__PACKAGE__->run_before('check_auth'); |
18 | 20 |
__PACKAGE__->run_before('check_task_server'); |
19 | 21 |
__PACKAGE__->run_before('load_background_job', only => [ qw(edit update destroy execute) ]); |
20 | 22 |
|
23 |
__PACKAGE__->make_sorted( |
|
24 |
ONLY => [ qw(list) ], |
|
25 |
|
|
26 |
package_name => $::locale->text('Package name'), |
|
27 |
type => $::locale->text('Execution type'), |
|
28 |
active => $::locale->text('Active'), |
|
29 |
cron_spec => $::locale->text('Execution schedule'), |
|
30 |
last_run_at => $::locale->text('Last run at'), |
|
31 |
next_run_at => $::locale->text('Next run at'), |
|
32 |
); |
|
33 |
|
|
21 | 34 |
# |
22 | 35 |
# actions |
23 | 36 |
# |
... | ... | |
27 | 40 |
|
28 | 41 |
$self->render('background_job/list', |
29 | 42 |
title => $::locale->text('Background jobs'), |
30 |
BACKGROUND_JOBS => SL::DB::Manager::BackgroundJob->get_all_sorted);
|
|
43 |
BACKGROUND_JOBS => $self->get_models);
|
|
31 | 44 |
} |
32 | 45 |
|
33 | 46 |
sub action_new { |
... | ... | |
63 | 76 |
flash_later('error', $::locale->text('The background job could not be destroyed.')); |
64 | 77 |
} |
65 | 78 |
|
66 |
$self->redirect_to(action => 'list');
|
|
79 |
$self->redirect_to($self->back_to);
|
|
67 | 80 |
} |
68 | 81 |
|
69 | 82 |
sub action_save_and_execute { |
... | ... | |
123 | 136 |
flash_later('info', $is_new ? $::locale->text('The background job has been created.') : $::locale->text('The background job has been saved.')); |
124 | 137 |
return if $return; |
125 | 138 |
|
126 |
$self->redirect_to(action => 'list');
|
|
139 |
$self->redirect_to($self->back_to);
|
|
127 | 140 |
} |
128 | 141 |
|
129 | 142 |
sub load_background_job { |
... | ... | |
140 | 153 |
flash('warning', $::locale->text('The task server does not appear to be running.')) if !$self->task_server->is_running; |
141 | 154 |
} |
142 | 155 |
|
156 |
sub init_back_to { |
|
157 |
my ($self) = @_; |
|
158 |
return $::form->{back_to} || $self->url_for(action => 'list'); |
|
159 |
} |
|
160 |
|
|
143 | 161 |
1; |
Auch abrufbar als: Unified diff
Sortierung im BackgroundJob-Controller