Francois Gouget : testbot/web: Always return "ro" or false in CollectionBlock::DisplayProperty().

Alexandre Julliard julliard at winehq.org
Wed Apr 20 16:33:32 CDT 2022


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Apr 20 16:17:16 2022 +0200

testbot/web: Always return "ro" or false in CollectionBlock::DisplayProperty().

This better matches FormPage::DisplayProperty() and opens the door to
later extending collection blocks to support edition.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 2 +-
 testbot/web/JobDetails.pl                      | 6 +-----
 testbot/web/PatchesList.pl                     | 5 ++---
 testbot/web/admin/UsersList.pl                 | 3 +--
 testbot/web/admin/VMDetails.pl                 | 4 ++--
 testbot/web/admin/VMsList.pl                   | 5 ++---
 testbot/web/index.pl                           | 5 ++---
 7 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 958cfec..e849d5a 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -179,7 +179,7 @@ sub DisplayProperty($$)
 {
   my ($self, $PropertyDescriptor) = @_;
 
-  return $PropertyDescriptor->GetClass ne "Detailref";
+  return $PropertyDescriptor->GetClass eq "Detailref" ? "" : "ro";
 }
 
 sub GetSortedItems($$)
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 2c7901a..f681ca5 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -49,11 +49,7 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-  return $PropertyName eq "StepNo" || $PropertyName eq "TaskNo" ||
-         $PropertyName eq "Status" || $PropertyName eq "VM" ||
-         $PropertyName eq "Timeout" || $PropertyName eq "FileName" ||
-         $PropertyName eq "CmdLineArg" || $PropertyName eq "Started" ||
-         $PropertyName eq "Ended" || $PropertyName eq "TestFailures";
+  return $PropertyName =~ /^(?:StepNo|TaskNo|Status|VM|Timeout|FileName|CmdLineArg|Started|Ended|TestFailures)$/ ? "ro" : "";
 }
 
 
diff --git a/testbot/web/PatchesList.pl b/testbot/web/PatchesList.pl
index 48c8382..a1c5171 100644
--- a/testbot/web/PatchesList.pl
+++ b/testbot/web/PatchesList.pl
@@ -40,9 +40,8 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-
-  return $PropertyName eq "Received" || $PropertyName eq "Disposition" ||
-         $PropertyName eq "FromName" || $PropertyName eq "Subject";
+  return $PropertyName =~ /^(?:Received|Disposition|FromName|Subject)$/ ? "ro" :
+         "";
 }
 
 sub GenerateDataView($$$)
diff --git a/testbot/web/admin/UsersList.pl b/testbot/web/admin/UsersList.pl
index bc5ced8..368a6ce 100644
--- a/testbot/web/admin/UsersList.pl
+++ b/testbot/web/admin/UsersList.pl
@@ -42,8 +42,7 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-  return $PropertyName eq "Name" || $PropertyName eq "EMail" ||
-         $PropertyName eq "Status" || $PropertyName eq "RealName";
+  return $PropertyName =~ /^(?:Name|EMail|Status|RealName)$/ ? "ro" : "";
 }
 
 sub GenerateDataCell($$$)
diff --git a/testbot/web/admin/VMDetails.pl b/testbot/web/admin/VMDetails.pl
index 35b2681..fd2d40d 100644
--- a/testbot/web/admin/VMDetails.pl
+++ b/testbot/web/admin/VMDetails.pl
@@ -40,8 +40,8 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-  return "" if ($PropertyName =~ /^(?:ChildPid|ChildDeadline|Errors)$/);
-  return $self->SUPER::DisplayProperty($PropertyDescriptor);
+  return $PropertyName =~ /^(?:ChildPid|ChildDeadline|Errors)$/ ? "" :
+         $self->SUPER::DisplayProperty($PropertyDescriptor);
 }
 
 sub Save($)
diff --git a/testbot/web/admin/VMsList.pl b/testbot/web/admin/VMsList.pl
index f8162c6..6c3ff20 100644
--- a/testbot/web/admin/VMsList.pl
+++ b/testbot/web/admin/VMsList.pl
@@ -38,9 +38,8 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-  return $PropertyName eq "Name" || $PropertyName eq "Type" ||
-         $PropertyName eq "Role" || $PropertyName eq "Status" ||
-         $PropertyName eq "Description";
+  return $PropertyName =~ /^(?:Name|Type|Role|Status|Description)$/ ? "ro" :
+         "";
 }
 
 sub OnItemAction($$$)
diff --git a/testbot/web/index.pl b/testbot/web/index.pl
index a189205..0b8a9cb 100644
--- a/testbot/web/index.pl
+++ b/testbot/web/index.pl
@@ -183,9 +183,8 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-  return $PropertyName eq "Name" || $PropertyName eq "Type" ||
-         $PropertyName eq "Role" || $PropertyName eq "Status" ||
-         $PropertyName eq "Description";
+  return $PropertyName =~ /^(?:Name|Type|Role|Status|Description)$/ ? "ro" :
+         "";
 }
 
 




More information about the wine-cvs mailing list