| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Controller::Tapper::Rss; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
|
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Controller::Tapper::Rss::VERSION = '5.0.14'; |
|
4
|
10
|
|
|
10
|
|
10882
|
use XML::Feed; |
|
|
10
|
|
|
|
|
1983678
|
|
|
|
10
|
|
|
|
|
384
|
|
|
5
|
10
|
|
|
10
|
|
102
|
use DateTime; |
|
|
10
|
|
|
|
|
25
|
|
|
|
10
|
|
|
|
|
238
|
|
|
6
|
10
|
|
|
10
|
|
5493
|
use Tapper::Reports::Web::Util::Filter::Report; |
|
|
10
|
|
|
|
|
44
|
|
|
|
10
|
|
|
|
|
473
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
92
|
use parent 'Catalyst::Controller'; |
|
|
10
|
|
|
|
|
28
|
|
|
|
10
|
|
|
|
|
107
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
10
|
|
|
10
|
|
877
|
use common::sense; |
|
|
10
|
|
|
|
|
26
|
|
|
|
10
|
|
|
|
|
53
|
|
|
11
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub index :Path :Args() |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
0
|
|
|
0
|
|
|
my ($self,$c, @args) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c); |
|
19
|
0
|
|
|
|
|
|
my $dtf = $c->model("TestrunDB")->storage->datetime_parser; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $feed = XML::Feed->new('RSS'); |
|
22
|
0
|
|
|
|
|
|
$feed->title( 'Tapper RSS Feed' ); |
|
23
|
0
|
|
|
|
|
|
$feed->link( $c->req->base ); # link to the site. |
|
24
|
0
|
|
|
|
|
|
$feed->description('Tapper Reports '); |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $feed_entry; |
|
27
|
|
|
|
|
|
|
my $title; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $filter_condition; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$filter_condition = $filter->parse_filters(\@args); |
|
32
|
0
|
0
|
|
|
|
|
if ( defined $filter_condition->{error} ) { |
|
33
|
0
|
|
|
|
|
|
$feed_entry = XML::Feed::Entry->new('RSS'); |
|
34
|
0
|
|
|
|
|
|
$feed_entry->title( $filter_condition->{error} ); |
|
35
|
0
|
|
|
|
|
|
$feed_entry->issued( DateTime->now ); |
|
36
|
0
|
|
|
|
|
|
$feed->add_entry($feed_entry); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# default 2 days |
|
40
|
0
|
0
|
|
|
|
|
if (not $filter_condition->{early}{created_at}) { |
|
41
|
0
|
|
|
|
|
|
my $now = DateTime->now(); |
|
42
|
0
|
|
|
|
|
|
$now->subtract(days => 2); |
|
43
|
0
|
|
|
|
|
|
$filter_condition->{early}{created_at} = {'>' => $dtf->format_datetime($now) }; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $reports = $c->model('TestrunDB')->resultset('Report')->search |
|
48
|
|
|
|
|
|
|
( |
|
49
|
|
|
|
|
|
|
$filter_condition->{early}, |
|
50
|
|
|
|
|
|
|
{ |
|
51
|
0
|
|
|
|
|
|
columns => [ qw( id |
|
52
|
|
|
|
|
|
|
suite_id |
|
53
|
|
|
|
|
|
|
created_at |
|
54
|
|
|
|
|
|
|
machine_name |
|
55
|
|
|
|
|
|
|
success_ratio |
|
56
|
|
|
|
|
|
|
successgrade |
|
57
|
|
|
|
|
|
|
total |
|
58
|
|
|
|
|
|
|
)], |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
); |
|
61
|
0
|
|
|
|
|
|
foreach my $filter (@{$filter_condition->{late}}) { |
|
|
0
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$reports = $reports->search($filter); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Process the entries |
|
67
|
0
|
|
|
|
|
|
while (my $report = $reports->next) { |
|
68
|
0
|
|
|
|
|
|
$feed_entry = XML::Feed::Entry->new('RSS'); |
|
69
|
0
|
|
|
|
|
|
$title = $report->successgrade; |
|
70
|
0
|
|
0
|
|
|
|
$title .= " ".($report->success_ratio // 0)."%"; |
|
71
|
0
|
0
|
|
|
|
|
$title .= " ".($report->suite ? $report->suite->name : 'unknown suite'); |
|
72
|
0
|
|
|
|
|
|
$title .= " @ "; |
|
73
|
0
|
|
0
|
|
|
|
$title .= $report->machine_name || 'unknown machine'; |
|
74
|
0
|
|
|
|
|
|
$feed_entry->title( $title ); |
|
75
|
0
|
|
|
|
|
|
$feed_entry->link( $c->req->base->as_string.'tapper/reports/id/'.$report->id ); |
|
76
|
0
|
|
|
|
|
|
$feed_entry->issued( $report->created_at ); |
|
77
|
0
|
|
|
|
|
|
$feed->add_entry($feed_entry); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$c->res->body( $feed->as_xml ); |
|
81
|
10
|
|
|
10
|
|
5728
|
} |
|
|
10
|
|
|
|
|
29
|
|
|
|
10
|
|
|
|
|
118
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=pod |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=encoding UTF-8 |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 NAME |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Rss |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Catalyst Controller. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 index |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Controller for RSS feeds of results reported to Tapper Reports |
|
102
|
|
|
|
|
|
|
Framework. The function expectes an unrestricted number of arguments |
|
103
|
|
|
|
|
|
|
that are interpreted as filters. Thus, the arguments need to be in pairs |
|
104
|
|
|
|
|
|
|
of $filter_type/$filter_value. Since index is a catalyst function the |
|
105
|
|
|
|
|
|
|
typical catalyst arguments $self and $c do not occur in the API doc. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
@param array - filter arguments |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 NAME |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Hardware - Catalyst Controller |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 METHODS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 AUTHOR |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Steffen Schwigon,,, |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 LICENSE |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This program is released under the following license: freebsd |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHORS |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over 4 |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Advanced Micro Devices, Inc.. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This is free software, licensed under: |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |