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@codeweavers.com --- 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 fb743a00..7489f835 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 d66109c0..c5d3b532 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 f5e5520b..7b562a74 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;