Revision 6c5cdbeb
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Controller/BackgroundJobHistory.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use parent qw(SL::Controller::Base); |
6 | 6 |
|
7 |
use SL::Controller::Helper::Filtered; |
|
7 | 8 |
use SL::Controller::Helper::GetModels; |
8 | 9 |
use SL::Controller::Helper::Paginated; |
9 | 10 |
use SL::Controller::Helper::Sorted; |
... | ... | |
14 | 15 |
|
15 | 16 |
use Rose::Object::MakeMethods::Generic |
16 | 17 |
( |
17 |
scalar => [ qw(history) ], |
|
18 |
scalar => [ qw(history db_args flat_filter filter_summary) ],
|
|
18 | 19 |
'scalar --get_set_init' => [ qw(task_server) ], |
19 | 20 |
); |
20 | 21 |
|
... | ... | |
22 | 23 |
__PACKAGE__->run_before('add_stylesheet'); |
23 | 24 |
__PACKAGE__->run_before('check_task_server'); |
24 | 25 |
|
26 |
__PACKAGE__->make_filtered( |
|
27 |
MODEL => 'BackgroundJobHistory', |
|
28 |
LAUNDER_TO => 'filter' |
|
29 |
); |
|
25 | 30 |
__PACKAGE__->make_paginated(ONLY => [ qw(list) ]); |
26 | 31 |
|
27 | 32 |
__PACKAGE__->make_sorted( |
... | ... | |
41 | 46 |
sub action_list { |
42 | 47 |
my ($self) = @_; |
43 | 48 |
|
49 |
$self->make_filter_summary; |
|
50 |
|
|
44 | 51 |
$self->render('background_job_history/list', |
45 | 52 |
title => $::locale->text('Background job history'), |
46 | 53 |
ENTRIES => $self->get_models); |
... | ... | |
82 | 89 |
$::request->{layout}->use_stylesheet('lx-office-erp/background_jobs.css'); |
83 | 90 |
} |
84 | 91 |
|
92 |
sub make_filter_summary { |
|
93 |
my ($self) = @_; |
|
94 |
|
|
95 |
my $filter = $::form->{filter} || {}; |
|
96 |
my @filters = ( |
|
97 |
[ "package_name:substr::ilike", $::locale->text('Package name') ], |
|
98 |
[ "result:substr::ilike", $::locale->text('Result') ], |
|
99 |
[ "error:substr::ilike", $::locale->text('Error') ], |
|
100 |
[ "run_at:date::ge", $::locale->text('Run at') . " " . $::locale->text('From Date') ], |
|
101 |
[ "run_at:date::le", $::locale->text('Run at') . " " . $::locale->text('To Date') ], |
|
102 |
); |
|
103 |
|
|
104 |
my @filter_strings = grep { $_ } |
|
105 |
map { $filter->{ $_->[0] } ? $_->[1] . ' ' . $filter->{ $_->[0] } : undef } |
|
106 |
@filters; |
|
107 |
|
|
108 |
my %status = ( |
|
109 |
failed => $::locale->text('failed'), |
|
110 |
success => $::locale->text('succeeded'), |
|
111 |
); |
|
112 |
push @filter_strings, $status{ $filter->{'status:eq_ignore_empty'} } if $filter->{'status:eq_ignore_empty'}; |
|
113 |
|
|
114 |
$self->filter_summary(join(', ', @filter_strings)); |
|
115 |
} |
|
116 |
|
|
85 | 117 |
1; |
locale/de/all | ||
---|---|---|
556 | 556 |
'Current / Next Level' => 'Aktuelles / Nächstes Mahnlevel', |
557 | 557 |
'Current Earnings' => 'Gewinn', |
558 | 558 |
'Current assets account' => 'Konto für Umlaufvermögen', |
559 |
'Current filter' => 'Aktueller Filter', |
|
559 | 560 |
'Current profile' => 'Aktuelles Profil', |
560 | 561 |
'Current status' => 'Aktueller Status', |
561 | 562 |
'Current value:' => 'Aktueller Wert:', |
templates/webpages/background_job_history/_filter.html | ||
---|---|---|
1 |
[%- USE L %][%- USE LxERP %][%- USE HTML %] |
|
2 |
<form action="controller.pl" method="post"> |
|
3 |
<div class="filter_toggle"> |
|
4 |
<a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a> |
|
5 |
[% IF SELF.filter_summary %]([% LxERP.t8("Current filter") %]: [% SELF.filter_summary %])[% END %] |
|
6 |
</div> |
|
7 |
|
|
8 |
<div class="filter_toggle" style="display:none"> |
|
9 |
<a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Hide Filter') %]</a> |
|
10 |
<table id="filter_table"> |
|
11 |
<tr> |
|
12 |
<th align="right">[% LxERP.t8('Package name') %]</th> |
|
13 |
<td>[% L.input_tag('filter.package_name:substr::ilike', filter.package_name_substr__ilike, size = 20) %]</td> |
|
14 |
</tr> |
|
15 |
<tr> |
|
16 |
<th align="right">[% LxERP.t8('Result') %]</th> |
|
17 |
<td>[% L.input_tag('filter.result:substr::ilike', filter.result_substr__ilike, size = 20) %]</td> |
|
18 |
</tr> |
|
19 |
<tr> |
|
20 |
<th align="right">[% LxERP.t8('Error') %]</th> |
|
21 |
<td>[% L.input_tag('filter.error:substr::ilike', filter.error_substr__ilike, size = 20) %]</td> |
|
22 |
</tr> |
|
23 |
<tr> |
|
24 |
<th align="right">[% LxERP.t8('Status') %]</th> |
|
25 |
<td>[% L.select_tag('filter.status:eq_ignore_empty', [ [ '', '' ], [ 'failed', LxERP.t8('failed') ], [ 'success', LxERP.t8('succeeded') ] ], default=filter.status_eq_ignore_empty) %]</td> |
|
26 |
</tr> |
|
27 |
<tr> |
|
28 |
<th align="right">[% LxERP.t8('Run at') %] [% LxERP.t8('From Date') %]</th> |
|
29 |
<td>[% L.date_tag('filter.run_at:date::ge', filter.run_at_date__ge) %]</td> |
|
30 |
</tr> |
|
31 |
<tr> |
|
32 |
<th align="right">[% LxERP.t8('Run at') %] [% LxERP.t8('To Date') %]</th> |
|
33 |
<td>[% L.date_tag('filter.run_at:date::le', filter.run_at_date__le) %]</td> |
|
34 |
</tr> |
|
35 |
</table> |
|
36 |
|
|
37 |
[% L.hidden_tag('action', 'BackgroundJobHistory/dispatch') %] |
|
38 |
[% L.hidden_tag('sort_by', FORM.sort_by) %] |
|
39 |
[% L.hidden_tag('sort_dir', FORM.sort_dir) %] |
|
40 |
[% L.hidden_tag('page', FORM.page) %] |
|
41 |
[% L.submit_tag('action_list', LxERP.t8('Continue'))%] |
|
42 |
|
|
43 |
<a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val('');">[% LxERP.t8('Reset') %]</a> |
|
44 |
|
|
45 |
</div> |
|
46 |
|
|
47 |
</form> |
templates/webpages/background_job_history/list.html | ||
---|---|---|
1 | 1 |
[% USE HTML %][% USE L %][% USE LxERP %] |
2 | 2 |
|
3 |
<h1>[% FORM.title %]</h1>
|
|
3 |
<h1>[% FORM.title %]</h1> |
|
4 | 4 |
|
5 | 5 |
[%- INCLUDE 'common/flash.html' %] |
6 | 6 |
|
7 |
<form method="post" action="controller.pl"> |
|
8 |
[% IF !ENTRIES.size %] |
|
9 |
<p> |
|
10 |
[%- LxERP.t8('There are no entries in the background job history.') %] |
|
11 |
</p> |
|
12 |
|
|
13 |
[%- ELSE %] |
|
14 |
<table id="background_job_history_list" class="background_job_list" width="100%"> |
|
15 |
<thead> |
|
16 |
<tr class="listheading"> |
|
17 |
<th>[% L.sortable_table_header('package_name') %]</th> |
|
18 |
<th>[% L.sortable_table_header('run_at') %]</th> |
|
19 |
<th>[% L.sortable_table_header('status') %]</th> |
|
20 |
<th>[% L.sortable_table_header('result') %]</th> |
|
21 |
<th>[% L.sortable_table_header('error') %]</th> |
|
22 |
</tr> |
|
23 |
</thead> |
|
24 |
|
|
25 |
<tbody> |
|
26 |
[%- FOREACH entry = ENTRIES %] |
|
27 |
<tr class="listrow[% loop.count % 2 %]" id="background_job_history_id_[% entry.id %]"> |
|
28 |
<td> |
|
29 |
<a href="[% SELF.url_for(action => 'show', id => entry.id, back_to => SELF.get_callback) %]"> |
|
30 |
[%- HTML.escape(entry.package_name) %] |
|
31 |
</a> |
|
32 |
</td> |
|
33 |
<td>[%- HTML.escape(entry.run_at.to_lxoffice('precision' => 'second')) %]</td> |
|
34 |
<td> |
|
35 |
[%- IF entry.status == 'success' %] |
|
36 |
[%- LxERP.t8('succeeded') %] |
|
37 |
[%- ELSIF entry.status == 'failure' %] |
|
38 |
[%- LxERP.t8('failed') %] |
|
39 |
[%- ELSE %] |
|
40 |
[%- HTML.escape(entry.status) %] |
|
41 |
[%- END %] |
|
42 |
</td> |
|
43 |
<td>[%- HTML.escape(entry.result) %]</td> |
|
44 |
<td>[% IF entry.error_col %]<pre>[%- HTML.escape(L.truncate(entry.error_col)) %]</pre>[%- END %]</td> |
|
45 |
</tr> |
|
7 |
[%- PROCESS 'background_job_history/_filter.html' filter=SELF.filter %] |
|
8 |
|
|
9 |
[% IF !ENTRIES.size %] |
|
10 |
<p> |
|
11 |
[%- LxERP.t8('There are no entries in the background job history.') %] |
|
12 |
</p> |
|
13 |
|
|
14 |
[%- ELSE %] |
|
15 |
<table id="background_job_history_list" class="background_job_list" width="100%"> |
|
16 |
<thead> |
|
17 |
<tr class="listheading"> |
|
18 |
<th>[% L.sortable_table_header('package_name') %]</th> |
|
19 |
<th>[% L.sortable_table_header('run_at') %]</th> |
|
20 |
<th>[% L.sortable_table_header('status') %]</th> |
|
21 |
<th>[% L.sortable_table_header('result') %]</th> |
|
22 |
<th>[% L.sortable_table_header('error') %]</th> |
|
23 |
</tr> |
|
24 |
</thead> |
|
25 |
|
|
26 |
<tbody> |
|
27 |
[%- FOREACH entry = ENTRIES %] |
|
28 |
<tr class="listrow[% loop.count % 2 %]" id="background_job_history_id_[% entry.id %]"> |
|
29 |
<td> |
|
30 |
<a href="[% SELF.url_for(action => 'show', id => entry.id, back_to => SELF.get_callback) %]"> |
|
31 |
[%- HTML.escape(entry.package_name) %] |
|
32 |
</a> |
|
33 |
</td> |
|
34 |
<td>[%- HTML.escape(entry.run_at.to_lxoffice('precision' => 'second')) %]</td> |
|
35 |
<td> |
|
36 |
[%- IF entry.status == 'success' %] |
|
37 |
[%- LxERP.t8('succeeded') %] |
|
38 |
[%- ELSIF entry.status == 'failure' %] |
|
39 |
[%- LxERP.t8('failed') %] |
|
40 |
[%- ELSE %] |
|
41 |
[%- HTML.escape(entry.status) %] |
|
46 | 42 |
[%- END %] |
47 |
</tbody> |
|
48 |
</table> |
|
43 |
</td> |
|
44 |
<td>[%- HTML.escape(entry.result) %]</td> |
|
45 |
<td>[% IF entry.error_col %]<pre>[%- HTML.escape(L.truncate(entry.error_col)) %]</pre>[%- END %]</td> |
|
46 |
</tr> |
|
49 | 47 |
[%- END %] |
48 |
</tbody> |
|
49 |
</table> |
|
50 |
[%- END %] |
|
50 | 51 |
|
51 |
[% L.paginate_controls %]
|
|
52 |
[% L.paginate_controls %] |
|
52 | 53 |
|
53 |
<hr size="3" noshade>
|
|
54 |
<hr size="3" noshade> |
|
54 | 55 |
|
55 |
<p> |
|
56 |
<a href="[% SELF.url_for(controller => 'BackgroundJob', action => 'list') %]">[%- LxERP.t8('View background jobs') %]</a> |
|
57 |
| |
|
58 |
<a href="[% SELF.url_for(controller => 'TaskServer', action => 'show') %]">[%- LxERP.t8('Task server control') %]</a> |
|
59 |
</p> |
|
60 |
</form> |
|
56 |
<p> |
|
57 |
<a href="[% SELF.url_for(controller => 'BackgroundJob', action => 'list') %]">[%- LxERP.t8('View background jobs') %]</a> |
|
58 |
| |
|
59 |
<a href="[% SELF.url_for(controller => 'TaskServer', action => 'show') %]">[%- LxERP.t8('Task server control') %]</a> |
|
60 |
</p> |
Auch abrufbar als: Unified diff
Backgroundjob-History-Liste: Filterfunktion