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@codeweavers.com --- testbot/web/FailureDetails.pl | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+)
diff --git a/testbot/web/FailureDetails.pl b/testbot/web/FailureDetails.pl index c05146448..c510d8d48 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) = @_;