line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Controller::Tapper::Reports; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Controller::Tapper::Reports::VERSION = '5.0.15'; |
4
|
12
|
|
|
12
|
|
105786
|
use parent 'Tapper::Reports::Web::Controller::Base'; |
|
12
|
|
|
|
|
325
|
|
|
12
|
|
|
|
|
86
|
|
5
|
|
|
|
|
|
|
|
6
|
12
|
|
|
12
|
|
916
|
use strict; |
|
12
|
|
|
|
|
40
|
|
|
12
|
|
|
|
|
268
|
|
7
|
12
|
|
|
12
|
|
73
|
use warnings; |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
339
|
|
8
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
632
|
use DateTime::Format::Natural; |
|
12
|
|
|
|
|
488854
|
|
|
12
|
|
|
|
|
692
|
|
10
|
12
|
|
|
12
|
|
718
|
use Data::Dumper; |
|
12
|
|
|
|
|
6135
|
|
|
12
|
|
|
|
|
708
|
|
11
|
|
|
|
|
|
|
|
12
|
12
|
|
|
12
|
|
588
|
use Tapper::Reports::Web::Util::Filter::Report; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
410
|
|
13
|
12
|
|
|
12
|
|
5263
|
use Tapper::Reports::Web::Util::Report; |
|
12
|
|
|
|
|
41
|
|
|
12
|
|
|
|
|
393
|
|
14
|
12
|
|
|
12
|
|
83
|
use common::sense; |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
57
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub index :Path :Args() { |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
2843
|
my ( $self, $c, @args ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
12
|
exit 0 if $args[0] eq 'exit'; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
39
|
my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c); |
24
|
2
|
|
|
|
|
29
|
my $filter_condition = $filter->parse_filters(\@args); |
25
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
9
|
if ($filter_condition->{error}) { |
27
|
0
|
|
|
|
|
0
|
$c->flash->{error_msg} = join("; ", @{$filter_condition->{error}}); |
|
0
|
|
|
|
|
0
|
|
28
|
0
|
|
|
|
|
0
|
$c->res->redirect("/tapper/reports"); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$c->stash->{requested_day} = |
33
|
2
|
|
33
|
|
|
77
|
$filter->requested_day || DateTime::Format::Natural->new->parse_datetime("today at midnight"); |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
51668
|
$filter->{early}->{-or} = [{rga_primary => 1}, {rgt_primary => 1}]; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
95
|
$c->forward('/tapper/reports/prepare_this_weeks_reportlists', [ $filter_condition ]); |
38
|
2
|
|
|
|
|
259
|
$c->forward('/tapper/reports/prepare_navi'); |
39
|
|
|
|
|
|
|
|
40
|
12
|
|
|
12
|
|
3159
|
} |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
100
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub prepare_this_weeks_reportlists : Private { |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
0
|
1190
|
my ( $or_self, $or_c, $hr_filter_condition ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
8
|
my $b_view_pager = 0; |
47
|
2
|
|
|
|
|
10
|
my $hr_params = $or_c->req->params; |
48
|
|
|
|
|
|
|
my $hr_query_vals = { |
49
|
|
|
|
|
|
|
report_id => $hr_filter_condition->{report_id}, |
50
|
|
|
|
|
|
|
suite_id => $hr_filter_condition->{suite_id}, |
51
|
|
|
|
|
|
|
machine_name => $hr_filter_condition->{host}, |
52
|
|
|
|
|
|
|
success_ratio => $hr_filter_condition->{success_ratio}, |
53
|
|
|
|
|
|
|
successgrade => $hr_filter_condition->{successgrade}, |
54
|
|
|
|
|
|
|
owner => $hr_filter_condition->{owner}, |
55
|
2
|
|
|
|
|
201
|
}; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
17
|
require DateTime; |
58
|
2
|
100
|
|
|
|
12
|
if ( $hr_params->{report_date} ) { |
|
|
50
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$hr_filter_condition->{report_date} = DateTime::Format::Strptime->new( |
60
|
|
|
|
|
|
|
pattern => '%F', |
61
|
1
|
|
|
|
|
12
|
)->parse_datetime( $hr_params->{report_date} ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif (! $hr_filter_condition->{report_id} ) { |
64
|
1
|
|
|
|
|
11
|
$hr_filter_condition->{report_date} = DateTime->now(); |
65
|
|
|
|
|
|
|
} |
66
|
2
|
0
|
33
|
|
|
2497
|
if ( $hr_params->{pager_sign} && $hr_params->{pager_value} ) { |
67
|
0
|
0
|
|
|
|
0
|
if ( $hr_params->{pager_sign} eq 'negative' ) { |
|
|
0
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$hr_filter_condition->{report_date}->subtract( |
69
|
0
|
|
|
|
|
0
|
$hr_params->{pager_value} => 1 |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
elsif ( $hr_params->{pager_sign} eq 'positive' ) { |
73
|
|
|
|
|
|
|
$hr_filter_condition->{report_date}->add( |
74
|
0
|
|
|
|
|
0
|
$hr_params->{pager_value} => 1 |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
2
|
50
|
|
|
|
11
|
if ( $hr_filter_condition->{report_date} ) { |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
50
|
|
|
38
|
$or_c->stash->{pager_interval} = $hr_params->{pager_interval} || 1; |
82
|
2
|
|
|
|
|
190
|
$or_c->stash->{report_date} = $hr_filter_condition->{report_date}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# set report date |
85
|
2
|
|
|
|
|
144
|
my $d_report_date_from = $hr_filter_condition->{report_date}->clone->subtract( days => $or_c->stash->{pager_interval} - 1 )->strftime('%d %b %Y'); |
86
|
2
|
|
|
|
|
1242
|
my $d_report_date_to = $hr_filter_condition->{report_date}->strftime('%d %b %Y'); |
87
|
|
|
|
|
|
|
|
88
|
2
|
50
|
|
|
|
106
|
if ( $d_report_date_from ne $d_report_date_to ) { |
89
|
0
|
|
|
|
|
0
|
$or_c->stash->{head_overview} = "Reports ($d_report_date_to - $d_report_date_from)"; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else { |
92
|
2
|
|
|
|
|
14
|
$or_c->stash->{head_overview} = "Reports ($d_report_date_from)"; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
|
|
167
|
$hr_query_vals->{report_date_from} = $hr_filter_condition->{report_date}->clone->subtract( days => $or_c->stash->{pager_interval} - 1 )->strftime('%F'); |
96
|
2
|
|
|
|
|
925
|
$hr_query_vals->{report_date_to} = $hr_filter_condition->{report_date}->strftime('%F'); |
97
|
|
|
|
|
|
|
|
98
|
2
|
|
|
|
|
125
|
$or_c->stash->{view_pager} = 1; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
0
|
|
|
|
|
0
|
$or_c->stash->{head_overview} = 'Testruns'; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
186
|
$or_c->stash->{reports} = $or_c->model('TestrunDB')->fetch_raw_sql({ |
106
|
|
|
|
|
|
|
query_name => 'reports::web_list', |
107
|
|
|
|
|
|
|
fetch_type => '@%', |
108
|
|
|
|
|
|
|
query_vals => $hr_query_vals, |
109
|
|
|
|
|
|
|
}); |
110
|
|
|
|
|
|
|
|
111
|
2
|
|
|
|
|
10373
|
return 1; |
112
|
|
|
|
|
|
|
|
113
|
12
|
|
|
12
|
|
151984
|
} |
|
12
|
|
|
|
|
47
|
|
|
12
|
|
|
|
|
63
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub prepare_navi : Private { |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
|
2
|
0
|
1203
|
my ( $self, $c ) = @_; |
119
|
2
|
|
|
|
|
10
|
$c->stash->{navi} = []; |
120
|
|
|
|
|
|
|
|
121
|
2
|
|
|
|
|
212
|
my %args = @{$c->req->arguments}; |
|
2
|
|
|
|
|
8
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$c->stash->{navi} = [ |
124
|
|
|
|
|
|
|
{ |
125
|
2
|
|
|
|
|
161
|
title => "reports by suite", |
126
|
|
|
|
|
|
|
href => "/tapper/overview/suite", |
127
|
|
|
|
|
|
|
}, |
128
|
|
|
|
|
|
|
{ |
129
|
|
|
|
|
|
|
title => "reports by host", |
130
|
|
|
|
|
|
|
href => "/tapper/overview/host", |
131
|
|
|
|
|
|
|
}, |
132
|
|
|
|
|
|
|
{ |
133
|
|
|
|
|
|
|
title => "This list as RSS", |
134
|
|
|
|
|
|
|
href => "/tapper/rss/".$self->prepare_filter_path($c), |
135
|
|
|
|
|
|
|
image => "/tapper/static/images/rss.png", |
136
|
|
|
|
|
|
|
}, |
137
|
|
|
|
|
|
|
{ |
138
|
|
|
|
|
|
|
title => "reports by people", |
139
|
|
|
|
|
|
|
href => "/tapper/reports/people/", |
140
|
|
|
|
|
|
|
active => 0, |
141
|
|
|
|
|
|
|
}, |
142
|
|
|
|
|
|
|
]; |
143
|
|
|
|
|
|
|
|
144
|
2
|
|
|
|
|
134
|
my @a_subnavi; |
145
|
2
|
|
|
|
|
6
|
my @a_args = @{$c->req->arguments}; |
|
2
|
|
|
|
|
9
|
|
146
|
|
|
|
|
|
|
|
147
|
2
|
|
|
|
|
113
|
OUTER: for ( my $i = 0; $i < @a_args; $i+=2 ) { |
148
|
0
|
|
|
|
|
0
|
my $s_reduced_filter_path = q##; |
149
|
0
|
|
|
|
|
0
|
for ( my $j = 0; $j < @a_args; $j+=2 ) { |
150
|
0
|
0
|
|
|
|
0
|
next if $i == $j; |
151
|
0
|
|
|
|
|
0
|
$s_reduced_filter_path .= "/$a_args[$j]/" . $a_args[$j+1]; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
push @a_subnavi, { |
154
|
|
|
|
|
|
|
title => "$a_args[$i]: ".$a_args[$i+1], |
155
|
|
|
|
|
|
|
href => '/tapper/reports' |
156
|
|
|
|
|
|
|
. $s_reduced_filter_path |
157
|
|
|
|
|
|
|
. '?report_date=' |
158
|
|
|
|
|
|
|
. $c->stash->{report_date}->strftime('%F') |
159
|
|
|
|
|
|
|
. '&pager_interval=' |
160
|
|
|
|
|
|
|
. $c->stash->{pager_interval}, |
161
|
0
|
|
|
|
|
0
|
image => '/tapper/static/images/minus.png', |
162
|
|
|
|
|
|
|
}; |
163
|
|
|
|
|
|
|
} # OUTER |
164
|
|
|
|
|
|
|
|
165
|
2
|
|
|
|
|
6
|
push @{$c->stash->{navi}}, |
|
2
|
|
|
|
|
7
|
|
166
|
|
|
|
|
|
|
{ title => 'Active Filters', subnavi => \@a_subnavi, }, |
167
|
|
|
|
|
|
|
{ title => 'New Filters', id => 'idx_new_filter' }, |
168
|
|
|
|
|
|
|
{ title => 'Help', id => 'idx_help', subnavi => [{ title => 'Press Shift for multiple Filters' }] }, |
169
|
|
|
|
|
|
|
; |
170
|
|
|
|
|
|
|
|
171
|
12
|
|
|
12
|
|
15992
|
} |
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
63
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
1; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
__END__ |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=pod |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=encoding UTF-8 |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 NAME |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Reports |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 AUTHORS |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=over 4 |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item * |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item * |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=back |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Advanced Micro Devices, Inc.. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This is free software, licensed under: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |