Add label tags to group <input> tags with their labels. Also add
[invirt/packages/invirt-web.git] / code / templates / list.mako
index 71afd55..c3167cb 100644 (file)
@@ -53,19 +53,18 @@ VM List
        ${self.fn.errorRow('autoinstall', err)}
        <tr>
          <td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
        ${self.fn.errorRow('autoinstall', err)}
        <tr>
          <td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
-         <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
-                 onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
+         <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
+                 onchange="$('cdromlist').value = ''; $('vmtype-linux').checked = true" />
 ${self.fn.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.)
 ${self.fn.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.)
-         </input>
+</label></td>
        </tr>
        <tr>
          <td>Boot CD</td>
        </tr>
        <tr>
          <td>Boot CD</td>
-         <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
-                onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
+         <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
+                onchange="$('autoinstalllist').value = ''; $('vmtype-linux-hvm').checked = true" />
 ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
 ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
-</td>
-         </input>
+</label></td>
        </tr>
        ${self.fn.errorRow('cdrom', err)}
        ${self.fn.errorRow('cdrom', err)}
        </tr>
        ${self.fn.errorRow('cdrom', err)}
        ${self.fn.errorRow('cdrom', err)}
@@ -84,23 +83,27 @@ ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoin
 <%def name="machineRow(machine)">
       <tr> 
        <td rowspan="2">
 <%def name="machineRow(machine)">
       <tr> 
        <td rowspan="2">
-         <form action="command" method="post">
+       % if machine.uptime and installing[machine]:
+       <img src="static/power_installing.png" alt="Installing..." />
+       % else:
+         <form action="machine/${machine.machine_id}/command/${'shutdown' if machine.uptime else 'create'}" method="post">
            <input type="hidden" name="back" value="list"/>
            <input type="hidden" name="machine_id"
                   value="${machine.machine_id}"/>
            <input type="hidden" name="back" value="list"/>
            <input type="hidden" name="machine_id"
                   value="${machine.machine_id}"/>
-<input type="submit" class="power ${'on' if machine.uptime else 'off'}" name="action" value="${'Power off' if machine.uptime else 'Power on'}"\
+<input type="submit" class="power ${'on' if machine.uptime else 'off'}" name="action" value="${'Shutdown' if machine.uptime else 'Power on'}"\
 % if machine.uptime:
  onclick="return confirm('Are you sure you want to power off this VM?');"
 % endif
 />
          </form>
 % if machine.uptime:
  onclick="return confirm('Are you sure you want to power off this VM?');"
 % endif
 />
          </form>
+         % endif
        </td>
        <td><a href="machine/${machine.machine_id}">${machine.name}</a></td>
        <td>${machine.memory}M</td>
        <td>${machine.owner}</td>
        <td>${machine.administrator}</td>
 % if machine.nics:
        </td>
        <td><a href="machine/${machine.machine_id}">${machine.name}</a></td>
        <td>${machine.memory}M</td>
        <td>${machine.owner}</td>
        <td>${machine.administrator}</td>
 % if machine.nics:
-       <td>${', '.join(map(lambda x: x.ip, machine.nics))}</td>
+       <td>${', '.join(nic.ip for nic in machine.nics)}</td>
 % else:
        <td></td>
 % endif
 % else:
        <td></td>
 % endif
@@ -143,7 +146,7 @@ ${has_vnc[machine]}
     <script type="text/javascript" src="/static/stripe.js"></script>
     <script type="text/javascript">
         document.observe("dom:loaded", function() {
     <script type="text/javascript" src="/static/stripe.js"></script>
     <script type="text/javascript">
         document.observe("dom:loaded", function() {
-            stripe(\$('machinelist').getElementsByTagName('table')[0],
+            stripe($('machinelist').getElementsByTagName('table')[0],
                    'stripedrow');
         });
     </script>
                    'stripedrow');
         });
     </script>