line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Util::Filter::Overview; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Util::Filter::Overview::VERSION = '5.0.13'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
40
|
use Moose; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
72
|
|
9
|
10
|
|
|
10
|
|
46219
|
use Hash::Merge::Simple 'merge'; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
575
|
|
10
|
10
|
|
|
10
|
|
46
|
use Set::Intersection 'get_intersection'; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
392
|
|
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
46
|
use Tapper::Model 'model'; |
|
10
|
|
|
|
|
13
|
|
|
10
|
|
|
|
|
2912
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends 'Tapper::Reports::Web::Util::Filter'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub BUILD{ |
17
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
my $args = shift; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self->dispatch( |
21
|
|
|
|
|
|
|
merge($self->dispatch, |
22
|
|
|
|
|
|
|
{like => \&like, |
23
|
|
|
|
|
|
|
weeks => \&weeks, |
24
|
|
|
|
|
|
|
hostname => \&hostname, |
25
|
|
|
|
|
|
|
}) |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub weeks |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $duration) = @_; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $timeframe = DateTime->now->subtract(weeks => $duration); |
36
|
0
|
|
|
|
|
|
my $dtf = model("TestrunDB")->storage->datetime_parser; |
37
|
0
|
|
|
|
|
|
push @{$filter_condition->{late}}, {'reports.created_at' => {'>=' => $dtf->format_datetime($timeframe) }}; |
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $filter_condition; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub like |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $regexp) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
$regexp =~ tr/*/%/; |
48
|
0
|
|
|
|
|
|
$filter_condition->{early}->{name} = { 'like', $regexp} ; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $filter_condition; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub hostname |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
0
|
1
|
|
my ($self, $filter_condition, $regexp) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$regexp =~ tr/*/%/; |
59
|
0
|
|
|
|
|
|
$filter_condition->{early}->{machine_name} = { 'like', $regexp} ; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $filter_condition; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Filter::Overview |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SYNOPSIS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
use Tapper::Overviews::Web::Util::Filter::Overview; |
80
|
|
|
|
|
|
|
my $filter = Tapper::Overviews::Web::Util::Filter::Overview->new(); |
81
|
|
|
|
|
|
|
my $filter_args = ['host','bullock','days','3']; |
82
|
|
|
|
|
|
|
my $allowed_filter_keys = ['host','days']; |
83
|
|
|
|
|
|
|
my $searchoptions = $filter->parse_filters($filter_args, $allowed_filter_keys); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 weeks |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Add weeks filters to early filters. This checks whether the overview |
88
|
|
|
|
|
|
|
element was used in the last given weeks. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
@param hash ref - current version of filters |
91
|
|
|
|
|
|
|
@param int - number of weeks |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
@return hash ref - updated filters |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 like |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Add like filters to early filters. Note that the expected regular |
98
|
|
|
|
|
|
|
expression is not a real regexp. Instead * as wildcard is accepted. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
@param hash ref - current version of filters |
101
|
|
|
|
|
|
|
@param string - like regexp |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
@return hash ref - updated filters |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 hostname |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Add like for the hostname filters to early filters. Note that the expected |
108
|
|
|
|
|
|
|
regular expression is not a real regexp. Instead * as wildcard is |
109
|
|
|
|
|
|
|
accepted. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
@param hash ref - current version of filters |
112
|
|
|
|
|
|
|
@param string - like regexp |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
@return hash ref - updated filters |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 NAME |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Filter::Overview - Filter utilities for overview listing |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHORS |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over 4 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=back |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Advanced Micro Devices, Inc.. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software, licensed under: |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |