Uploaded image for project: 'VCL'
  1. VCL
  2. VCL-354

View Computers Table - State Coloring

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.1
    • 2.3
    • web gui (frontend)
    • None
    • VCL 2.1 Management Node

    Description

      I found that having the "failed" state being the only thing colored made getting the status of our VM images a little hard to see at a glance. I spent a couple of minutes putting this patch together which makes a cleaner use of that feature but also includes the coloring of the "available" (green) and "reloading" (orange, because yellow is unreadable on the white background) states.

      This improves at-a-glance readability of computer status and the code is extensible to allow more states.

      Patch follows.

      Index: computers.php
      ===================================================================
      — computers.php (revision 942866)
      +++ computers.php (working copy)
      @@ -2095,7 +2095,16 @@
      print " <TH>Notes</TH>\n";
      print " </TR>\n";
      $count = 0;
      +
      + $statecolor = array(
      + "available" => "green",
      + "reloading" => "orange",
      + "failed" => "red",
      + );
      +
      foreach(array_keys($computers) as $id) {
      + $compstate = $computers[$id]['state'];
      +
      if($bygroups) {
      if(! array_key_exists($id, $compidlist))
      continue;
      @@ -2111,8 +2120,8 @@
      print "id=comp$count onclick=\"toggleRowSelect('compid$count');\"></TD>\n";
      print " <TD>" . $computers[$id]["hostname"] . "</TD>\n";
      print " <TD>" . $computers[$id]["IPaddress"] . "</TD>\n";

      • if($computers[$id]['state'] == 'failed')
      • print " <TD><font color=red>{$computers[$id]["state"]}</font></TD>\n";
        + if (isset($statecolor[$computers[$id]['state']]))
        + print " <TD><font color={$statecolor[$compstate]}>{$compstate}</font></TD>\n";
        else
        print " <TD>" . $computers[$id]["state"] . "</TD>\n";
        print " <TD>" . $computers[$id]["owner"] . "</TD>\n";

      Attachments

        Activity

          People

            jfthomps Josh Thompson
            cliffwood Clifton B. Wood
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: