line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Util::Filter::Testrun; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Util::Filter::Testrun::VERSION = '5.0.13'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
42
|
use Moose; |
|
10
|
|
|
|
|
11
|
|
|
10
|
|
|
|
|
57
|
|
9
|
10
|
|
|
10
|
|
43948
|
use Hash::Merge::Simple 'merge'; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
529
|
|
10
|
10
|
|
|
10
|
|
49
|
use Set::Intersection 'get_intersection'; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
396
|
|
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
41
|
use Tapper::Model 'model'; |
|
10
|
|
|
|
|
11
|
|
|
10
|
|
|
|
|
3889
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends 'Tapper::Reports::Web::Util::Filter'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub BUILD { |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
19
|
0
|
|
|
|
|
|
my $args = shift; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self->dispatch( |
22
|
|
|
|
|
|
|
merge( |
23
|
|
|
|
|
|
|
$self->dispatch, |
24
|
|
|
|
|
|
|
{ |
25
|
|
|
|
|
|
|
host => \&host, |
26
|
|
|
|
|
|
|
owner => \&owner, |
27
|
0
|
|
|
0
|
|
|
state => sub { hr_set_filter_default( @_, 'state' ); }, |
28
|
0
|
|
|
0
|
|
|
success => sub { hr_set_filter_default( @_, 'success' ); }, |
29
|
0
|
|
|
0
|
|
|
topic => sub { hr_set_filter_default( @_, 'topic' ); }, |
30
|
0
|
|
|
0
|
|
|
idlist => sub { hr_set_filter_default( @_, 'testrun_id' ); }, |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
) |
33
|
0
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub host |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $host) = @_; |
41
|
0
|
|
|
|
|
|
my $host_result = model('TestrunDB')->resultset('Host')->search({name => $host}, {rows => 1})->first; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# (XXX) do we need to throw an error when someone filters for an unknown host? |
44
|
0
|
0
|
|
|
|
|
if (not $host_result) { |
45
|
0
|
|
|
|
|
|
return $filter_condition; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
0
|
|
|
|
push @{$filter_condition->{host} ||= []}, $host_result->id; |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $filter_condition; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub owner |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $owner) = @_; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $owner_result = model('TestrunDB')->resultset('Owner')->search({login => $owner}, {rows => 1})->first; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if (not $owner_result) { |
62
|
0
|
|
|
|
|
|
$filter_condition->{error} = "No owner with login '$owner' found"; |
63
|
0
|
|
|
|
|
|
return $filter_condition; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
0
|
|
|
|
push @{$filter_condition->{owner} ||= []}, $owner_result->id; |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $filter_condition; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub hr_set_filter_default { |
72
|
0
|
|
|
0
|
0
|
|
my ( $or_self, $hr_filter, $value, $s_filter_name ) = @_; |
73
|
0
|
|
0
|
|
|
|
push @{$hr_filter->{$s_filter_name} ||= []}, $value; |
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return $hr_filter; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding UTF-8 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Filter::Testrun |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
use Tapper::Testruns::Web::Util::Filter::Testrun; |
92
|
|
|
|
|
|
|
my $filter = Tapper::Testruns::Web::Util::Filter::Testrun->new(); |
93
|
|
|
|
|
|
|
my $filter_args = ['host','bullock','days','3']; |
94
|
|
|
|
|
|
|
my $allowed_filter_keys = ['host','days']; |
95
|
|
|
|
|
|
|
my $searchoptions = $filter->parse_filters($filter_args, $allowed_filter_keys); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 host |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Add host filters to early filters. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
@param hash ref - current version of filters |
102
|
|
|
|
|
|
|
@param string - host name |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
@return hash ref - updated filters |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 owner |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Add owner filters to early filters. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
@param hash ref - current version of filters |
111
|
|
|
|
|
|
|
@param string - owner login |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
@return hash ref - updated filters |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 NAME |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Filter::Testrun - Filter utilities for testrun listing |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHORS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over 4 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=back |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Advanced Micro Devices, Inc.. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This is free software, licensed under: |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |