line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Util; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Util::VERSION = '5.0.14'; |
4
|
11
|
|
|
11
|
|
682
|
use Moose; |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
115
|
|
5
|
11
|
|
|
11
|
|
76909
|
use strict; |
|
11
|
|
|
|
|
43
|
|
|
11
|
|
|
|
|
273
|
|
6
|
11
|
|
|
11
|
|
61
|
use warnings; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
374
|
|
7
|
11
|
|
|
11
|
|
224
|
use 5.010; |
|
11
|
|
|
|
|
222
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
5656
|
use Perl6::Junction qw /any/; |
|
11
|
|
|
|
|
80986
|
|
|
11
|
|
|
|
|
3056
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub prepare_top_menu |
13
|
|
|
|
|
|
|
{ |
14
|
18
|
|
|
18
|
1
|
74
|
my ($self, $active) = @_; |
15
|
18
|
|
|
|
|
427
|
my $top_menu = [ |
16
|
|
|
|
|
|
|
{ key => 'start', text => 'Start', uri => "/tapper/start/", }, |
17
|
|
|
|
|
|
|
{ key => 'reports', text => 'Reports', uri => "/tapper/reports", }, |
18
|
|
|
|
|
|
|
{ key => 'testruns', text => 'Testruns', uri => "/tapper/testruns", }, |
19
|
|
|
|
|
|
|
{ key => 'testplans', text => 'Testplans', uri => "/tapper/testplan", }, |
20
|
|
|
|
|
|
|
{ key => 'continuoustestruns', text => 'Continuous Testruns', uri => "/tapper/continuoustestruns",}, |
21
|
|
|
|
|
|
|
{ key => 'metareports', text => 'Metareports', uri => "/tapper/metareports/", }, |
22
|
|
|
|
|
|
|
{ key => 'manual', text => 'Manual', uri => "/tapper/manual/", }, |
23
|
|
|
|
|
|
|
]; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Some keys may be singular with their actions being named in plural or vice versa. Unify this. |
26
|
18
|
100
|
|
|
|
97
|
if ($active) { |
27
|
15
|
|
|
|
|
46
|
$active = lc($active); |
28
|
15
|
|
50
|
|
|
107
|
(my $active_singular) = ($active =~ m/^(.+)s$/) // ''; |
29
|
15
|
|
50
|
|
|
88
|
(my $active_plural) = $active."s" // ''; |
30
|
15
|
100
|
|
|
|
61
|
foreach (@$top_menu) { $_->{active} = 1 if $_->{key} eq any($active, $active_singular, $active_plural) } |
|
105
|
|
|
|
|
2235
|
|
31
|
|
|
|
|
|
|
} |
32
|
18
|
|
|
|
|
342
|
return $top_menu; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding UTF-8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Tapper::Reports::Web::Util |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use Tapper::Reports::Web::Util; |
52
|
|
|
|
|
|
|
my $util = Tapper::Reports::Web::Util->new(); |
53
|
|
|
|
|
|
|
$util->prepare_top_menu($active_system); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Tapper::Reports::Web::Util - Basic utilities for all Tapper::Reports::Web controller |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 prepare_top_menu |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Creates the required datastructure to show the top menu in all pages. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
@param string - active element |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
@return hash ref containing top menu |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
AMD OSRC Tapper Team, C<< <tapper at amd64.org> >> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 BUGS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
None. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SUPPORT |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
perldoc Tapper |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Copyright 2008-2011 AMD OSRC Tapper Team, all rights reserved. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This program is released under the following license: freebsd |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHORS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over 4 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Advanced Micro Devices, Inc.. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software, licensed under: |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |