[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 08/82] host reuse: ms-planner: Bring some variables forward



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Move the scope of $share earlier in cmd_show_html, and also introduce
$shared in the colour computation.  This makes the next changes easier.

No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 ms-planner | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/ms-planner b/ms-planner
index 11423404..d9f3db91 100755
--- a/ms-planner
+++ b/ms-planner
@@ -677,6 +677,7 @@ sub cmd_show_html () {
        my $shares;
        foreach my $evt (@{ $plan->{Events}{$reso} }) {
            my $type= $evt->{Type};
+           my $share= $evt->{Share};
            my $show=
                $type eq End ? ($evt->{Share} ? "End $evt->{Info}" : "") :
                 $type eq Unshare ? "$type [".showsharetype($evt->{Info})."]" :
@@ -685,7 +686,6 @@ sub cmd_show_html () {
                (!$evt->{Allocated} ? Booking :
                  ($evt->{Allocated}{Live} ? Allocation : Completed).
                  " $evt->{Allocated}{Task}")." ".$evt->{Info};
-           my $share= $evt->{Share};
            if ($share) {
                $show .= sprintf(" [%s %d/%d %d]",
                                 showsharetype($share->{Type}),
@@ -789,15 +789,16 @@ sub cmd_show_html () {
                     $content->{Avail} ||
                     $content->{Type} eq After ||
                     ($content->{Allocated} && !$content->{Allocated}{Live});
+                my $shared = $content->{Share};
                 my $bgcolour=
                     $avail ?
-                    ($content->{Share} ? "#ccccff" : "#ffffff") :
+                    ($shared ? "#ccccff" : "#ffffff") :
                     $content->{Type} eq Overrun ?
-                    ($content->{Share} ? "#443344" : "#442222") :
+                    ($shared ? "#443344" : "#442222") :
                     $content->{Allocated} ?
-                    ($content->{Share} ? "#882288" : "#882222")
+                    ($shared ? "#882288" : "#882222")
                     :
-                    ($content->{Share} ? "#005555" : "#448844");
+                    ($shared ? "#005555" : "#448844");
                 my $fgcolour=
                     $avail ? "#000000" : "#ffffff";
                printf "<td valign=top rowspan=%d".
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.