This better matches FormPage::DisplayProperty() and opens the door to later extending collection blocks to support edition.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- 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 3e3ee2952..bd0c8f6eb 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 2c7901a75..f681ca5d6 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 48c8382e7..a1c5171df 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 bc5ced8a7..368a6ceac 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 35b26811a..fd2d40de3 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 f8162c63e..6c3ff2036 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 a18920533..0b8a9cb78 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" : + ""; }
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/web/JobDetails.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl index f681ca5d6..e39df41b5 100644 --- a/testbot/web/JobDetails.pl +++ b/testbot/web/JobDetails.pl @@ -49,7 +49,8 @@ sub DisplayProperty($$) my ($self, $PropertyDescriptor) = @_;
my $PropertyName = $PropertyDescriptor->GetName(); - return $PropertyName =~ /^(?:StepNo|TaskNo|Status|VM|Timeout|FileName|CmdLineArg|Started|Ended|TestFailures)$/ ? "ro" : ""; + return $PropertyName =~ /^(?:Id|PreviousNo|Type|FileType|Missions)$/ ? "" : + $self->SUPER::DisplayProperty($PropertyDescriptor); }