diff mbox series

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

Message ID 20201007180024.7932-9-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series Reuse test hosts | expand

Commit Message

Ian Jackson Oct. 7, 2020, 5:59 p.m. UTC
From: Ian Jackson <ian.jackson@eu.citrix.com>

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@eu.citrix.com>
---
 ms-planner | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

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".