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.14'; |
4
|
11
|
|
|
11
|
|
189266
|
use parent 'Tapper::Reports::Web::Controller::Base'; |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
96
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
1226
|
use strict; |
|
11
|
|
|
|
|
34
|
|
|
11
|
|
|
|
|
257
|
|
7
|
11
|
|
|
11
|
|
66
|
use warnings; |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
445
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
870
|
use DateTime::Format::Natural; |
|
11
|
|
|
|
|
497165
|
|
|
11
|
|
|
|
|
709
|
|
10
|
11
|
|
|
11
|
|
789
|
use Data::Dumper; |
|
11
|
|
|
|
|
6710
|
|
|
11
|
|
|
|
|
675
|
|
11
|
|
|
|
|
|
|
|
12
|
11
|
|
|
11
|
|
628
|
use Tapper::Reports::Web::Util::Filter::Report; |
|
11
|
|
|
|
|
32
|
|
|
11
|
|
|
|
|
391
|
|
13
|
11
|
|
|
11
|
|
5400
|
use Tapper::Reports::Web::Util::Report; |
|
11
|
|
|
|
|
37
|
|
|
11
|
|
|
|
|
404
|
|
14
|
11
|
|
|
11
|
|
101
|
use common::sense; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
58
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub index :Path :Args() { |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
2779
|
my ( $self, $c, @args ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
13
|
exit 0 if $args[0] eq 'exit'; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
31
|
my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c); |
24
|
2
|
|
|
|
|
27
|
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
|
|
|
83
|
$filter->requested_day || DateTime::Format::Natural->new->parse_datetime("today at midnight"); |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
48434
|
$filter->{early}->{-or} = [{rga_primary => 1}, {rgt_primary => 1}]; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
111
|
$c->forward('/tapper/reports/prepare_this_weeks_reportlists', [ $filter_condition ]); |
38
|
2
|
|
|
|
|
278
|
$c->forward('/tapper/reports/prepare_navi'); |
39
|
|
|
|
|
|
|
|
40
|
11
|
|
|
11
|
|
3174
|
} |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
90
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub prepare_this_weeks_reportlists : Private { |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
0
|
1310
|
my ( $or_self, $or_c, $hr_filter_condition ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
5
|
my $b_view_pager = 0; |
47
|
2
|
|
|
|
|
7
|
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
|
|
|
|
|
215
|
}; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
16
|
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
|
|
|
|
|
103
|
)->parse_datetime( $hr_params->{report_date} ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif (! $hr_filter_condition->{report_id} ) { |
64
|
1
|
|
|
|
|
6
|
$hr_filter_condition->{report_date} = DateTime->now(); |
65
|
|
|
|
|
|
|
} |
66
|
2
|
0
|
33
|
|
|
2471
|
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
|
|
|
|
10
|
if ( $hr_filter_condition->{report_date} ) { |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
50
|
|
|
39
|
$or_c->stash->{pager_interval} = $hr_params->{pager_interval} || 1; |
82
|
2
|
|
|
|
|
178
|
$or_c->stash->{report_date} = $hr_filter_condition->{report_date}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# set report date |
85
|
2
|
|
|
|
|
139
|
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
|
|
|
|
|
1299
|
my $d_report_date_to = $hr_filter_condition->{report_date}->strftime('%d %b %Y'); |
87
|
|
|
|
|
|
|
|
88
|
2
|
50
|
|
|
|
114
|
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
|
|
|
|
|
25
|
$or_c->stash->{head_overview} = "Reports ($d_report_date_from)"; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
|
|
156
|
$hr_query_vals->{report_date_from} = $hr_filter_condition->{report_date}->clone->subtract( days => $or_c->stash->{pager_interval} - 1 )->strftime('%F'); |
96
|
2
|
|
|
|
|
919
|
$hr_query_vals->{report_date_to} = $hr_filter_condition->{report_date}->strftime('%F'); |
97
|
|
|
|
|
|
|
|
98
|
2
|
|
|
|
|
122
|
$or_c->stash->{view_pager} = 1; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
0
|
|
|
|
|
0
|
$or_c->stash->{head_overview} = 'Testruns'; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
188
|
$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
|
|
|
|
|
10634
|
return 1; |
112
|
|
|
|
|
|
|
|
113
|
11
|
|
|
11
|
|
151141
|
} |
|
11
|
|
|
|
|
45
|
|
|
11
|
|
|
|
|
75
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub prepare_navi : Private { |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
|
2
|
0
|
1212
|
my ( $self, $c ) = @_; |
119
|
2
|
|
|
|
|
10
|
$c->stash->{navi} = []; |
120
|
|
|
|
|
|
|
|
121
|
2
|
|
|
|
|
188
|
my %args = @{$c->req->arguments}; |
|
2
|
|
|
|
|
7
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$c->stash->{navi} = [ |
124
|
|
|
|
|
|
|
{ |
125
|
2
|
|
|
|
|
170
|
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
|
|
|
|
|
144
|
my @a_subnavi; |
145
|
2
|
|
|
|
|
6
|
my @a_args = @{$c->req->arguments}; |
|
2
|
|
|
|
|
7
|
|
146
|
|
|
|
|
|
|
|
147
|
2
|
|
|
|
|
128
|
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
|
|
|
|
|
6
|
|
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
|
11
|
|
|
11
|
|
16366
|
} |
|
11
|
|
|
|
|
43
|
|
|
11
|
|
|
|
|
62
|
|
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) 2019 by Advanced Micro Devices, Inc.. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This is free software, licensed under: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |