line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Controller::Tapper::Overview; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Controller::Tapper::Overview::VERSION = '5.0.13'; |
4
|
10
|
|
|
10
|
|
5325
|
use parent 'Tapper::Reports::Web::Controller::Base'; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
66
|
|
5
|
10
|
|
|
10
|
|
670
|
use DateTime; |
|
10
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
215
|
|
6
|
10
|
|
|
10
|
|
3720
|
use Tapper::Reports::Web::Util::Filter::Overview; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
294
|
|
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
54
|
use common::sense; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
148
|
|
9
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub auto :Private |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
|
0
|
my ( $self, $c ) = @_; |
14
|
0
|
|
|
|
|
0
|
$c->forward('/tapper/overview/prepare_navi'); |
15
|
10
|
|
|
10
|
|
822
|
} |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
73
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Filter suite list so that only recently used suites are given. |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# @param suite result set - unfiltered suites |
21
|
|
|
|
|
|
|
# @param int/string - duration |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# @return suite result set - filtered suites |
24
|
|
|
|
|
|
|
# |
25
|
|
|
|
|
|
|
sub recently_used_suites |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($self, $c, $suite_rs, $duration) = @_; |
28
|
0
|
|
|
|
|
|
my $timeframe; |
29
|
0
|
0
|
|
|
|
|
if ($duration) { |
30
|
0
|
0
|
|
|
|
|
return $suite_rs if lc($duration) eq 'all'; |
31
|
0
|
|
|
|
|
|
$timeframe = DateTime->now->subtract(weeks => $duration); |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
|
|
|
|
|
$timeframe = DateTime->now->subtract(weeks => 12); |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
my $dtf = $c->model("TestrunDB")->storage->datetime_parser; |
36
|
0
|
|
|
|
|
|
$suite_rs = $suite_rs->search({'reports.created_at' => {'>=' => $dtf->format_datetime($timeframe) }}); |
37
|
0
|
|
|
|
|
|
return $suite_rs; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub index :Path :Args() |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $c, $type, @args ) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
my $filter = Tapper::Reports::Web::Util::Filter::Overview->new(context => $c); |
46
|
0
|
|
|
|
|
0
|
my $filter_condition; |
47
|
0
|
0
|
0
|
|
|
0
|
if (not (@args == 1 and lc($args[0]) eq 'all')) { |
48
|
0
|
|
|
|
|
0
|
$filter_condition = $filter->parse_filters(\@args); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
0
|
if ($filter_condition->{error}) { |
52
|
0
|
|
|
|
|
0
|
$c->stash->{error_msg} = join("; ", @{$filter_condition->{error}}); |
|
0
|
|
|
|
|
0
|
|
53
|
0
|
|
|
|
|
0
|
$c->res->redirect("/tapper/overview/"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
$filter_condition->{early} = {} unless |
56
|
|
|
|
|
|
|
defined($filter_condition->{early}) and |
57
|
0
|
0
|
0
|
|
|
0
|
ref($filter_condition->{early}) eq 'HASH' ; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
given ($type) { |
60
|
0
|
|
|
|
|
0
|
when('suite') {$self->suite($c, $filter_condition)}; |
|
0
|
|
|
|
|
0
|
|
61
|
0
|
|
|
|
|
0
|
when('host') {$self->host($c, $filter_condition)}; |
|
0
|
|
|
|
|
0
|
|
62
|
|
|
|
|
|
|
} |
63
|
10
|
|
|
10
|
|
79399
|
} |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
49
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub suite |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
0
|
0
|
|
my ( $self, $c, $filter_condition ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my %search_options = ( prefetch => ['reports'] ); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $suite_rs = $c->model('TestrunDB')->resultset('Suite')->search($filter_condition->{early}, { %search_options } ); |
72
|
0
|
|
|
|
|
|
foreach my $filter (@{$filter_condition->{late}}) { |
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$suite_rs = $suite_rs->search($filter); |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
$c->stash->{overviews} = {}; |
76
|
0
|
|
|
|
|
|
while ( my $suite = $suite_rs->next ) { |
77
|
0
|
0
|
|
|
|
|
$c->stash->{overviews}{$suite->name} = '/tapper/reports/suite/'.($suite->name =~ /[^\w\d_.-]/ ? $suite->id : $suite->name); |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
$c->stash->{title} = "Tapper report suites"; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub host |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
0
|
0
|
|
my ( $self, $c, $filter_condition ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my $reports = $c->model('TestrunDB')->resultset('Report')->search($filter_condition->{early}, |
87
|
0
|
|
|
|
|
|
{ columns => [ qw/machine_name/ ], |
88
|
|
|
|
|
|
|
distinct => 1, |
89
|
|
|
|
|
|
|
}); |
90
|
0
|
|
|
|
|
|
while ( my $report = $reports->next ) { |
91
|
0
|
|
|
|
|
|
$c->stash->{overviews}{$report->machine_name} = '/tapper/reports/host/'.$report->machine_name; |
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
$c->stash->{title} = "Tapper report hosts"; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub prepare_navi : Private |
99
|
|
|
|
|
|
|
{ |
100
|
0
|
|
|
0
|
0
|
|
my ( $self, $c ) = @_; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$c->stash->{navi}= [{ |
103
|
0
|
|
|
|
|
|
title => 'Overview of', |
104
|
|
|
|
|
|
|
subnavi => [ |
105
|
|
|
|
|
|
|
{ |
106
|
|
|
|
|
|
|
title => 'Suites', |
107
|
|
|
|
|
|
|
href => "/tapper/overview/suite/weeks/2", |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
{ |
110
|
|
|
|
|
|
|
title => 'Hosts', |
111
|
|
|
|
|
|
|
href => "/tapper/overview/host/weeks/2", |
112
|
|
|
|
|
|
|
}, |
113
|
|
|
|
|
|
|
], |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
}, |
116
|
|
|
|
|
|
|
{ |
117
|
|
|
|
|
|
|
title => 'Suites used in the last..', |
118
|
|
|
|
|
|
|
subnavi => [ |
119
|
|
|
|
|
|
|
{ |
120
|
|
|
|
|
|
|
title => '1 week', |
121
|
|
|
|
|
|
|
href => "/tapper/overview/suite/weeks/1", |
122
|
|
|
|
|
|
|
}, |
123
|
|
|
|
|
|
|
{ |
124
|
|
|
|
|
|
|
title => '2 weeks', |
125
|
|
|
|
|
|
|
href => "/tapper/overview/suite/weeks/2", |
126
|
|
|
|
|
|
|
}, |
127
|
|
|
|
|
|
|
{ |
128
|
|
|
|
|
|
|
title => '6 weeks', |
129
|
|
|
|
|
|
|
href => "/tapper/overview/suite/weeks/6", |
130
|
|
|
|
|
|
|
}, |
131
|
|
|
|
|
|
|
{ |
132
|
|
|
|
|
|
|
title => '12 weeks', |
133
|
|
|
|
|
|
|
href => "/tapper/overview/suite/weeks/12", |
134
|
|
|
|
|
|
|
}, |
135
|
|
|
|
|
|
|
], |
136
|
|
|
|
|
|
|
}, |
137
|
|
|
|
|
|
|
{ |
138
|
|
|
|
|
|
|
title => 'Hosts used in the last..', |
139
|
|
|
|
|
|
|
subnavi => [ |
140
|
|
|
|
|
|
|
{ |
141
|
|
|
|
|
|
|
title => '1 week', |
142
|
|
|
|
|
|
|
href => "/tapper/overview/host/weeks/1", |
143
|
|
|
|
|
|
|
}, |
144
|
|
|
|
|
|
|
{ |
145
|
|
|
|
|
|
|
title => '2 weeks', |
146
|
|
|
|
|
|
|
href => "/tapper/overview/host/weeks/2", |
147
|
|
|
|
|
|
|
}, |
148
|
|
|
|
|
|
|
{ |
149
|
|
|
|
|
|
|
title => '6 weeks', |
150
|
|
|
|
|
|
|
href => "/tapper/overview/host/weeks/6", |
151
|
|
|
|
|
|
|
}, |
152
|
|
|
|
|
|
|
{ |
153
|
|
|
|
|
|
|
title => '12 weeks', |
154
|
|
|
|
|
|
|
href => "/tapper/overview/host/weeks/12", |
155
|
|
|
|
|
|
|
}, |
156
|
|
|
|
|
|
|
], |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
{ |
160
|
|
|
|
|
|
|
title => 'All suites', |
161
|
|
|
|
|
|
|
href => '/tapper/overview/suite/all', |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
]; |
164
|
10
|
|
|
10
|
|
11307
|
} |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
47
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
__END__ |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=pod |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=encoding UTF-8 |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 NAME |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Overview |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 AUTHORS |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=over 4 |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item * |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item * |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=back |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Advanced Micro Devices, Inc.. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This is free software, licensed under: |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |