improve display of VM list
authorGreg Price <price@mit.edu>
Thu, 17 Apr 2008 03:13:41 +0000 (23:13 -0400)
committerGreg Price <price@mit.edu>
Thu, 17 Apr 2008 03:13:41 +0000 (23:13 -0400)
svn path=/trunk/packages/sipb-xen-www/; revision=424

code/main.py
code/templates/list.tmpl

index d17ed97..c419f32 100755 (executable)
@@ -210,6 +210,9 @@ def getListDict(user):
                         owner=user,
                         cdrom='gutsy-i386')
     checkpoint.checkpoint('Got defaults')
+    def sortkey(machine):
+        return (machine.owner != user, machine.owner, machine.name)
+    machines = sorted(machines, key=sortkey)
     d = dict(user=user,
              cant_add_vm=validation.cantAddVm(user),
              max_memory=max_memory,
index ae0d564..88bab49 100644 (file)
@@ -84,14 +84,12 @@ $errorRow('cdrom', $err)
 <td>#slurp
 #if $machine.uptime
 $machine.uptime#slurp
-#else
-Off#slurp
 #end if
 </td>
        <td>#slurp
 #if $has_vnc[$machine] == True
 <a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
-#else
+#else if $has_vnc[$machine] != 'Off'
 $has_vnc[$machine]
 #end if
 </td>
@@ -111,14 +109,15 @@ $has_vnc[$machine]
 #def machineList($machines)
     <table>
       <tr>
-       <td>Name</td>
-       <td>Memory</td>
-       <td>Owner</td>
-        <td>Administrator</td>
-       <td>IP</td>
-       <td>Uptime</td>
-       <td>VNC</td>
-       <td></td>
+       <th>Name</th>
+       <th>Memory</th>
+       <th>Owner</th>
+        <th>Administrator</th>
+       <th>IP</th>
+       <th>Uptime</th>
+       <th>VNC</th>
+       <th></th>
+      </tr>
       #for $machine in $machines:
        $machineRow($machine)
       #end for