Another bare except removed.
[invirt/packages/invirt-web.git] / templates / list.tmpl
index 7dd0da0..e300f61 100644 (file)
@@ -20,7 +20,7 @@ List of your VMs
        <td>Hostname</td>
        <td>Uptime</td>
        <td>VNC</td>
-       <td>Restart?</td>
+       <td></td>
       #for $machine in $machines:
       <tr> 
        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
@@ -37,49 +37,52 @@ List of your VMs
        <td></td>
 #end if
 <td>#slurp
-#if $uptimes.get($machine.name)
-$uptimes[$machine.name]#slurp
+#if $uptimes[$machine]
+$uptimes[$machine]#slurp
 #else
 Off#slurp
 #end if
 </td>
        <td>#slurp
-#if $has_vnc.get($machine.name) == True
+#if $has_vnc[$machine] == True
 <a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
 #else
-$has_vnc.get($machine.name)
+$has_vnc[$machine]
 #end if
 </td>
        <td>
          <form action="command">
            <input type="hidden" name="machine_id"
                   value="$machine.machine_id"/>
-           <input type="submit" class="button"
-                  value="Reboot"/>
+#if $uptimes[$machine]
+           <input type="submit" class="button" name="action" value="Shutdown"/>
+#else
+           <input type="submit" class="button" name="action" value="Power on"/>
+#end if
          </form>
        </td>
       </tr>
       #end for
     </table>
 #end if
-
+#if $can_add_vm
     <p>Create a new VM:</p>
     <form action="create" method="POST">
       <table>
        <tr>
          <td>Name</td>
-         <td>${user.username}_<input type="text" name="name" value=""/></td>
+         <td><input type="text" name="name" value=""/></td>
        </tr>
        <tr>
          <td>Memory</td>
-         <td><input type="text" name="memory" value="$maxmem" size=3/> megabytes ($maxmem max)</td>
+         <td><input type="text" name="memory" value="$default_mem" size=3/> megabytes ($max_mem max)</td>
        </tr>
        <tr>
          <td>Disk</td>
-         <td><input type="text" name="disk" value="$maxdisk" size=3/> gigabytes ($maxdisk max)</td>
+         <td><input type="text" name="disk" value="$default_disk" size=3/> gigabytes (${"%0.1f" % ($max_disk-0.05)} max)</td>
        </tr>
        <tr>
-         <td>HVM/ParaVM</td>
+         <td>HVM/ParaVM$helppopup('hvm_paravm')</td>
          <td>
            <input checked type="radio" name="vmtype" value="hvm">HVM</input>
            <input type="radio" name="vmtype" value="paravm">ParaVM</input>
@@ -101,5 +104,7 @@ $has_vnc.get($machine.name)
       </table>
       <input type="submit" class="button" value="Create it!"/>
     </form>
-
+#else
+<p>You are at the maximum number of VMs.</p>
+#end if
 #end def