Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
tor-browser-bundle-testsuite
Commits
eac7664c
Unverified
Commit
eac7664c
authored
Aug 29, 2014
by
boklm
Browse files
Add per month reports index
parent
20efa6d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
TBBTestSuite/Reports.pm
View file @
eac7664c
...
@@ -16,6 +16,7 @@ use TBBTestSuite::Options qw($options);
...
@@ -16,6 +16,7 @@ use TBBTestSuite::Options qw($options);
use
TBBTestSuite::
Tests
;
use
TBBTestSuite::
Tests
;
use
Email::
Simple
;
use
Email::
Simple
;
use
Email::Sender::
Simple
qw(try_to_sendmail)
;
use
Email::Sender::
Simple
qw(try_to_sendmail)
;
use
DateTime
;
our
(
@ISA
,
@EXPORT_OK
);
our
(
@ISA
,
@EXPORT_OK
);
BEGIN
{
BEGIN
{
...
@@ -102,15 +103,22 @@ sub report_type {
...
@@ -102,15 +103,22 @@ sub report_type {
return
'
browserbundle
';
return
'
browserbundle
';
}
}
sub
date_month
{
my
$dt
=
DateTime
->
from_epoch
(
epoch
=>
$_
[
0
]);
return
$dt
->
year
.
'
-
'
.
sprintf
("
%02d
",
$dt
->
month
);
}
sub
make_reports_index
{
sub
make_reports_index
{
my
(
$changed_report
)
=
@_
;
my
(
$changed_report
)
=
@_
;
my
%pre_reports_index
;
my
%pre_reports_index
;
my
@changed_tags
;
my
@changed_tags
;
my
@changed_type
;
my
@changed_type
;
my
@changed_month
;
if
(
$changed_report
)
{
if
(
$changed_report
)
{
@changed_tags
=
$changed_report
->
{
options
}{
tags
}
?
@changed_tags
=
$changed_report
->
{
options
}{
tags
}
?
@
{
$changed_report
->
{
options
}{
tags
}}
:
();
@
{
$changed_report
->
{
options
}{
tags
}}
:
();
push
@changed_type
,
report_type
(
$changed_report
);
push
@changed_type
,
report_type
(
$changed_report
);
push
@changed_month
,
date_month
(
$changed_report
->
{
time
});
}
}
copy_static
;
copy_static
;
my
$template
=
Template
->
new
(
my
$template
=
Template
->
new
(
...
@@ -128,6 +136,7 @@ sub make_reports_index {
...
@@ -128,6 +136,7 @@ sub make_reports_index {
sort
{
$reports
{
$b
}
->
{
time
}
<=>
$reports
{
$a
}
->
{
time
}
}
keys
%reports
;
sort
{
$reports
{
$b
}
->
{
time
}
<=>
$reports
{
$a
}
->
{
time
}
}
keys
%reports
;
my
%reports_by_tag
;
my
%reports_by_tag
;
my
%reports_by_type
;
my
%reports_by_type
;
my
%reports_by_month
;
foreach
my
$report
(
keys
%summaries
)
{
foreach
my
$report
(
keys
%summaries
)
{
my
$type
=
$summaries
{
$report
}
->
{
type
};
my
$type
=
$summaries
{
$report
}
->
{
type
};
push
@
{
$reports_by_type
{
$type
}},
$report
;
push
@
{
$reports_by_type
{
$type
}},
$report
;
...
@@ -135,6 +144,8 @@ sub make_reports_index {
...
@@ -135,6 +144,8 @@ sub make_reports_index {
foreach
my
$tag
(
@$tags
)
{
foreach
my
$tag
(
@$tags
)
{
push
@
{
$reports_by_tag
{
$type
}
->
{
$tag
}},
$report
;
push
@
{
$reports_by_tag
{
$type
}
->
{
$tag
}},
$report
;
}
}
my
$month
=
date_month
(
$summaries
{
$report
}
->
{
time
});
push
@
{
$reports_by_month
{
$type
}
->
{
$month
}},
$report
;
}
}
my
$vars
=
{
my
$vars
=
{
%template_functions
,
%template_functions
,
...
@@ -142,6 +153,7 @@ sub make_reports_index {
...
@@ -142,6 +153,7 @@ sub make_reports_index {
reports_list
=>
\
@reports_by_time
,
reports_list
=>
\
@reports_by_time
,
reports_by_type
=>
\
%reports_by_type
,
reports_by_type
=>
\
%reports_by_type
,
reports_by_tag
=>
\
%reports_by_tag
,
reports_by_tag
=>
\
%reports_by_tag
,
reports_by_month
=>
\
%reports_by_month
,
};
};
$template
->
process
('
reports_index.html
',
$vars
,
'
index.html
')
$template
->
process
('
reports_index.html
',
$vars
,
'
index.html
')
||
exit_error
"
Template Error:
\n
"
.
$template
->
error
;
||
exit_error
"
Template Error:
\n
"
.
$template
->
error
;
...
@@ -171,6 +183,19 @@ sub make_reports_index {
...
@@ -171,6 +183,19 @@ sub make_reports_index {
||
exit_error
"
Template Error:
\n
"
.
$template
->
error
;
||
exit_error
"
Template Error:
\n
"
.
$template
->
error
;
}
}
}
}
foreach
my
$type
(
$changed_report
?
@changed_type
:
keys
%reports_by_month
)
{
foreach
my
$month
(
$changed_report
?
@changed_month
:
keys
%
{
$reports_by_month
{
$type
}})
{
my
@s
=
sort
{
$summaries
{
$b
}
->
{
time
}
<=>
$summaries
{
$a
}
->
{
time
}
}
@
{
$reports_by_month
{
$type
}
->
{
$month
}};
load_reports_for_index
(
\
%pre_reports_index
,
@s
);
my
$title
=
"
$month
reports
";
$template
->
process
("
reports_index_
$type
.html
",
{
%$vars
,
reports_list
=>
\
@s
,
title
=>
$title
,
},
"
index-
$type
-
$month
.html
")
||
exit_error
"
Template Error:
\n
"
.
$template
->
error
;
}
}
}
}
sub
text_report
{
sub
text_report
{
...
...
tmpl/reports_index.html
View file @
eac7664c
...
@@ -28,14 +28,27 @@
...
@@ -28,14 +28,27 @@
<ul>
<ul>
[% FOREACH type IN reports_by_type.keys.sort %]
[% FOREACH type IN reports_by_type.keys.sort %]
<li><a
href=
"index-[% type %].html"
>
[% type %] reports
</a>
<li><a
href=
"index-[% type %].html"
>
[% type %] reports
</a>
[% IF reports_by_month.$type %]
<div>
Months:
<ul>
[% FOREACH month IN reports_by_month.$type.keys.sort %]
<li><a
href=
"index-[% type %]-[% month %].html"
>
[% month %]
</a></li>
[% END %]
</ul>
</div>
[% END %]
[% IF reports_by_tag.$type %]
[% IF reports_by_tag.$type %]
<ul>
<div>
[% FOREACH tag IN reports_by_tag.$type.keys %]
Tags:
<li><a
href=
"index-[% type %]-[% tag %].html"
>
[% tag %]
</a></li>
<ul>
[% FOREACH tag IN reports_by_tag.$type.keys %]
<li><a
href=
"index-[% type %]-[% tag %].html"
>
[% tag %]
</a></li>
[% END %]
</ul>
[% END %]
[% END %]
</ul>
</li>
[% END %]
</div>
</li>
[% END %]
[% END %]
</ul>
</ul>
</body>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment