Francois Gouget : testbot/web: Show the job and task run time.
Alexandre Julliard
julliard at winehq.org
Thu Dec 6 12:25:26 CST 2018
Module: tools
Branch: master
Commit: 3d2b36946eb1ee9e22b476e93e09162b117c6949
URL: https://source.winehq.org/git/tools.git/?a=commit;h=3d2b36946eb1ee9e22b476e93e09162b117c6949
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Dec 5 14:02:31 2018 +0100
testbot/web: Show the job and task run time.
The run time is shown instead of the end time, though the latter is
still visible as a tooltip.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 19 ++++++++++----
testbot/web/JobDetails.pl | 35 ++++++++++++++++++++++++++
testbot/web/index.pl | 35 ++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 5 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 105280e..f9e590c 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -81,12 +81,21 @@ function Pad2(n)
{
return n < 10 ? '0' + n : n;
}
-function ShowDateTime(Sec1970)
+
+function ShowDateTime(Sec1970, Id, Attr)
{
var Dt = new Date(Sec1970 * 1000);
- document.write(Dt.getFullYear() + '/' + Pad2(Dt.getMonth() + 1) + '/' +
- Pad2(Dt.getDate()) + ' ' + Pad2(Dt.getHours()) + ':' +
- Pad2(Dt.getMinutes()) + ':' + Pad2(Dt.getSeconds()));
+ var Pretty = Dt.getFullYear() + '/' + Pad2(Dt.getMonth() + 1) + '/' +
+ Pad2(Dt.getDate()) + ' ' + Pad2(Dt.getHours()) + ':' +
+ Pad2(Dt.getMinutes()) + ':' + Pad2(Dt.getSeconds())
+ if (Id != null)
+ {
+ document.getElementById(Id).setAttribute(Attr || "title", Pretty);
+ }
+ else
+ {
+ document.write(Pretty);
+ }
}
//--></script>
EOF
@@ -450,7 +459,7 @@ sub GetDisplayValue($$$)
{
if (defined($Value))
{
-$Value =
+ $Value =
"<noscript><div>" .
strftime("%Y/%m/%d %H:%M:%S", localtime($Value)) . "</div></noscript>\n" .
"<script type='text/javascript'><!--\n" .
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 6c8c7ce..92f9d19 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -26,12 +26,14 @@ use ObjectModel::CGI::CollectionPage;
our @ISA = qw(ObjectModel::CGI::CollectionPage);
use File::Basename;
+use POSIX qw(strftime);
use URI::Escape;
use WineTestBot::Config;
use WineTestBot::Jobs;
use WineTestBot::LogUtils;
use WineTestBot::StepsTasks;
+use WineTestBot::Utils;
use WineTestBot::Engine::Notify;
@@ -85,6 +87,21 @@ sub DisplayProperty($$$)
$PropertyName eq "Ended" || $PropertyName eq "TestFailures";
}
+sub GenerateHeaderCell($$$)
+{
+ my ($self, $CollectionBlock, $PropertyDescriptor) = @_;
+
+ my $PropertyName = $PropertyDescriptor->GetName();
+ if ($PropertyName eq "Ended")
+ {
+ print "<th><a class='title' title='Execution ended'>Time</a></th>\n";
+ }
+ else
+ {
+ return $self->SUPER::GenerateHeaderCell($CollectionBlock, $PropertyDescriptor);
+ }
+}
+
sub GetItemActions($$)
{
#my ($self, $CollectionBlock) = @_;
@@ -572,6 +589,24 @@ sub GenerateDataCell($$$$$)
$self->SUPER::GenerateDataCell($CollectionBlock, $StepTask, $PropertyDescriptor, $DetailsPage);
}
}
+ elsif ($PropertyName eq "Ended")
+ {
+ if (defined $StepTask->Ended)
+ {
+ my $Duration = $StepTask->Ended - $StepTask->Started;
+ my $TagId = "E". $StepTask->Id;
+ print "<td><a id='$TagId' class='title' title='",
+ strftime("%Y/%m/%d %H:%M:%S", localtime($StepTask->Ended)),
+ "'>", DurationToString($Duration), "</a>\n";
+ print "<script type='text/javascript'><!-- ShowDateTime(",
+ $StepTask->Ended, ",'$TagId'); --></script>\n";
+ print "</td>\n";
+ }
+ else
+ {
+ print "<td> </td>\n";
+ }
+ }
else
{
$self->SUPER::GenerateDataCell($CollectionBlock, $StepTask, $PropertyDescriptor, $DetailsPage);
diff --git a/testbot/web/index.pl b/testbot/web/index.pl
index 37b41ea..99d7b70 100644
--- a/testbot/web/index.pl
+++ b/testbot/web/index.pl
@@ -24,10 +24,12 @@ package JobStatusBlock;
use ObjectModel::CGI::CollectionBlock;
our @ISA = qw(ObjectModel::CGI::CollectionBlock);
+use POSIX qw(strftime);
use URI::Escape;
use WineTestBot::Branches;
use WineTestBot::Users;
+use WineTestBot::Utils;
@@ -66,6 +68,21 @@ sub DisplayProperty($$)
return $self->SUPER::DisplayProperty($PropertyDescriptor);
}
+sub GenerateHeaderCell($$$)
+{
+ my ($self, $PropertyDescriptor) = @_;
+
+ my $PropertyName = $PropertyDescriptor->GetName()
+ if ($PropertyName eq "Ended")
+ {
+ print "<th><a class='title' title='Ended'>Time</a></th>\n";
+ }
+ else
+ {
+ return $self->SUPER::GenerateHeaderCell($PropertyDescriptor);
+ }
+}
+
sub GetDisplayValue($$$)
{
my ($self, $Item, $PropertyDescriptor) = @_;
@@ -135,6 +152,24 @@ sub GenerateDataCell($$$$)
}
print "</a></td>\n";
}
+ elsif ($PropertyName eq "Ended")
+ {
+ if (defined $Item->Ended)
+ {
+ my $Duration = $Item->Ended - $Item->Submitted;
+ my $TagId = "E". $Item->Id;
+ print "<td><a id='$TagId' class='title' title='",
+ strftime("%Y/%m/%d %H:%M:%S", localtime($Item->Ended)),
+ "'>", DurationToString($Duration), "</a>\n";
+ print "<script type='text/javascript'><!-- ShowDateTime(",
+ $Item->Ended, ",'$TagId'); --></script>\n";
+ print "</td>\n";
+ }
+ else
+ {
+ print "<td> </td>\n";
+ }
+ }
else
{
$self->SUPER::GenerateDataCell($Item, $PropertyDescriptor, $DetailsPage);
More information about the wine-cvs
mailing list