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(a)codeweavers.com>
---
Knowing how long a test took, particularly for individual tasks, seems
more useful and meaningful than knowing when it ended (even if you can
derive the former from the latter by doing enough math in your head).
.../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 105280e30e..f9e590c808 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 6c8c7ce40c..92f9d19721 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 37b41eae8a..99d7b70bfd 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);
--
2.19.2