Francois Gouget : testbot: Record and show status changes initiated by the administrator.

Alexandre Julliard julliard at winehq.org
Fri Dec 29 12:59:17 CST 2017


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Fri Dec 29 00:23:56 2017 +0100

testbot: Record and show status changes initiated by the administrator.

This allows marking them as initiated by the administrator (which is
obvious when going in/out of maintenance but not otherwise).
Merge these records with the one the scheduler adds on its own to keep
the activity page clean.

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

---

 testbot/lib/ObjectModel/CGI/FormPage.pm | 10 +++++++++-
 testbot/lib/WineTestBot/Activity.pm     | 12 +++++++++++-
 testbot/web/admin/VMDetails.pl          | 21 +++++++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index fb743a0..7489f83 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -358,7 +358,7 @@ sub SaveProperty($$$)
   die "Pure virtual function FormPage::SaveProperty called";
 }
 
-sub Save($)
+sub SaveProperties($)
 {
   my ($self) = @_;
 
@@ -389,6 +389,14 @@ sub Save($)
       }
     }
   }
+  return 1;
+}
+
+sub Save($)
+{
+  my ($self) = @_;
+
+  return !1 if (!$self->SaveProperties());
 
   my $ErrKey;
   ($ErrKey, $self->{ErrField}, $self->{ErrMessage}) = $self->{Collection}->Save();
diff --git a/testbot/lib/WineTestBot/Activity.pm b/testbot/lib/WineTestBot/Activity.pm
index 1e414c8..5a5d232 100644
--- a/testbot/lib/WineTestBot/Activity.pm
+++ b/testbot/lib/WineTestBot/Activity.pm
@@ -233,7 +233,17 @@ sub GetActivity($)
       my $VMStatus = $StatusVMs->{$VM->Name};
       if ($VMStatus)
       {
-        $LastVMStatus->{end} = $VMStatus->{start} if ($LastVMStatus);
+        if ($LastVMStatus and $LastVMStatus->{status} eq $VMStatus->{status} and
+            ($LastVMStatus->{details} || "") eq "administrator")
+        {
+          $VMStatus = $StatusVMs->{$VM->Name} = $LastVMStatus;
+          $LastStatusVMs{$VM->Name}->{$VM->Name} = {merged => 1, vmstatus => $VMStatus};
+          $VMStatus->{rows}++;
+        }
+        else
+        {
+          $LastVMStatus->{end} = $VMStatus->{start} if ($LastVMStatus);
+        }
       }
       elsif ($LastVMStatus and $LastVMStatus->{status} ne "engine")
       {
diff --git a/testbot/web/admin/VMDetails.pl b/testbot/web/admin/VMDetails.pl
index f5e5520..7b562a7 100644
--- a/testbot/web/admin/VMDetails.pl
+++ b/testbot/web/admin/VMDetails.pl
@@ -42,6 +42,27 @@ sub DisplayProperty($$)
   return $self->SUPER::DisplayProperty($PropertyDescriptor);
 }
 
+sub Save($)
+{
+  my ($self) = @_;
+
+  my $OldStatus = $self->{Item}->Status || "";
+  return !1 if (!$self->SaveProperties());
+
+  if ($OldStatus ne $self->{Item}->Status)
+  {
+    my ($ErrProperty, $ErrMessage) = $self->{Item}->Validate();
+    if (!defined $ErrMessage)
+    {
+      $self->{Item}->RecordStatus(undef, $self->{Item}->Status ." administrator");
+    }
+  }
+
+  my $ErrKey;
+  ($ErrKey, $self->{ErrField}, $self->{ErrMessage}) = $self->{Collection}->Save();
+  return ! defined($self->{ErrMessage});
+}
+
 package main;
 
 my $Request = shift;




More information about the wine-cvs mailing list