Correct the incomplete fix from r1155
[invirt/packages/invirt-web.git] / code / templates / list.tmpl
index 71f36ea..cf59937 100644 (file)
@@ -1,5 +1,7 @@
 #from skeleton import skeleton
+#from invirt.config import structs as config
 #extends skeleton
+#import datetime
 
 
 #def title
@@ -19,36 +21,77 @@ VM List
     <form action="create" method="POST">
     <input type="hidden" name="back" value="list"/>
       <table>
+#filter None
       $errorRow('create', $err)
+#end filter
        <tr>
          <td>Name</td>
-         <td><input type="text" name="name" value="$defaults.name"/></td>
+         <td><input type="text" name="name" value="$defaults.name"/>.${config.dns.domains[0]}</td>
        </tr>
+#filter None
 $errorRow('name', $err)
+#end filter
+       <tr>
+         <td>Description</td>
+         <td><textarea name="description" rows="4" cols="60">$defaults.description</textarea></td>
+       </tr>
+#filter None
+$errorRow('description', $err)
+#end filter
        <tr>
          <td>Memory</td>
          <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td>
        </tr>
+#filter None
 $errorRow('memory', $err)
+#end filter
        <tr>
          <td>Disk</td>
-         <td><input type="text" name="disk" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
+         <td><input type="text" name="disksize" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
        </tr>
+#filter None
 $errorRow('disk', $err)
+#end filter
         <tr>
-          <td>HVM/ParaVM$helppopup('hvm_paravm')</td>
-          <td>$vmTypeList($defaults.type)</td>
+          <td>HVM/ParaVM#slurp
+#filter None
+$helppopup('HVM/ParaVM')#slurp
+#end filter
+</td>
+          <td>
+#filter None
+$vmTypeList($defaults.type)
+#end filter
+</td>
         </tr>
+#filter None
 $errorRow('vmtype', $err)
+#end filter
+#filter None
+$errorRow('autoinstall', $err)
+#end filter
        <tr>
-         <td>Autoinstall$helppopup('autoinstall')</td>
-         <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">$autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''")
-             (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.)
+         <td>Autoinstall#slurp
+#filter None
+$helppopup('Autoinstalls')#slurp
+#end filter
+</td>
+         <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
+                 onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
+#filter None
+$autoList($defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")
+             (experimental; 2-3 minutes, and you have a machine with empty root password.)
+#end filter
          </input>
        </tr>
        <tr>
          <td>Boot CD</td>
-         <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>$cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''")</td>
+         <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked
+                onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
+#filter None
+$cdromList($defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")
+#end filter
+</td>
          </input>
        </tr>
 $errorRow('cdrom', $err)
@@ -57,15 +100,33 @@ $errorRow('cdrom', $err)
          <td>Owner</td>
          <td><input type="text" name="owner" value="$defaults.owner"/></td>
        </tr>
+#filter None
        $errorRow('owner', $err)
+#end filter
       </table>
-      <input type="submit" class="button" value="Create it!"/>
+      <input type="submit" class="button" value="Create it!"/><br />
+      Windows notes: #slurp
+#filter None
+$helppopup('Windows')#slurp
+#end filter
     </form>
 #end if
 #end def
 
 #def machineRow($machine)
       <tr> 
+       <td rowspan="2">
+         <form action="command" method="post">
+           <input type="hidden" name="back" value="list"/>
+           <input type="hidden" name="machine_id"
+                  value="$machine.machine_id"/>
+<input type="submit" class="power #slurp
+#if $machine.uptime then 'on' else 'off'
+" name="action" value="#slurp
+#if $machine.uptime then 'Power off' else 'Power on'
+"/>
+         </form>
+       </td>
        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
        <td>${machine.memory}M</td>
        <td>$machine.owner</td>
@@ -78,56 +139,72 @@ $errorRow('cdrom', $err)
 #end if
 <td>#slurp
 #if $machine.uptime
-$machine.uptime#slurp
+${datetime.timedelta(seconds=int(machine.uptime))}#slurp
 #end if
 </td>
        <td>#slurp
 #if $has_vnc[$machine] == True
 <a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
 #else if $has_vnc[$machine] != 'Off'
+#filter None
 $has_vnc[$machine]
+#end filter
 #end if
 </td>
-       <td>
-         <form action="command" method="post">
-           <input type="hidden" name="back" value="list"/>
-           <input type="hidden" name="machine_id"
-                  value="$machine.machine_id"/>
-<input type="submit" class="button" name="action" value="#slurp
-#if $machine.uptime then 'Power off' else 'Power on'
-"/>
-         </form>
-       </td>
+      </tr>
+      <tr>
+        <td colspan="7" style="padding-left: 1em; color: #666">$machine.description</td>
       </tr>
 #end def
 
 #def machineList($machines)
-    <table>
+    <table cellspacing="0" cellpadding="2">
       <tr>
+       <th></th>
        <th>Name</th>
        <th>Memory</th>
-       <th>Owner$helppopup('owner')</th>
-        <th>Administrator$helppopup('administrator')</th>
+       <th>Owner#slurp
+#filter None
+$helppopup('Owner')#slurp
+#end filter
+</th>
+        <th>Administrator#slurp
+#filter None
+$helppopup('Administrator')#slurp
+#end filter
+</th>
        <th>IP</th>
        <th>Uptime</th>
        <th>VNC</th>
-       <th></th>
       </tr>
       #for $machine in $machines:
+    #filter None
        $machineRow($machine)
+    #end filter
       #end for
     </table>
+    <script type="text/javascript" src="/static/stripe.js"></script>
+    <script type="text/javascript">
+        document.observe("dom:loaded", function() {
+            stripe(\$('machinelist').getElementsByTagName('table')[0],
+                   'stripedrow');
+        });
+    </script>
 #end def
 
 
 #def body
-<p style="font-size: 125%;">SIPB Virtual Servers is an <strong>alpha service</strong>.  <a href="/static/about.html">What does this mean?</a></p>
+<p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
 #if not $machines
 <p>You don't currently control any VMs.</p>   
 #end if
     <p><a href="list">refresh</a></p>
     <div id="machinelist">
+    #filter None
     $machineList($machines)
+    #end filter
     </div>
+#filter None
 $createForm()
+#end filter
 #end def