line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Util::Filter::Report; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Util::Filter::Report::VERSION = '5.0.15'; |
4
|
13
|
|
|
13
|
|
1042032
|
use strict; |
|
13
|
|
|
|
|
44
|
|
|
13
|
|
|
|
|
383
|
|
5
|
13
|
|
|
13
|
|
72
|
use warnings; |
|
13
|
|
|
|
|
30
|
|
|
13
|
|
|
|
|
325
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
13
|
|
|
13
|
|
72
|
use Moose; |
|
13
|
|
|
|
|
29
|
|
|
13
|
|
|
|
|
126
|
|
11
|
13
|
|
|
13
|
|
98846
|
use Hash::Merge::Simple 'merge'; |
|
13
|
|
|
|
|
6356
|
|
|
13
|
|
|
|
|
813
|
|
12
|
13
|
|
|
13
|
|
5183
|
use Set::Intersection 'get_intersection'; |
|
13
|
|
|
|
|
5304
|
|
|
13
|
|
|
|
|
717
|
|
13
|
|
|
|
|
|
|
|
14
|
13
|
|
|
13
|
|
1120
|
use Tapper::Model 'model'; |
|
13
|
|
|
|
|
1204175
|
|
|
13
|
|
|
|
|
6728
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'Tapper::Reports::Web::Util::Filter'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILD { |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
0
|
53
|
my $self = shift; |
21
|
4
|
|
|
|
|
11
|
my $args = shift; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$self->dispatch( |
24
|
|
|
|
|
|
|
merge( |
25
|
|
|
|
|
|
|
$self->dispatch, |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
suite => \&suite, |
28
|
|
|
|
|
|
|
success => \&success, |
29
|
0
|
|
|
0
|
|
|
owner => sub { hr_set_filter_default( @_, 'owner' ); }, |
30
|
0
|
|
|
0
|
|
|
host => sub { hr_set_filter_default( @_, 'host' ); }, |
31
|
0
|
|
|
0
|
|
|
idlist => sub { hr_set_filter_default( @_, 'report_id' ); }, |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
) |
34
|
4
|
|
|
|
|
134
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub suite |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $suite) = @_; |
42
|
0
|
|
|
|
|
|
my $suite_id; |
43
|
0
|
0
|
|
|
|
|
if ($suite =~/^\d+$/) { |
44
|
0
|
|
|
|
|
|
$suite_id = $suite; |
45
|
|
|
|
|
|
|
} else { |
46
|
0
|
|
|
|
|
|
my $suite_rs = $self->context->model('TestrunDB')->resultset('Suite')->search({name => $suite}); |
47
|
0
|
0
|
|
|
|
|
$suite_id = $suite_rs->search({}, {rows => 1})->first->id if $suite_rs->count; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my @suites; |
51
|
0
|
0
|
|
|
|
|
@suites = @{$filter_condition->{suite_id}} if $filter_condition->{suite_id}; |
|
0
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
push @suites, $suite_id; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$filter_condition->{suite_id} = \@suites; |
55
|
0
|
|
|
|
|
|
return $filter_condition; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub success |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $success) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
if ( $success =~/^\d+$/ ) { |
64
|
0
|
|
0
|
|
|
|
push @{$filter_condition->{success_ratio} ||= []}, int($success); |
|
0
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
0
|
|
0
|
|
|
|
push @{$filter_condition->{successgrade} ||= []}, uc($success); |
|
0
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
return $filter_condition; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub hr_set_filter_default { |
74
|
0
|
|
|
0
|
0
|
|
my ( $or_self, $hr_filter, $value, $s_filter_name ) = @_; |
75
|
0
|
|
0
|
|
|
|
push @{$hr_filter->{$s_filter_name} ||= []}, $value; |
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $hr_filter; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=pod |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=encoding UTF-8 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 NAME |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Filter::Report |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SYNOPSIS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
use Tapper::Reports::Web::Util::Filter::Report; |
94
|
|
|
|
|
|
|
my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c); |
95
|
|
|
|
|
|
|
my $filter_args = ['host','bullock','days','3']; |
96
|
|
|
|
|
|
|
my $allowed_filter_keys = ['host','days']; |
97
|
|
|
|
|
|
|
my $searchoptions = $filter->parse_filters($filter_args, $allowed_filter_keys); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 suite |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Add test suite to early filters. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
@param hash ref - current version of filters |
104
|
|
|
|
|
|
|
@param string - suite name or id |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
@return hash ref - updated filters |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 success |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Add success filters to early filters. Valid values are pass, fail and a |
111
|
|
|
|
|
|
|
ratio in percent. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
@param hash ref - current version of filters |
114
|
|
|
|
|
|
|
@param string - success grade |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
@return hash ref - updated filters |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 NAME |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Filter::Report - Filter utilities for report listing |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHORS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=over 4 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Advanced Micro Devices, Inc.. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This is free software, licensed under: |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |