Francois Gouget : testbot/web: Add a task failures block to the failure details page.

Alexandre Julliard julliard at winehq.org
Thu Jun 16 16:13:56 CDT 2022


Module: tools
Branch: master
Commit: e255846b2fe7fed68da23539fd7d4100cef5e20b
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=e255846b2fe7fed68da23539fd7d4100cef5e20b

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jun 16 17:22:15 2022 +0200

testbot/web: Add a task failures block to the failure details page.

This allows reviewing all instances of a given failure.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48912
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/web/FailureDetails.pl | 101 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/testbot/web/FailureDetails.pl b/testbot/web/FailureDetails.pl
index 7cab1d2a..ab7d1311 100644
--- a/testbot/web/FailureDetails.pl
+++ b/testbot/web/FailureDetails.pl
@@ -19,6 +19,93 @@
 
 use strict;
 
+
+package TaskFailuresBlock;
+
+use ObjectModel::CGI::CollectionBlock;
+our @ISA = qw(ObjectModel::CGI::CollectionBlock);
+
+use ObjectModel::BasicPropertyDescriptor;
+use ObjectModel::CGI::ValueFormatter;
+
+use WineTestBot::Jobs;
+use WineTestBot::Utils;
+
+
+sub GetPropertyDescriptors($)
+{
+  my ($self) = @_;
+
+  # Add some extra columns
+  my @PropertyDescriptors;
+  foreach my $PropertyDescriptor (@{$self->{Collection}->GetPropertyDescriptors()})
+  {
+    my $PropertyName = $PropertyDescriptor->GetName();
+    next if ($PropertyName =~ /^(?:JobId|StepNo|TaskNo)$/);
+    push @PropertyDescriptors, $PropertyDescriptor;
+    if ($PropertyName eq "TaskLog")
+    {
+      push @PropertyDescriptors, CreateBasicPropertyDescriptor("Date", "Date", !1, !1, "DT", 19);
+    }
+  }
+  push @PropertyDescriptors, CreateBasicPropertyDescriptor("Remarks", "Remarks", !1, !1, "A", 128);
+
+  return \@PropertyDescriptors;
+}
+
+sub GenerateHeaderView($$$)
+{
+  my ($self, $Row, $Col) = @_;
+
+  my $PropertyName = $Col->{Descriptor}->GetName();
+  if ($PropertyName eq "NewCount" or $PropertyName eq "OldCount")
+  {
+    $PropertyName =~ s/Count$//;
+    print "<a class='title' title='", $self->escapeHTML($Col->{Descriptor}->GetDisplayName()), "'>$PropertyName</a>\n";
+  }
+  else
+  {
+    $self->SUPER::GenerateHeaderView($Row, $Col);
+  }
+}
+
+sub GenerateDataView($$$)
+{
+  my ($self, $Row, $Col) = @_;
+
+  my $PropertyName = $Col->{Descriptor}->GetName();
+  if ($PropertyName eq "Task")
+  {
+    my $JobId = $Row->{Item}->JobId;
+    my $StepNo = $Row->{Item}->StepNo;
+    my $TaskNo = $Row->{Item}->TaskNo;
+    my $URL = GetTaskURL($JobId, $StepNo, $TaskNo);
+    print "<a href='", $self->escapeHTML($URL), "'>$JobId/$StepNo/$TaskNo</a>";
+  }
+  elsif ($PropertyName eq "TaskLog")
+  {
+    my $URL = GetTaskURL($Row->{Item}->JobId, $Row->{Item}->StepNo,
+                         $Row->{Item}->TaskNo, 0, $Row->{Item}->TaskLog);
+    print "<a href='", $self->escapeHTML($URL), "'>",
+          $self->escapeHTML($Row->{Item}->TaskLog), "</a>";
+  }
+  elsif ($PropertyName eq "Date")
+  {
+    # The enclosing page already pulled in the datetime JavaScript code
+    GenerateDateTime($Row->{Item}->Task->Started);
+  }
+  elsif ($PropertyName eq "Remarks")
+  {
+    my $Job = CreateJobs()->GetItem($Row->{Item}->JobId);
+    print $self->escapeHTML($Job->Remarks);
+  }
+  else
+  {
+    $self->SUPER::GenerateDataView($Row, $Col);
+  }
+}
+
+
 package FailureDetailsPage;
 
 use ObjectModel::CGI::ItemPage;
@@ -71,6 +158,20 @@ sub GenerateValueView($$$$)
   }
 }
 
+sub GenerateBody($)
+{
+  my ($self) = @_;
+
+  $self->SUPER::GenerateBody();
+  if (!$self->{Item}->GetIsNew())
+  {
+    print "<h2><a name='TaskFailures'></a>Task Failures</h2>\n";
+    my $TaskFailuresBlock = new TaskFailuresBlock($self->{Item}->TaskFailures, $self);
+    $TaskFailuresBlock->SetReadWrite(0) if (!$self->{RW});
+    $TaskFailuresBlock->GenerateList();
+  }
+}
+
 sub GenerateFooter($)
 {
   my ($self) = @_;




More information about the wine-cvs mailing list