[tools] testbot/web: Show the job start / end dates as tooltips on the job details page.

Francois Gouget fgouget at codeweavers.com
Tue Apr 26 12:32:29 CDT 2022


This also delegates the timestamp formatting to ValueFormatter.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
This also fixes the Time column tooltip because, just like for the main 
index page, they relied on the old ShowDateTime() JavaScript function.
---
 testbot/web/JobDetails.pl | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 591a47ee9..33a952553 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -26,7 +26,8 @@ use ObjectModel::CGI::CollectionBlock;
 our @ISA = qw(ObjectModel::CGI::CollectionBlock);
 
 use URI::Escape;
-use POSIX qw(strftime);
+
+use ObjectModel::CGI::ValueFormatter;
 
 use WineTestBot::Utils;
 use WineTestBot::Missions;
@@ -50,6 +51,7 @@ sub DisplayProperty($$)
 
   my $PropertyName = $PropertyDescriptor->GetName();
   return $PropertyName =~ /^(?:Id|PreviousNo|Type|FileType|Missions)$/ ? "" :
+         $PropertyName eq "Started" ? ("ro", "timetipdate") :
          $self->SUPER::DisplayProperty($PropertyDescriptor);
 }
 
@@ -67,9 +69,13 @@ sub GenerateHeaderView($$$)
   {
     print "Arguments / <span class='MissionHeader'>Missions</span>";
   }
+  elsif ($PropertyName eq "Started")
+  {
+    print "<a class='title' title='Start Date'>Start</a>";
+  }
   elsif ($PropertyName eq "Ended")
   {
-    print "<a class='title' title='Execution ended'>Time</a>";
+    print "<a class='title' title='End Time'>Time</a>";
   }
   else
   {
@@ -129,13 +135,7 @@ sub GenerateDataView($$$)
     if (defined $StepTask->Ended)
     {
       my $Duration = $StepTask->Ended - $StepTask->Started;
-      my $TagId = "E". $StepTask->Id;
-      print "<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'><!--\n";
-      print "  ShowDateTime(", $StepTask->Ended, ",'$TagId');\n";
-      print "--></script>";
+      GenerateTipDateTime($StepTask->Ended, DurationToString($Duration));
     }
     else
     {
-- 
2.30.2




More information about the wine-devel mailing list