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.13'; |
4
|
11
|
|
|
11
|
|
64295
|
use parent 'Tapper::Reports::Web::Controller::Base'; |
|
11
|
|
|
|
|
221
|
|
|
11
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
800
|
use strict; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
235
|
|
7
|
11
|
|
|
11
|
|
39
|
use warnings; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
267
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
5343
|
use DateTime::Format::Natural; |
|
11
|
|
|
|
|
585054
|
|
|
11
|
|
|
|
|
647
|
|
10
|
11
|
|
|
11
|
|
580
|
use Data::Dumper; |
|
11
|
|
|
|
|
4578
|
|
|
11
|
|
|
|
|
504
|
|
11
|
|
|
|
|
|
|
|
12
|
11
|
|
|
11
|
|
480
|
use Tapper::Reports::Web::Util::Filter::Report; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
245
|
|
13
|
11
|
|
|
11
|
|
4815
|
use Tapper::Reports::Web::Util::Report; |
|
11
|
|
|
|
|
34
|
|
|
11
|
|
|
|
|
380
|
|
14
|
11
|
|
|
11
|
|
65
|
use common::sense; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
134
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub index :Path :Args() { |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
1883
|
my ( $self, $c, @args ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
2
|
50
|
|
|
|
7
|
exit 0 if $args[0] eq 'exit'; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
33
|
my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c); |
24
|
2
|
|
|
|
|
21
|
my $filter_condition = $filter->parse_filters(\@args); |
25
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
7
|
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
|
|
|
59
|
$filter->requested_day || DateTime::Format::Natural->new->parse_datetime("today at midnight"); |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
34461
|
$filter->{early}->{-or} = [{rga_primary => 1}, {rgt_primary => 1}]; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
45
|
$c->forward('/tapper/reports/prepare_this_weeks_reportlists', [ $filter_condition ]); |
38
|
2
|
|
|
|
|
187
|
$c->forward('/tapper/reports/prepare_navi'); |
39
|
|
|
|
|
|
|
|
40
|
11
|
|
|
11
|
|
2536
|
} |
|
11
|
|
|
|
|
15
|
|
|
11
|
|
|
|
|
92
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub prepare_this_weeks_reportlists : Private { |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
0
|
780
|
my ( $or_self, $or_c, $hr_filter_condition ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
4
|
my $b_view_pager = 0; |
47
|
2
|
|
|
|
|
6
|
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
|
|
|
|
|
147
|
}; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
11
|
require DateTime; |
58
|
2
|
100
|
|
|
|
9
|
if ( $hr_params->{report_date} ) { |
|
|
50
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$hr_filter_condition->{report_date} = DateTime::Format::Strptime->new( |
60
|
|
|
|
|
|
|
pattern => '%F', |
61
|
1
|
|
|
|
|
11
|
)->parse_datetime( $hr_params->{report_date} ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif (! $hr_filter_condition->{report_id} ) { |
64
|
1
|
|
|
|
|
4
|
$hr_filter_condition->{report_date} = DateTime->now(); |
65
|
|
|
|
|
|
|
} |
66
|
2
|
0
|
33
|
|
|
1635
|
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
|
|
|
|
7
|
if ( $hr_filter_condition->{report_date} ) { |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
50
|
|
|
64
|
$or_c->stash->{pager_interval} = $hr_params->{pager_interval} || 1; |
82
|
2
|
|
|
|
|
133
|
$or_c->stash->{report_date} = $hr_filter_condition->{report_date}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# set report date |
85
|
2
|
|
|
|
|
94
|
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
|
|
|
|
|
701
|
my $d_report_date_to = $hr_filter_condition->{report_date}->strftime('%d %b %Y'); |
87
|
|
|
|
|
|
|
|
88
|
2
|
50
|
|
|
|
54
|
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
|
|
|
|
|
11
|
$or_c->stash->{head_overview} = "Reports ($d_report_date_from)"; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
|
|
103
|
$hr_query_vals->{report_date_from} = $hr_filter_condition->{report_date}->clone->subtract( days => $or_c->stash->{pager_interval} - 1 )->strftime('%F'); |
96
|
2
|
|
|
|
|
439
|
$hr_query_vals->{report_date_to} = $hr_filter_condition->{report_date}->strftime('%F'); |
97
|
|
|
|
|
|
|
|
98
|
2
|
|
|
|
|
36
|
$or_c->stash->{view_pager} = 1; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
0
|
|
|
|
|
0
|
$or_c->stash->{head_overview} = 'Testruns'; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
128
|
$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
|
|
|
|
|
7171
|
return 1; |
112
|
|
|
|
|
|
|
|
113
|
11
|
|
|
11
|
|
90343
|
} |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
50
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub prepare_navi : Private { |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
|
2
|
0
|
773
|
my ( $self, $c ) = @_; |
119
|
2
|
|
|
|
|
10
|
$c->stash->{navi} = []; |
120
|
|
|
|
|
|
|
|
121
|
2
|
|
|
|
|
138
|
my %args = @{$c->req->arguments}; |
|
2
|
|
|
|
|
6
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$c->stash->{navi} = [ |
124
|
|
|
|
|
|
|
{ |
125
|
2
|
|
|
|
|
139
|
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
|
|
|
|
|
90
|
my @a_subnavi; |
145
|
2
|
|
|
|
|
4
|
my @a_args = @{$c->req->arguments}; |
|
2
|
|
|
|
|
6
|
|
146
|
|
|
|
|
|
|
|
147
|
2
|
|
|
|
|
83
|
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
|
|
|
|
|
3
|
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
|
|
11298
|
} |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
45
|
|
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) 2017 by Advanced Micro Devices, Inc.. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This is free software, licensed under: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |